ibm_db 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26a577a4922f7be45acf9cacfb0f52111d0a1a4e
4
- data.tar.gz: c8da2ac6c56920a853a4df893005b5c39d2dec06
3
+ metadata.gz: caa87fd862d075397e91ec15c54be4ccf5bf3d2b
4
+ data.tar.gz: 40fa1f8875554beeb13c034689ca03729d299375
5
5
  SHA512:
6
- metadata.gz: 42333ea888f862ed6d68885ffe43acab40c76fdc6c6fb4b577e3c64dc47cd37f8fb8e69db6d2df4ecbbea2b6be6ad056db8584df53f2bababf43a85f1fe091ac
7
- data.tar.gz: 040422af50377dcda8a5fca15454876186c45b77cdb7ba022f9ecd75da54cb0f755083d3b98738e11494c28c1f90112c4ef5006642d1274f3d7ddc52699a358d
6
+ metadata.gz: 2dd9e056a1586f68a1e0efd17ca5c243164b6e508516c9b3fd93cafac1ee3186df7a7640d50714a06b6e21e0837f06eab363fedf3f16fb6253852159434a21b0
7
+ data.tar.gz: eabf9bd7be4b38c729db8f1d9ea8b462c2c50cb538f1912a50f64a8c2a85616488603ef309a31006163d4e83f7e8f262fcba6ccd964d6143405d6d09ff29925c
data/CHANGES CHANGED
@@ -1,5 +1,8 @@
1
1
  Change Log
2
2
  ==============
3
+ 2015/07/14 (IBM_DB adapter 2.6.1, driver 2.6.1)
4
+ - Foreign key support
5
+
3
6
  2015/06/29 (IBM_DB adapter 2.6.0, driver 2.6.0)
4
7
  - Enhanced installation for Windows to pull IBM Data Server Driver automatically on first use if not present
5
8
  - Enhanced installation for Mac OS to pull IBM Data Server Driver automatically if not present
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  =====================================================================
2
- README for the IBM_DB Adapter (2.6.0) and Driver (2.6.0) (2015/06/29)
2
+ README for the IBM_DB Adapter (2.6.1) and Driver (2.6.1) (2015/07/14)
3
3
  For ActiveRecord Version >= 1.15.5 (and Rails >= 1.2.5)
4
4
  =====================================================================
5
5
 
