ibm_db 2.5.26-universal-darwin-14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +233 -0
  3. data/LICENSE +18 -0
  4. data/MANIFEST +14 -0
  5. data/ParameterizedQueries README +39 -0
  6. data/README +225 -0
  7. data/ext/Makefile.nt32 +181 -0
  8. data/ext/Makefile.nt32.191 +212 -0
  9. data/ext/extconf.rb +261 -0
  10. data/ext/ibm_db.c +11793 -0
  11. data/ext/ruby_ibm_db.h +240 -0
  12. data/ext/ruby_ibm_db_cli.c +845 -0
  13. data/ext/ruby_ibm_db_cli.h +489 -0
  14. data/init.rb +42 -0
  15. data/lib/IBM_DB.rb +19 -0
  16. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +3289 -0
  17. data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1965 -0
  18. data/lib/active_record/connection_adapters/ibmdb_adapter.rb +2 -0
  19. data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -0
  20. data/lib/linux/rb18x/ibm_db.bundle +0 -0
  21. data/lib/linux/rb19x/ibm_db.bundle +0 -0
  22. data/lib/linux/rb20x/ibm_db.bundle +0 -0
  23. data/lib/linux/rb21x/ibm_db.bundle +0 -0
  24. data/test/cases/adapter_test.rb +207 -0
  25. data/test/cases/associations/belongs_to_associations_test.rb +711 -0
  26. data/test/cases/associations/cascaded_eager_loading_test.rb +181 -0
  27. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +851 -0
  28. data/test/cases/associations/join_model_test.rb +743 -0
  29. data/test/cases/attribute_methods_test.rb +822 -0
  30. data/test/cases/base_test.rb +2133 -0
  31. data/test/cases/calculations_test.rb +482 -0
  32. data/test/cases/migration_test.rb +2408 -0
  33. data/test/cases/persistence_test.rb +642 -0
  34. data/test/cases/query_cache_test.rb +257 -0
  35. data/test/cases/relations_test.rb +1182 -0
  36. data/test/cases/schema_dumper_test.rb +256 -0
  37. data/test/cases/transaction_callbacks_test.rb +300 -0
  38. data/test/cases/validations/uniqueness_validation_test.rb +299 -0
  39. data/test/cases/xml_serialization_test.rb +408 -0
  40. data/test/config.yml +154 -0
  41. data/test/connections/native_ibm_db/connection.rb +44 -0
  42. data/test/ibm_db_test.rb +25 -0
  43. data/test/models/warehouse_thing.rb +5 -0
  44. data/test/schema/i5/ibm_db_specific_schema.rb +137 -0
  45. data/test/schema/ids/ibm_db_specific_schema.rb +140 -0
  46. data/test/schema/luw/ibm_db_specific_schema.rb +137 -0
  47. data/test/schema/schema.rb +751 -0
  48. data/test/schema/zOS/ibm_db_specific_schema.rb +208 -0
  49. metadata +114 -0
