ibm_db 2.6.0-x86-mingw32 → 2.6.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +3 -0
- data/README +1 -1
- data/ext/extconf_MacOS.rb +269 -269
- data/ext/ibm_db.c +1 -1
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +51 -2
- data/lib/mswin32/rb19x/ibm_db.so +0 -0
- data/lib/mswin32/rb21x/i386/ibm_db.so +0 -0
- data/lib/mswin32/rb22x/i386/ibm_db.so +0 -0
- data/lib/mswin32/rb2x/i386/ibm_db.so +0 -0
- metadata +32 -24
- checksums.yaml +0 -7
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.
|
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
|
|
data/ext/extconf_MacOS.rb
CHANGED
@@ -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')
|
data/ext/ibm_db.c
CHANGED
@@ -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
|
-
|
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
|
data/lib/mswin32/rb19x/ibm_db.so
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,43 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.1
|
5
|
+
prerelease:
|
5
6
|
platform: x86-mingw32
|
6
7
|
authors:
|
7
8
|
- IBM
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-
|
12
|
+
date: 2015-07-14 00:00:00.000000000Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activerecord
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &26638332 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 1.15.1
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
|
-
version_requirements:
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.15.1
|
24
|
+
version_requirements: *26638332
|
27
25
|
- !ruby/object:Gem::Dependency
|
28
26
|
name: archive-zip
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &26520756 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
30
29
|
requirements:
|
31
|
-
- - '>='
|
30
|
+
- - ! '>='
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: 0.7.0
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.7.0
|
35
|
+
version_requirements: *26520756
|
41
36
|
description:
|
42
37
|
email: opendev@us.ibm.com
|
43
38
|
executables: []
|
@@ -98,33 +93,46 @@ files:
|
|
98
93
|
- test/schema/zOS/ibm_db_specific_schema.rb
|
99
94
|
homepage: https://github.com/ibmdb/ruby-ibmdb
|
100
95
|
licenses: []
|
101
|
-
|
102
|
-
post_install_message: |2+
|
96
|
+
post_install_message: ! '
|
103
97
|
|
104
98
|
*****************************************************************************
|
105
|
-
|
99
|
+
|
100
|
+
Successfully installed ibm_db, the Ruby gem for IBM DB2/Informix. The Ruby gem
|
101
|
+
is licensed under the MIT License. The package also includes IBM ODBC and CLI
|
102
|
+
Driver from IBM, which could have been automatically downloaded as the Ruby gem
|
103
|
+
is installed on your system/device. The license agreement to the IBM driver is
|
104
|
+
available in the folder "$GEM_HOME/ibm_db-*/lib/clidriver/license". Check for additional
|
105
|
+
dependencies, which may come with their own license agreement(s). Your use of the
|
106
|
+
components of the package and dependencies constitutes your acceptance of their
|
107
|
+
respective license agreements. If you do not accept the terms of any license agreement(s),
|
108
|
+
then delete the relevant component(s) from your system/device.
|
109
|
+
|
106
110
|
*****************************************************************************
|
107
111
|
|
112
|
+
|
113
|
+
'
|
108
114
|
rdoc_options: []
|
109
115
|
require_paths:
|
110
116
|
- lib
|
111
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
112
119
|
requirements:
|
113
|
-
- - '>='
|
120
|
+
- - ! '>='
|
114
121
|
- !ruby/object:Gem::Version
|
115
122
|
version: 2.0.0
|
116
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
117
125
|
requirements:
|
118
|
-
- - '>='
|
126
|
+
- - ! '>='
|
119
127
|
- !ruby/object:Gem::Version
|
120
128
|
version: '0'
|
121
129
|
requirements:
|
122
130
|
- ActiveRecord, at least 1.15.1
|
123
131
|
rubyforge_project: rubyibm
|
124
|
-
rubygems_version:
|
132
|
+
rubygems_version: 1.7.2
|
125
133
|
signing_key:
|
126
|
-
specification_version:
|
127
|
-
summary: 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows,
|
134
|
+
specification_version: 3
|
135
|
+
summary: ! 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows,
|
128
136
|
DB2 on zOS, DB2 on i5/OS, Informix (IDS)}'
|
129
137
|
test_files:
|
130
138
|
- test/ibm_db_test.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 591fa0a8fb59d54e5ed09e299b2261c0150deee7
|
4
|
-
data.tar.gz: 76f5cb234abfa05cae09a372c9a5b9eb93ced9d6
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 8491808d745d528cdd39b55340123c4c324d1e05b6855d2f172763c85557fab2508bc997dd2708a3a64060622c96fe08ff915a7a63b89b715e20dee6df54ba38
|
7
|
-
data.tar.gz: f698edb399ebbf05dd823dbe1c1482945e7c9dd6eea606ad5e31bc3948d67e62b4349f9dda898b4d9563ff0fa05b6acff0f3595f7617ab7539c482383ed99e77
|