@@ -1,269 +1,269 @@
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
- elsif (RUBY_PLATFORM =~ /darwin/i)
91
- if(is64Bit)
92
- puts "Detected platform - MacOS darwin64"
93
- DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macos64_odbc_cli.tar.gz"
94
- else
95
- puts "Mac OS 32 bit not supported. Please use an x64 architecture."
96
- end
97
- end
98
-
99
- def downloadCLIPackage(destination, link = nil)
100
- if(link.nil?)
101
- downloadLink = DOWNLOADLINK
102
- else
103
- downloadLink = link
104
- end
105
-
106
- uri = URI.parse(downloadLink)
107
- filename = "#{destination}/clidriver.tar.gz"
108
-
109
- headers = {
110
- 'Accept-Encoding' => 'identity',
111
- }
112
-
113
- request = Net::HTTP::Get.new(uri.request_uri, headers)
114
- http = Net::HTTP.new(uri.host, uri.port)
115
- response = http.request(request)
116
-
117
- f = open(filename, 'wb')
118
- f.write(response.body)
119
- f.close()
120
-
121
- filename
122
- end
123
-
124
- def untarCLIPackage(archive,destination)
125
- Gem::Package::TarReader.new( Zlib::GzipReader.open(archive) ) do |tar|
126
- tar.each do |entry|
127
- file = nil
128
- if entry.full_name == $TAR_LONGLINK
129
- file = File.join destination, entry.read.strip
130
- next
131
- end
132
- file ||= File.join destination, entry.full_name
133
- if entry.directory?
134
- File.delete file if File.file? file
135
- FileUtils.mkdir_p file, :mode => entry.header.mode, :verbose => false
136
- elsif entry.file?
137
- FileUtils.rm_rf file if File.directory? file
138
- File.open file, "wb" do |f|
139
- f.print entry.read
140
- end
141
- FileUtils.chmod entry.header.mode, file, :verbose => false
142
- elsif entry.header.typeflag == '2' #Symlink!
143
- File.symlink entry.header.linkname, file
144
- end
145
- end
146
- end
147
- end
148
-
149
- if(IBM_DB_HOME == nil || IBM_DB_HOME == '')
150
- IBM_DB_INCLUDE = ENV['IBM_DB_INCLUDE']
151
- IBM_DB_LIB = ENV['IBM_DB_LIB']
152
-
153
- if( ( (IBM_DB_INCLUDE.nil?) || (IBM_DB_LIB.nil?) ) ||
154
- ( IBM_DB_INCLUDE == '' || IBM_DB_LIB == '' )
155
- )
156
- if(!DOWNLOADLINK.nil? && !DOWNLOADLINK.empty?)
157
- puts "Environment variable IBM_DB_HOME is not set. Downloading and setting up the DB2 client driver\n"
158
- destination = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/../lib"
159
-
160
- archive = downloadCLIPackage(destination)
161
- untarCLIPackage(archive,destination)
162
-
163
- IBM_DB_HOME="#{destination}/clidriver"
164
-
165
- IBM_DB_INCLUDE = "#{IBM_DB_HOME}/include"
166
- IBM_DB_LIB="#{IBM_DB_HOME}/lib"
167
- else
168
- 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 "
169
- exit 1
170
- end
171
- end
172
- else
173
- IBM_DB_INCLUDE = "#{IBM_DB_HOME}/include"
174
-
175
- if(is64Bit)
176
- IBM_DB_LIB="#{IBM_DB_HOME}/lib64"
177
- else
178
- IBM_DB_LIB="#{IBM_DB_HOME}/lib32"
179
- end
180
- end
181
-
182
- if( !(File.directory?(IBM_DB_LIB)) )
183
- suppress_warnings{IBM_DB_LIB = "#{IBM_DB_HOME}/lib"}
184
- if( !(File.directory?(IBM_DB_LIB)) )
185
- puts "Cannot find #{IBM_DB_LIB} directory. Check if you have set the IBM_DB_HOME environment variable's value correctly\n "
186
- exit 1
187
- end
188
- notifyString = "Detected usage of IBM Data Server Driver package. Ensure you have downloaded "
189
-
190
- if(is64Bit)
191
- notifyString = notifyString + "64-bit package "
192
- else
193
- notifyString = notifyString + "32-bit package "
194
- end
195
- notifyString = notifyString + "of IBM_Data_Server_Driver and retry the 'gem install ibm_db' command\n "
196
-
197
- puts notifyString
198
- end
199
-
200
- if( !(File.directory?(IBM_DB_INCLUDE)) )
201
- puts " #{IBM_DB_HOME}/include folder not found. Check if you have set the IBM_DB_HOME environment variable's value correctly\n "
202
- exit 1
203
- end
204
-
205
- require 'mkmf'
206
-
207
- dir_config('IBM_DB',IBM_DB_INCLUDE,IBM_DB_LIB)
208
-
209
- def crash(str)
210
- printf(" extconf failure: %s\n", str)
211
- exit 1
212
- end
213
-
214
- if( RUBY_VERSION =~ /1.9/ || RUBY_VERSION =~ /2./)
215
- create_header('gil_release_version')
216
- create_header('unicode_support_version')
217
- end
218
-
219
- unless (have_library(WIN ? 'db2cli' : 'db2','SQLConnect') or find_library(WIN ? 'db2cli' : 'db2','SQLConnect', IBM_DB_LIB))
220
- crash(<<EOL)
221
- Unable to locate libdb2.so/a under #{IBM_DB_LIB}
222
-
223
- Follow the steps below and retry
224
-
225
- Step 1: - Install IBM DB2 Universal Database Server/Client
226
-
227
- step 2: - Set the environment variable IBM_DB_HOME as below
228
-
229
- (assuming bash shell)
230
-
231
- export IBM_DB_HOME=<DB2/IBM_Data_Server_Driver installation directory> #(Eg: export IBM_DB_HOME=/opt/ibm/db2/v10)
232
-
233
- step 3: - Retry gem install
234
-
235
- EOL
236
- end
237
-
238
- if(RUBY_VERSION =~ /2./)
239
- require 'rbconfig'
240
- end
241
-
242
- alias :libpathflag0 :libpathflag
243
- def libpathflag(libpath)
244
- if(RUBY_VERSION =~ /2./)
245
- libpathflag0 + case RbConfig::CONFIG["arch"]
246
- when /solaris2/
247
- libpath[0..-2].map {|path| " -R#{path}"}.join
248
- when /linux/
249
- libpath[0..-2].map {|path| " -R#{path} "}.join
250
- else
251
- ""
252
- end
253
- else
254
- libpathflag0 + case Config::CONFIG["arch"]
255
- when /solaris2/
256
- libpath[0..-2].map {|path| " -R#{path}"}.join
257
- when /linux/
258
- libpath[0..-2].map {|path| " -R#{path} "}.join
259
- else
260
- ""
261
- end
262
- end
263
-
264
- end
265
-
266
- have_header('gil_release_version')
267
- have_header('unicode_support_version')
268
-
269
- create_makefile('ibm_db')
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
+ elsif (RUBY_PLATFORM =~ /darwin/i)
91
+ if(is64Bit)
92
+ puts "Detected platform - MacOS darwin64"
93
+ DOWNLOADLINK = "http://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/macos64_odbc_cli.tar.gz"
94
+ else
95
+ puts "Mac OS 32 bit not supported. Please use an x64 architecture."
96
+ end
97
+ end
98
+
99
+ def downloadCLIPackage(destination, link = nil)
100
+ if(link.nil?)
101
+ downloadLink = DOWNLOADLINK
102
+ else
103
+ downloadLink = link
104
+ end
105
+
106
+ uri = URI.parse(downloadLink)
107
+ filename = "#{destination}/clidriver.tar.gz"
108
+
109
+ headers = {
110
+ 'Accept-Encoding' => 'identity',
111
+ }
112
+
113
+ request = Net::HTTP::Get.new(uri.request_uri, headers)
114
+ http = Net::HTTP.new(uri.host, uri.port)
115
+ response = http.request(request)
116
+
117
+ f = open(filename, 'wb')
118
+ f.write(response.body)
119
+ f.close()
120
+
121
+ filename
122
+ end
123
+
124
+ def untarCLIPackage(archive,destination)
125
+ Gem::Package::TarReader.new( Zlib::GzipReader.open(archive) ) do |tar|
126
+ tar.each do |entry|
127
+ file = nil
128
+ if entry.full_name == $TAR_LONGLINK
129
+ file = File.join destination, entry.read.strip
130
+ next
131
+ end
132
+ file ||= File.join destination, entry.full_name
133
+ if entry.directory?
134
+ File.delete file if File.file? file
135
+ FileUtils.mkdir_p file, :mode => entry.header.mode, :verbose => false
136
+ elsif entry.file?
137
+ FileUtils.rm_rf file if File.directory? file
138
+ File.open file, "wb" do |f|
139
+ f.print entry.read
140
+ end
141
+ FileUtils.chmod entry.header.mode, file, :verbose => false
142
+ elsif entry.header.typeflag == '2' #Symlink!
143
+ File.symlink entry.header.linkname, file
144
+ end
145
+ end
146
+ end
147
+ end
148
+
149
+ if(IBM_DB_HOME == nil || IBM_DB_HOME == '')
150
+ IBM_DB_INCLUDE = ENV['IBM_DB_INCLUDE']
151
+ IBM_DB_LIB = ENV['IBM_DB_LIB']
152
+
153
+ if( ( (IBM_DB_INCLUDE.nil?) || (IBM_DB_LIB.nil?) ) ||
154
+ ( IBM_DB_INCLUDE == '' || IBM_DB_LIB == '' )
155
+ )
156
+ if(!DOWNLOADLINK.nil? && !DOWNLOADLINK.empty?)
157
+ puts "Environment variable IBM_DB_HOME is not set. Downloading and setting up the DB2 client driver\n"
158
+ destination = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/../lib"
159
+
160
+ archive = downloadCLIPackage(destination)
161
+ untarCLIPackage(archive,destination)
162
+
163
+ IBM_DB_HOME="#{destination}/clidriver"
164
+
165
+ IBM_DB_INCLUDE = "#{IBM_DB_HOME}/include"
166
+ IBM_DB_LIB="#{IBM_DB_HOME}/lib"
167
+ else
168
+ 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 "
169
+ exit 1
170
+ end
171
+ end
172
+ else
173
+ IBM_DB_INCLUDE = "#{IBM_DB_HOME}/include"
174
+
175
+ if(is64Bit)
176
+ IBM_DB_LIB="#{IBM_DB_HOME}/lib64"
177
+ else
178
+ IBM_DB_LIB="#{IBM_DB_HOME}/lib32"
179
+ end
180
+ end
181
+
182
+ if( !(File.directory?(IBM_DB_LIB)) )
183
+ suppress_warnings{IBM_DB_LIB = "#{IBM_DB_HOME}/lib"}
184
+ if( !(File.directory?(IBM_DB_LIB)) )
185
+ puts "Cannot find #{IBM_DB_LIB} directory. Check if you have set the IBM_DB_HOME environment variable's value correctly\n "
186
+ exit 1
187
+ end
188
+ notifyString = "Detected usage of IBM Data Server Driver package. Ensure you have downloaded "
189
+
190
+ if(is64Bit)
191
+ notifyString = notifyString + "64-bit package "
192
+ else
193
+ notifyString = notifyString + "32-bit package "
194
+ end
195
+ notifyString = notifyString + "of IBM_Data_Server_Driver and retry the 'gem install ibm_db' command\n "
196
+
197
+ puts notifyString
198
+ end
199
+
200
+ if( !(File.directory?(IBM_DB_INCLUDE)) )
201
+ puts " #{IBM_DB_HOME}/include folder not found. Check if you have set the IBM_DB_HOME environment variable's value correctly\n "
202
+ exit 1
203
+ end
204
+
205
+ require 'mkmf'
206
+
207
+ dir_config('IBM_DB',IBM_DB_INCLUDE,IBM_DB_LIB)
208
+
209
+ def crash(str)
210
+ printf(" extconf failure: %s\n", str)
211
+ exit 1
212
+ end
213
+
214
+ if( RUBY_VERSION =~ /1.9/ || RUBY_VERSION =~ /2./)
215
+ create_header('gil_release_version')
216
+ create_header('unicode_support_version')
217
+ end
218
+
219
+ unless (have_library(WIN ? 'db2cli' : 'db2','SQLConnect') or find_library(WIN ? 'db2cli' : 'db2','SQLConnect', IBM_DB_LIB))
220
+ crash(<<EOL)
221
+ Unable to locate libdb2.so/a under #{IBM_DB_LIB}
222
+
223
+ Follow the steps below and retry
224
+
225
+ Step 1: - Install IBM DB2 Universal Database Server/Client
226
+
227
+ step 2: - Set the environment variable IBM_DB_HOME as below
228
+
229
+ (assuming bash shell)
230
+
231
+ export IBM_DB_HOME=<DB2/IBM_Data_Server_Driver installation directory> #(Eg: export IBM_DB_HOME=/opt/ibm/db2/v10)
232
+
233
+ step 3: - Retry gem install
234
+
235
+ EOL
236
+ end
237
+
238
+ if(RUBY_VERSION =~ /2./)
239
+ require 'rbconfig'
240
+ end
241
+
242
+ alias :libpathflag0 :libpathflag
243
+ def libpathflag(libpath)
244
+ if(RUBY_VERSION =~ /2./)
245
+ libpathflag0 + case RbConfig::CONFIG["arch"]
246
+ when /solaris2/
247
+ libpath[0..-2].map {|path| " -R#{path}"}.join
248
+ when /linux/
249
+ libpath[0..-2].map {|path| " -R#{path} "}.join
250
+ else
251
+ ""
252
+ end
253
+ else
254
+ libpathflag0 + case Config::CONFIG["arch"]
255
+ when /solaris2/
256
+ libpath[0..-2].map {|path| " -R#{path}"}.join
257
+ when /linux/
258
+ libpath[0..-2].map {|path| " -R#{path} "}.join
259
+ else
260
+ ""
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ have_header('gil_release_version')
267
+ have_header('unicode_support_version')
268
+
269
+ create_makefile('ibm_db')
@@ -12,7 +12,7 @@
12
12
  +----------------------------------------------------------------------+