data/ext/Makefile.nt32 ADDED
@@ -0,0 +1,181 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir =$(TOP)/opendbad/win/ruby_win_exes/ruby_1.8.6/lib/ruby/1.8/i386-mswin32
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir);$(topdir);$(hdrdir)
10
+
11
+
12
+ DESTDIR = $(TOP)/opendbad/win/ruby_win_exes
13
+ prefix = $(DESTDIR)/ruby_1.8.6
14
+ exec_prefix = $(DESTDIR)/ruby_1.8.6
15
+ sitedir = $(prefix)/lib/ruby/site_ruby
16
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
17
+ archdir = $(rubylibdir)/$(arch)
18
+ sbindir = $(exec_prefix)/sbin
19
+ datadir = $(prefix)/share
20
+ includedir = $(prefix)/include
21
+ infodir = $(prefix)/info
22
+ sysconfdir = $(prefix)/etc
23
+ mandir = $(prefix)/man
24
+ libdir = $(DESTDIR)/ruby_1.8.6/lib
25
+ sharedstatedir = $(DESTDIR)/etc
26
+ oldincludedir = $(DESTDIR)/usr/include
27
+ sitearchdir = $(sitelibdir)/$(sitearch)
28
+ localstatedir = $(DESTDIR)/var
29
+ bindir = $(exec_prefix)/bin
30
+ sitelibdir = $(sitedir)/$(ruby_version)
31
+ libexecdir = $(exec_prefix)/libexec
32
+
33
+ CC = cl -nologo
34
+ LIBRUBY = $(RUBY_SO_NAME).lib
35
+ LIBRUBY_A = msvcrt-ruby18-static.lib
36
+ LIBRUBYARG_SHARED = $(LIBRUBY)
37
+ LIBRUBYARG_STATIC = $(LIBRUBY_A)
38
+
39
+ RUBY_EXTCONF_H =
40
+ CFLAGS = -MT -Zi -O2b2xg- -G6
41
+ INCFLAGS = -I. -I. -I$(topdir) -I.
42
+ CPPFLAGS =
43
+ CXXFLAGS = $(CFLAGS)
44
+ DLDFLAGS = -link -incremental:no -debug -opt:ref -opt:icf -dll $(LIBPATH) -def:$(DEFFILE) -implib:$(*F:.so=)-$(arch).lib -pdb:$(*F:.so=)-$(arch).pdb
45
+ LDSHARED = cl -nologo -LD
46
+ AR = lib -nologo
47
+ EXEEXT = .exe
48
+
49
+ RUBY_INSTALL_NAME = ruby
50
+ RUBY_SO_NAME = msvcrt-ruby18
51
+ arch = i386-mswin32
52
+ sitearch = i386-msvcrt
53
+ ruby_version = 1.8
54
+ ruby = $(TOP)/opendbad/win/ruby_win_exes/ruby_1.8.6/bin/ruby.exe
55
+ RUBY = $(ruby:/=\)
56
+ RM = $(RUBY) -run -e rm -- -f
57
+ MAKEDIRS = @$(RUBY) -run -e mkdir -- -p
58
+ INSTALL = @$(RUBY) -run -e install -- -vp
59
+ INSTALL_PROG = $(INSTALL) -m 0755
60
+ INSTALL_DATA = $(INSTALL) -m 0644
61
+ COPY = copy > nul
62
+
63
+ #### End of system configuration section. ####
64
+
65
+ preload =
66
+
67
+ libpath = $(libdir)
68
+ LIBPATH = -libpath:"$(libdir)"
69
+ DEFFILE = $(TARGET)-$(arch).def
70
+
71
+ CLEANFILES =
72
+ DISTCLEANFILES = vc*.pdb $(DEFFILE)
73
+
74
+ extout =
75
+ extout_prefix =
76
+ target_prefix =
77
+ LOCAL_LIBS =
78
+ LIBS = $(LIBRUBYARG_SHARED) db2cli.lib oldnames.lib user32.lib advapi32.lib ws2_32.lib libcmt.lib
79
+ SRCS = ibm_db.c ruby_ibm_db_cli.c
80
+ OBJS = ibm_db.obj ruby_ibm_db_cli.obj
81
+ TARGET = ibm_db
82
+ DLLIB = $(TARGET).so
83
+ EXTSTATIC =
84
+ STATIC_LIB =
85
+
86
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
87
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
88
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
89
+
90
+ TARGET_SO = $(DLLIB)
91
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
92
+ CLEANOBJS = *.obj *.lib *.s[ol] *.pdb *.exp *.bak
93
+
94
+ all: $(DLLIB)
95
+ static: $(STATIC_LIB)
96
+
97
+ clean:
98
+ @-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
99
+
100
+ distclean: clean
101
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
102
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
103
+
104
+ realclean: distclean
105
+ install: install-so install-rb
106
+
107
+ install-so: $(RUBYARCHDIR)
108
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
109
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
110
+ $(INSTALL_PROG) $(DLLIB:/=\) $(RUBYARCHDIR:/=\)
111
+ install-rb: pre-install-rb install-rb-default
112
+ install-rb-default: pre-install-rb-default
113
+ pre-install-rb: Makefile
114
+ pre-install-rb-default: Makefile
115
+ $(RUBYARCHDIR):
116
+ $(MAKEDIRS) $@
117
+
118
+ site-install: site-install-so site-install-rb
119
+ site-install-so: install-so
120
+ site-install-rb: install-rb
121
+
122
+ .SUFFIXES: .c .m .cc .cxx .cpp .obj
123
+
124
+ {$(srcdir)}.cc{}.obj:
125
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
126
+
127
+ {$(topdir)}.cc{}.obj:
128
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
129
+
130
+ {$(hdrdir)}.cc{}.obj:
131
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
132
+
133
+ .cc.obj:
134
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
135
+
136
+ {$(srcdir)}.cxx{}.obj:
137
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
138
+
139
+ {$(topdir)}.cxx{}.obj:
140
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
141
+
142
+ {$(hdrdir)}.cxx{}.obj:
143
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
144
+
145
+ .cxx.obj:
146
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
147
+
148
+ {$(srcdir)}.cpp{}.obj:
149
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
150
+
151
+ {$(topdir)}.cpp{}.obj:
152
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
153
+
154
+ {$(hdrdir)}.cpp{}.obj:
155
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
156
+
157
+ .cpp.obj:
158
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
159
+
160
+ {$(srcdir)}.c{}.obj:
161
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
162
+
163
+ {$(topdir)}.c{}.obj:
164
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
165
+
166
+ {$(hdrdir)}.c{}.obj:
167
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
168
+
169
+ .c.obj:
170
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
171
+
172
+ $(DLLIB): $(DEFFILE) $(OBJS)
173
+ @-$(RM) $@
174
+ $(LDSHARED) -Fe$(@) $(OBJS) $(LIBS) $(LOCAL_LIBS) $(DLDFLAGS)
175
+
176
+
177
+
178
+ $(DEFFILE):
179
+ $(RUBY) -e "puts 'EXPORTS', 'Init_$(TARGET)'" > $@
180
+
181
+ $(OBJS): {.;$(srcdir);$(topdir);$(hdrdir)}ruby.h {.;$(srcdir);$(topdir);$(hdrdir)}defines.h
@@ -0,0 +1,212 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = $(TOP)/opendbad/win/ruby_win_exes/ruby191/include/ruby-1.9.1
8
+ hdrdir = $(TOP)/opendbad/win/ruby_win_exes/ruby191/include/ruby-1.9.1
9
+ arch_hdrdir = $(TOP)/opendbad/win/ruby_win_exes/ruby191/include/ruby-1.9.1/$(arch)
10
+ VPATH = $(srcdir);$(arch_hdrdir)/ruby;$(hdrdir)/ruby
11
+
12
+ DESTDIR = $(TOP)/opendbad/win/ruby_win_exes
13
+ prefix = $(DESTDIR)/ruby191
14
+ exec_prefix = $(prefix)
15
+ bindir = $(exec_prefix)/bin
16
+ sbindir = $(exec_prefix)/sbin
17
+ libexecdir = $(exec_prefix)/libexec
18
+ datadir = $(prefix)/share
19
+ sysconfdir = $(prefix)/etc
20
+ sharedstatedir = $(DESTDIR)/etc
21
+ localstatedir = $(DESTDIR)/var
22
+ libdir = $(exec_prefix)/lib
23
+ includedir = $(prefix)/include
24
+ oldincludedir = $(DESTDIR)/usr/include
25
+ infodir = $(prefix)/info
26
+ mandir = $(prefix)/man
27
+ sitedir = $(prefix)/lib/$(RUBY_INSTALL_NAME)/site_ruby
28
+ vendordir = $(prefix)/lib/$(RUBY_INSTALL_NAME)/vendor_ruby
29
+ rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
30
+ sitehdrdir = $(rubyhdrdir)/site_ruby
31
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
32
+ rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
33
+ archdir = $(rubylibdir)/$(arch)
34
+ sitelibdir = $(sitedir)/$(ruby_version)
35
+ sitearchdir = $(sitelibdir)/$(sitearch)
36
+ vendorlibdir = $(vendordir)/$(ruby_version)
37
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
38
+
39
+ CC = cl -nologo
40
+ CXX = $(CC)
41
+ LIBRUBY = $(RUBY_SO_NAME).lib
42
+ LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
43
+ LIBRUBYARG_SHARED = $(LIBRUBY)
44
+ LIBRUBYARG_STATIC = $(LIBRUBY_A)
45
+ OUTFLAG = -Fe
46
+ COUTFLAG = -Fo
47
+
48
+ RUBY_EXTCONF_H = unicode_support_version
49
+ cflags =
50
+ optflags =
51
+ debugflags =
52
+ warnflags =
53
+ CFLAGS = -MT -Zi -O2b2xg- -G6 -Zm600
54
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
55
+ DEFS =
56
+ CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\"
57
+ CXXFLAGS = $(CFLAGS) -MT -Zi -O2b2xg- -G6 -Zm600
58
+ ldflags =
59
+ dldflags = -link -incremental:no -debug -opt:ref -opt:icf -dll $(LIBPATH)
60
+ archflag =
61
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
62
+ LDSHARED = cl -nologo -LD
63
+ LDSHAREDXX = $(LDSHARED)
64
+ AR = lib -nologo
65
+ EXEEXT = .exe
66
+
67
+ RUBY_INSTALL_NAME = ruby
68
+ RUBY_SO_NAME = msvcrt-ruby191
69
+ arch = i386-mswin32
70
+ sitearch = i386-msvcrt
71
+ ruby_version = 1.9.1
72
+ ruby = $(TOP)/opendbad/win/ruby_win_exes/ruby191/bin/ruby
73
+ RUBY = $(ruby:/=\)
74
+ RM = $(RUBY) -run -e rm -- -f
75
+ RM_RF = $(RUBY) -run -e rm -- -rf
76
+ RMDIRS = $(RUBY) -run -e rmdir -- -p
77
+ MAKEDIRS = @$(RUBY) -run -e mkdir -- -p
78
+ INSTALL = @$(RUBY) -run -e install -- -vp
79
+ INSTALL_PROG = $(INSTALL) -m 0755
80
+ INSTALL_DATA = $(INSTALL) -m 0644
81
+ COPY = copy > nul
82
+
83
+ #### End of system configuration section. ####
84
+
85
+ preload =
86
+
87
+ libpath = . $(libdir) C:/Progra~1/IBM/SQLLIB/lib
88
+ LIBPATH = -libpath:"." -libpath:"$(libdir)"
89
+ DEFFILE = $(TARGET)-$(arch).def
90
+
91
+ CLEANFILES = mkmf.log
92
+ DISTCLEANFILES = vc*.pdb $(DEFFILE)
93
+ DISTCLEANDIRS =
94
+
95
+ extout =
96
+ extout_prefix =
97
+ target_prefix =
98
+ LOCAL_LIBS =
99
+ LIBS = $(LIBRUBYARG_SHARED) db2cli.lib oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib libcmt.lib
100
+ SRCS = ibm_db.c ruby_ibm_db_cli.c
101
+ OBJS = ibm_db.obj ruby_ibm_db_cli.obj
102
+ TARGET = ibm_db
103
+ DLLIB = $(TARGET).so
104
+ EXTSTATIC =
105
+ STATIC_LIB =
106
+
107
+ BINDIR = $(bindir)
108
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
109
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
110
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
111
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
112
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
113
+
114
+ TARGET_SO = $(DLLIB)
115
+ CLEANLIBS = $(TARGET).so
116
+ CLEANOBJS = *.obj $(TARGET).exp $(TARGET).lib $(TARGET).pdb *.bak
117
+
118
+ all: $(DLLIB)
119
+ static: $(STATIC_LIB)
120
+
121
+ clean-rb-default::
122
+ clean-rb::
123
+ clean-so::
124
+ clean: clean-so clean-rb-default clean-rb
125
+ @-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
126
+
127
+ distclean-rb-default::
128
+ distclean-rb::
129
+ distclean-so::
130
+ distclean: clean distclean-so distclean-rb-default distclean-rb
131
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
132
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
133
+ @-$(RMDIRS) $(DISTCLEANDIRS:/=\)
134
+
135
+ realclean: distclean
136
+ install: install-so install-rb
137
+
138
+ install-so: $(RUBYARCHDIR)
139
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
140
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
141
+ $(INSTALL_PROG) $(DLLIB:/=\) $(RUBYARCHDIR:/=\)
142
+ install-rb: pre-install-rb install-rb-default
143
+ install-rb-default: pre-install-rb-default
144
+ pre-install-rb: Makefile
145
+ pre-install-rb-default: Makefile
146
+ $(RUBYARCHDIR):
147
+ $(MAKEDIRS) $@
148
+
149
+ site-install: site-install-so site-install-rb
150
+ site-install-so: install-so
151
+ site-install-rb: install-rb
152
+
153
+ .SUFFIXES: .c .m .cc .cxx .cpp .obj
154
+
155
+ {$(hdrdir)}.cc.obj:
156
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
157
+
158
+ {$(topdir)}.cc.obj:
159
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
160
+
161
+ {$(srcdir)}.cc.obj:
162
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
163
+
164
+ .cc.obj:
165
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
166
+
167
+ {$(hdrdir)}.cxx.obj:
168
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
169
+
170
+ {$(topdir)}.cxx.obj:
171
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
172
+
173
+ {$(srcdir)}.cxx.obj:
174
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
175
+
176
+ .cxx.obj:
177
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
178
+
179
+ {$(hdrdir)}.cpp.obj:
180
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
181
+
182
+ {$(topdir)}.cpp.obj:
183
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
184
+
185
+ {$(srcdir)}.cpp.obj:
186
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
187
+
188
+ .cpp.obj:
189
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tp$(<:\=/)
190
+
191
+ {$(hdrdir)}.c.obj:
192
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
193
+
194
+ {$(topdir)}.c.obj:
195
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
196
+
197
+ {$(srcdir)}.c.obj:
198
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
199
+
200
+ .c.obj:
201
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) $(COUTFLAG)$(@) -c -Tc$(<:\=/)
202
+
203
+ $(DLLIB): $(DEFFILE) $(OBJS) Makefile
204
+ @-$(RM) $(@:/=\)
205
+ $(LDSHARED) -Fe$(@) $(OBJS) $(LIBS) $(LOCAL_LIBS) $(DLDFLAGS) -implib:$(*F:.so=)-$(arch).lib -pdb:$(*F:.so=)-$(arch).pdb -def:$(DEFFILE)
206
+
207
+
208
+
209
+ $(DEFFILE):
210
+ $(RUBY) -e "puts 'EXPORTS', 'Init_$(TARGET)'" > $@
211
+
212
+ $(OBJS): {.;$(VPATH)}$(hdrdir)/ruby.h {.;$(VPATH)}$(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
data/ext/extconf.rb ADDED
@@ -0,0 +1,261 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'open-uri'
4
+ require 'rubygems/package'
5
+ require 'zlib'
6
+ require 'fileutils'
7
+
8
+
9
+ # +----------------------------------------------------------------------+
10
+ # | Licensed Materials - Property of IBM |
11
+ # | |
12
+ # | (C) Copyright IBM Corporation 2006 - 2015 |
13
+ # +----------------------------------------------------------------------+
14
+
15
+ TAR_LONGLINK = '././@LongLink'
16
+
17
+ WIN = RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
18
+
19
+ # use ENV['IBM_DB_HOME'] or latest db2 you can find
20
+ IBM_DB_HOME = ENV['IBM_DB_HOME']
21
+
22
+ machine_bits = ['ibm'].pack('p').size * 8
23
+
24
+ is64Bit = true
25
+
26
+ if machine_bits == 64
27
+ is64Bit = true
28
+ puts "Detected 64-bit Ruby\n "
29
+ else
30
+ is64Bit = false
31
+ puts "Detected 32-bit Ruby\n "
32
+ end
33
+
34
+ module Kernel
35
+ def suppress_warnings
36
+ origVerbosity = $VERBOSE
37
+ $VERBOSE = nil
38
+ result = yield
39
+ $VERBOSE = origVerbosity
40
+ return result
41
+ end
42
+ end
43
+
44
+ DOWNLOADLINK = ''
45
+
46
+ if(RUBY_PLATFORM =~ /aix/i)
47
+ #AIX
48
+ if(is64Bit)
49
+ puts "Detected platform - aix 64"
50
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/aix64_odbc_cli.tar.gz"
51
+ else
52
+ puts "Detected platform - aix 32"
53
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/aix32_odbc_cli.tar.gz"
54
+ end
55
+ elsif (RUBY_PLATFORM =~ /powerpc/ || RUBY_PLATFORM =~ /ppc/)
56
+ #PPC
57
+ if(is64Bit)
58
+ puts "Detected platform - ppc linux 64"
59
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ppc64_odbc_cli.tar.gz"
60
+ else
61
+ puts "Detected platform - ppc linux 64"
62
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ppc32_odbc_cli.tar.gz"
63
+ end
64
+ elsif (RUBY_PLATFORM =~ /linux/)
65
+ #x86
66
+ if(is64Bit)
67
+ puts "Detected platform - linux x86 64"
68
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz"
69
+ else
70
+ puts "Detected platform - linux 32"
71
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxia32_odbc_cli.tar.gz"
72
+ end
73
+ elsif (RUBY_PLATFORM =~ /sparc/i)
74
+ #Solaris
75
+ if(is64Bit)
76
+ puts "Detected platform - sun sparc64"
77
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/sun64_odbc_cli.tar.gz"
78
+ else
79
+ puts "Detected platform - sun sparc32"
80
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/sun32_odbc_cli.tar.gz"
81
+ end
82
+ elsif (RUBY_PLATFORM =~ /solaris/i)
83
+ if(is64Bit)
84
+ puts "Detected platform - sun amd64"
85
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/sunamd64_odbc_cli.tar.gz"
86
+ else
87
+ puts "Detected platform - sun amd32"
88
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/sunamd32_odbc_cli.tar.gz"
89
+ end
90
+ end
91
+
92
+ def downloadCLIPackage(destination, link = nil)
93
+ if(link.nil?)
94
+ downloadLink = DOWNLOADLINK
95
+ else
96
+ downloadLink = link
97
+ end
98
+
99
+ uri = URI.parse(downloadLink)
100
+ filename = "#{destination}/clidriver.tar.gz"
101
+
102
+ headers = {
103
+ 'Accept-Encoding' => 'identity',
104
+ }
105
+
106
+ request = Net::HTTP::Get.new(uri.request_uri, headers)
107
+ http = Net::HTTP.new(uri.host, uri.port)
108
+ response = http.request(request)
109
+
110
+ f = open(filename, 'wb')
111
+ f.write(response.body)
112
+ f.close()
113
+
114
+ filename
115
+ end
116
+
117
+ def untarCLIPackage(archive,destination)
118
+ Gem::Package::TarReader.new( Zlib::GzipReader.open(archive) ) do |tar|
119
+ tar.each do |entry|
120
+ file = nil
121
+ if entry.full_name == $TAR_LONGLINK
122
+ file = File.join destination, entry.read.strip
123
+ next
124
+ end
125
+ file ||= File.join destination, entry.full_name
126
+ if entry.directory?
127
+ File.delete file if File.file? file
128
+ FileUtils.mkdir_p file, :mode => entry.header.mode, :verbose => false
129
+ elsif entry.file?
130
+ FileUtils.rm_rf file if File.directory? file
131
+ File.open file, "wb" do |f|
132
+ f.print entry.read
133
+ end
134
+ FileUtils.chmod entry.header.mode, file, :verbose => false
135
+ elsif entry.header.typeflag == '2' #Symlink!
136
+ File.symlink entry.header.linkname, file
137
+ end
138
+ end
139
+ end
140
+ end
141
+
142
+ if(IBM_DB_HOME == nil || IBM_DB_HOME == '')
143
+ IBM_DB_INCLUDE = ENV['IBM_DB_INCLUDE']
144
+ IBM_DB_LIB = ENV['IBM_DB_LIB']
145
+
146
+ if( ( (IBM_DB_INCLUDE.nil?) || (IBM_DB_LIB.nil?) ) ||
147
+ ( IBM_DB_INCLUDE == '' || IBM_DB_LIB == '' )
148
+ )
149
+ if(!DOWNLOADLINK.nil? && !DOWNLOADLINK.empty?)
150
+ puts "Environment variable IBM_DB_HOME is not set. Downloading and setting up the DB2 client driver\n"
151
+ destination = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/../lib"
152
+
153
+ archive = downloadCLIPackage(destination)
154
+ untarCLIPackage(archive,destination)
155
+
156
+ IBM_DB_HOME="#{destination}/clidriver"
157
+
158
+ IBM_DB_INCLUDE = "#{IBM_DB_HOME}/include"
159
+ IBM_DB_LIB="#{IBM_DB_HOME}/lib"
160
+ else
161
+ puts "Environment variable IBM_DB_HOME is not set. Set it to your DB2/IBM_Data_Server_Driver installation directory and retry gem install.\n "
162
+ exit 1
163
+ end
164
+ end
165
+ else
166
+ IBM_DB_INCLUDE = "#{IBM_DB_HOME}/include"
167
+
168
+ if(is64Bit)
169
+ IBM_DB_LIB="#{IBM_DB_HOME}/lib64"
170
+ else
171
+ IBM_DB_LIB="#{IBM_DB_HOME}/lib32"
172
+ end
173
+ end
174
+
175
+ if( !(File.directory?(IBM_DB_LIB)) )
176
+ suppress_warnings{IBM_DB_LIB = "#{IBM_DB_HOME}/lib"}
177
+ if( !(File.directory?(IBM_DB_LIB)) )
178
+ puts "Cannot find #{IBM_DB_LIB} directory. Check if you have set the IBM_DB_HOME environment variable's value correctly\n "
179
+ exit 1
180
+ end
181
+ notifyString = "Detected usage of IBM Data Server Driver package. Ensure you have downloaded "
182
+
183
+ if(is64Bit)
184
+ notifyString = notifyString + "64-bit package "
185
+ else
186
+ notifyString = notifyString + "32-bit package "
187
+ end
188
+ notifyString = notifyString + "of IBM_Data_Server_Driver and retry the 'gem install ibm_db' command\n "
189
+
190
+ puts notifyString
191
+ end
192
+
193
+ if( !(File.directory?(IBM_DB_INCLUDE)) )
194
+ puts " #{IBM_DB_HOME}/include folder not found. Check if you have set the IBM_DB_HOME environment variable's value correctly\n "
195
+ exit 1
196
+ end
197
+
198
+ require 'mkmf'
199
+
200
+ dir_config('IBM_DB',IBM_DB_INCLUDE,IBM_DB_LIB)
201
+
202
+ def crash(str)
203
+ printf(" extconf failure: %s\n", str)
204
+ exit 1
205
+ end
206
+
207
+ if( RUBY_VERSION =~ /1.9/ || RUBY_VERSION =~ /2./)
208
+ create_header('gil_release_version')
209
+ create_header('unicode_support_version')
210
+ end
211
+
212
+ unless (have_library(WIN ? 'db2cli' : 'db2','SQLConnect') or find_library(WIN ? 'db2cli' : 'db2','SQLConnect', IBM_DB_LIB))
213
+ crash(<<EOL)
214
+ Unable to locate libdb2.so/a under #{IBM_DB_LIB}
215
+
216
+ Follow the steps below and retry
217
+
218
+ Step 1: - Install IBM DB2 Universal Database Server/Client
219
+
220
+ step 2: - Set the environment variable IBM_DB_HOME as below
221
+
222
+ (assuming bash shell)
223
+
224
+ export IBM_DB_HOME=<DB2/IBM_Data_Server_Driver installation directory> #(Eg: export IBM_DB_HOME=/opt/ibm/db2/v10)
225
+
226
+ step 3: - Retry gem install
227
+
228
+ EOL
229
+ end
230
+
231
+ if(RUBY_VERSION =~ /2./)
232
+ require 'rbconfig'
233
+ end
234
+
235
+ alias :libpathflag0 :libpathflag
236
+ def libpathflag(libpath)
237
+ if(RUBY_VERSION =~ /2./)
238
+ libpathflag0 + case RbConfig::CONFIG["arch"]
239
+ when /solaris2/
240
+ libpath[0..-2].map {|path| " -R#{path}"}.join
241
+ when /linux/
242
+ libpath[0..-2].map {|path| " -R#{path} "}.join
243
+ else
244
+ ""
245
+ end
246
+ else
247
+ libpathflag0 + case Config::CONFIG["arch"]
248
+ when /solaris2/
249
+ libpath[0..-2].map {|path| " -R#{path}"}.join
250
+ when /linux/
251
+ libpath[0..-2].map {|path| " -R#{path} "}.join
252
+ else
253
+ ""
254
+ end
255
+ end
256
+ end
257
+
258
+ have_header('gil_release_version')
259
+ have_header('unicode_support_version')
260
+
261
+ create_makefile('ibm_db')