13
13
  */
14
14
 
15
- #define MODULE_RELEASE "2.6.0"
15
+ #define MODULE_RELEASE "2.6.1"
16
16
 
17
17
  #ifdef HAVE_CONFIG_H
18
18
  #include "config.h"
@@ -11,6 +11,7 @@
11
11
 
12
12
  require 'active_record/connection_adapters/abstract_adapter'
13
13
  require 'arel/visitors/bind_visitor'
14
+ require 'active_support/core_ext/string/strip'
14
15
 
15
16
  module ActiveRecord
16
17
  class Relation
@@ -755,9 +756,10 @@ module ActiveRecord
755
756
  end
756
757
 
757
758
  def supports_foreign_keys?
758
- false
759
+ true
759
760
  end
760
-
761
+
762
+
761
763
  # This Adapter supports DDL transactions.
762
764
  # This means CREATE TABLE and other DDL statements can be carried out as a transaction.
763
765
  # That is the statements executed can be ROLLED BACK in case of any error during the process.
@@ -1934,6 +1936,53 @@ module ActiveRecord
1934
1936
  # Returns the columns array
1935
1937
  return columns
1936
1938
  end
1939
+
1940
+ def foreign_keys(table_name)
1941
+ #fetch the foreign keys of the table using function foreign_keys
1942
+ #PKCOLUMN_NAME:: fk_row[3] Name of the column containing the primary key.
1943
+ #FKTABLE_NAME:: fk_row[6] Name of the table containing the foreign key.
1944
+ #FKCOLUMN_NAME:: fk_row[7] Name of the column containing the foreign key.
1945
+ #FK_NAME:: fk_row[11] The name of the foreign key.
1946
+
1947
+ stmt = IBM_DB.foreignkeys( @connection, nil,
1948
+ @servertype.set_case(@schema),
1949
+ @servertype.set_case(table_name))
1950
+ foreignKeys = []
1951
+
1952
+ if(stmt)
1953
+ begin
1954
+ while ( fk_row = IBM_DB.fetch_array(stmt) )
1955
+ options = {
1956
+ column: fk_row[3],
1957
+ name: fk_row[11],
1958
+ primary_key: fk_row[7],
1959
+ }
1960
+ foreignKeys << ForeignKeyDefinition.new(table_name, fk_row[6], options)
1961
+ end
1962
+
1963
+ rescue StandardError => fetch_error # Handle driver fetch errors
1964
+ error_msg = IBM_DB.getErrormsg(stmt, IBM_DB::DB_STMT )
1965
+ if error_msg && !error_msg.empty?
1966
+ raise "Failed to retrieve foreign key metadata during fetch: #{error_msg}"
1967
+ else
1968
+ error_msg = "An unexpected error occurred during retrieval of foreign key metadata"
1969
+ error_msg = error_msg + ": #{fetch_error.message}" if !fetch_error.message.empty?
1970
+ raise error_msg
1971
+ end
1972
+ ensure # Free resources associated with the statement
1973
+ IBM_DB.free_stmt(stmt) if stmt
1974
+ end
1975
+ else # Handle driver execution errors
1976
+ error_msg = IBM_DB.getErrormsg(@connection, IBM_DB::DB_CONN )
1977
+ if error_msg && !error_msg.empty?
1978
+ raise "Failed to retrieve foreign key metadata due to error: #{error_msg}"
1979
+ else
1980
+ raise StandardError.new('An unexpected error occurred during foreign key retrieval')
1981
+ end
1982
+ end
1983
+ #Returns the foreignKeys array
1984
+ return foreignKeys
1985
+ end
1937
1986
 
1938
1987
  # Renames a table.
1939
1988
  # ==== Example
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - IBM
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-28 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.15.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.15.1
27
27
  description:
@@ -34,50 +34,50 @@ extra_rdoc_files:
34
34
  - README
35
35
  - MANIFEST
36
36
  files:
37
- - CHANGES
38
- - LICENSE
39
- - MANIFEST
40
- - ParameterizedQueries README
41
37
  - README
42
- - ext/Makefile.nt32
43
- - ext/Makefile.nt32.191
44
- - ext/extconf.rb
45
- - ext/extconf_MacOS.rb
46
- - ext/ibm_db.c
47
- - ext/ruby_ibm_db.h
48
- - ext/ruby_ibm_db_cli.c
49
- - ext/ruby_ibm_db_cli.h
50
- - init.rb
51
- - lib/IBM_DB.rb
38
+ - lib/active_record/connection_adapters/ibmdb_adapter.rb
52
39
  - lib/active_record/connection_adapters/ibm_db_adapter.rb
53
40
  - lib/active_record/connection_adapters/ibm_db_pstmt.rb
54
- - lib/active_record/connection_adapters/ibmdb_adapter.rb
55
41
  - lib/active_record/vendor/db2-i5-zOS.yaml
56
- - test/cases/adapter_test.rb
57
- - test/cases/associations/belongs_to_associations_test.rb
58
- - test/cases/associations/cascaded_eager_loading_test.rb
59
- - test/cases/associations/has_and_belongs_to_many_associations_test.rb
60
- - test/cases/associations/join_model_test.rb
42
+ - lib/IBM_DB.rb
43
+ - test/connections/native_ibm_db/connection.rb
44
+ - test/models/warehouse_thing.rb
61
45
  - test/cases/attribute_methods_test.rb
62
- - test/cases/base_test.rb
63
- - test/cases/calculations_test.rb
64
- - test/cases/migration_test.rb
65
- - test/cases/persistence_test.rb
66
- - test/cases/query_cache_test.rb
67
46
  - test/cases/relations_test.rb
68
47
  - test/cases/schema_dumper_test.rb
69
48
  - test/cases/transaction_callbacks_test.rb
70
- - test/cases/validations/uniqueness_validation_test.rb
71
49
  - test/cases/xml_serialization_test.rb
50
+ - test/cases/validations/uniqueness_validation_test.rb
51
+ - test/cases/persistence_test.rb
52
+ - test/cases/calculations_test.rb
53
+ - test/cases/query_cache_test.rb
54
+ - test/cases/migration_test.rb
55
+ - test/cases/base_test.rb
56
+ - test/cases/associations/belongs_to_associations_test.rb
57
+ - test/cases/associations/has_and_belongs_to_many_associations_test.rb
58
+ - test/cases/associations/cascaded_eager_loading_test.rb
59
+ - test/cases/associations/join_model_test.rb
60
+ - test/cases/adapter_test.rb
72
61
  - test/config.yml
73
- - test/connections/native_ibm_db/connection.rb
74
- - test/ibm_db_test.rb
75
- - test/models/warehouse_thing.rb
76
- - test/schema/i5/ibm_db_specific_schema.rb
62
+ - test/schema/zOS/ibm_db_specific_schema.rb
77
63
  - test/schema/ids/ibm_db_specific_schema.rb
78
- - test/schema/luw/ibm_db_specific_schema.rb
64
+ - test/schema/i5/ibm_db_specific_schema.rb
79
65
  - test/schema/schema.rb
80
- - test/schema/zOS/ibm_db_specific_schema.rb
66
+ - test/schema/luw/ibm_db_specific_schema.rb
67
+ - test/ibm_db_test.rb
68
+ - ParameterizedQueries README
69
+ - ext/ruby_ibm_db.h
70
+ - ext/Makefile.nt32
71
+ - ext/ruby_ibm_db_cli.c
72
+ - ext/ruby_ibm_db_cli.h
73
+ - ext/extconf.rb
74
+ - ext/extconf_MacOS.rb
75
+ - ext/ibm_db.c
76
+ - ext/Makefile.nt32.191
77
+ - LICENSE
78
+ - init.rb
79
+ - CHANGES
80
+ - MANIFEST
81
81
  homepage: https://github.com/ibmdb/ruby-ibmdb
82
82
  licenses: []
83
83
  metadata: {}
@@ -92,18 +92,18 @@ require_paths:
92
92
  - lib
93
93
  required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: 2.0.0
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements:
104
104
  - ActiveRecord, at least 1.15.1
105
105
  rubyforge_project: rubyibm
106
- rubygems_version: 2.4.5
106
+ rubygems_version: 2.0.14
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows,