activerecord-jdbc-adapter 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile +2 -1
- data/Gemfile.lock +5 -6
- data/History.txt +11 -0
- data/gemfiles/rails23.gemfile +2 -1
- data/gemfiles/rails23.gemfile.lock +5 -2
- data/gemfiles/rails30.gemfile +2 -1
- data/gemfiles/rails30.gemfile.lock +5 -2
- data/gemfiles/rails31.gemfile +2 -1
- data/gemfiles/rails31.gemfile.lock +5 -2
- data/gemfiles/rails32.gemfile +2 -1
- data/gemfiles/rails32.gemfile.lock +5 -2
- data/lib/arel/engines/sql/compilers/mssql_compiler.rb +1 -1
- data/lib/arel/visitors/sql_server.rb +4 -4
- data/lib/arjdbc/db2/adapter.rb +14 -3
- data/lib/arjdbc/discover.rb +1 -1
- data/lib/arjdbc/jdbc/adapter.rb +1 -0
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/connection.rb +73 -63
- data/lib/arjdbc/jdbc/extension.rb +1 -1
- data/lib/arjdbc/mssql.rb +3 -0
- data/lib/arjdbc/mssql/adapter.rb +132 -115
- data/lib/arjdbc/mssql/connection_methods.rb +1 -1
- data/lib/arjdbc/mssql/limit_helpers.rb +62 -66
- data/lib/arjdbc/mssql/lock_helpers.rb +2 -2
- data/lib/arjdbc/mssql/tsql_methods.rb +58 -0
- data/lib/arjdbc/mssql/utils.rb +53 -0
- data/lib/arjdbc/oracle/adapter.rb +61 -39
- data/lib/arjdbc/sqlite3/adapter.rb +3 -6
- data/lib/arjdbc/version.rb +1 -1
- data/src/java/arjdbc/jdbc/AdapterJavaService.java +4 -2
- data/src/java/arjdbc/mssql/MSSQLModule.java +70 -0
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +128 -0
- data/src/java/arjdbc/mssql/MssqlRubyJdbcConnection.java +25 -112
- data/test/db/mssql.rb +8 -8
- data/test/db2_simple_test.rb +7 -0
- data/test/models/entry.rb +2 -1
- data/test/mssql_binary_test.rb +6 -0
- data/test/mssql_db_create_test.rb +5 -2
- data/test/mssql_identity_insert_test.rb +1 -2
- data/test/mssql_ignore_system_views_test.rb +5 -5
- data/test/mssql_limit_offset_test.rb +51 -55
- data/test/mssql_multibyte_test.rb +1 -2
- data/test/mssql_row_locking_test.rb +1 -1
- data/test/mssql_simple_test.rb +6 -10
- data/test/{mssql_row_locking_sql_test.rb → mssql_test.rb} +110 -18
- data/test/mysql_db_create_test.rb +13 -7
- data/test/oracle_simple_test.rb +18 -0
- data/test/postgres_db_create_test.rb +26 -13
- data/test/simple.rb +45 -15
- data/test/sqlite3_schema_dump_test.rb +6 -0
- data/test/sqlite3_type_conversion_test.rb +20 -17
- data/test/test_helper.rb +44 -2
- metadata +9 -4
- data/lib/arjdbc/mssql/tsql_helper.rb +0 -53
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -11,7 +11,8 @@ gem 'appraisal'
|
|
11
11
|
gem 'rake', :require => nil
|
12
12
|
# appraisal ignores group block declarations :
|
13
13
|
gem 'test-unit', :group => :test
|
14
|
-
gem '
|
14
|
+
gem 'test-unit-context', :group => :test
|
15
|
+
gem 'mocha', '~> 0.12.1', :require => nil, :group => :test # '>= 0.13.0'
|
15
16
|
gem 'simplecov', :require => nil, :group => :test
|
16
17
|
gem 'bcrypt-ruby', '~> 3.0.0', :require => nil, :group => :test
|
17
18
|
|
data/Gemfile.lock
CHANGED
@@ -26,7 +26,6 @@ GEM
|
|
26
26
|
bundler
|
27
27
|
rake
|
28
28
|
arel (3.0.2)
|
29
|
-
bcrypt-ruby (3.0.1)
|
30
29
|
bcrypt-ruby (3.0.1-java)
|
31
30
|
bouncy-castle-java (1.5.0146.1)
|
32
31
|
builder (3.0.4)
|
@@ -37,9 +36,8 @@ GEM
|
|
37
36
|
journey (1.0.4)
|
38
37
|
jruby-openssl (0.8.2)
|
39
38
|
bouncy-castle-java (>= 1.5.0146.1)
|
40
|
-
linecache (0.46-java)
|
41
39
|
metaclass (0.0.1)
|
42
|
-
mocha (0.
|
40
|
+
mocha (0.12.10)
|
43
41
|
metaclass (~> 0.0.1)
|
44
42
|
multi_json (1.5.0)
|
45
43
|
rack (1.4.4)
|
@@ -51,8 +49,6 @@ GEM
|
|
51
49
|
ruby-debug (0.10.4)
|
52
50
|
columnize (>= 0.1)
|
53
51
|
ruby-debug-base (~> 0.10.4.0)
|
54
|
-
ruby-debug-base (0.10.4)
|
55
|
-
linecache (>= 0.3)
|
56
52
|
ruby-debug-base (0.10.4-java)
|
57
53
|
simplecov (0.7.1)
|
58
54
|
multi_json (~> 1.0)
|
@@ -64,6 +60,8 @@ GEM
|
|
64
60
|
rack (~> 1.0)
|
65
61
|
tilt (~> 1.1, != 1.3.0)
|
66
62
|
test-unit (2.5.4)
|
63
|
+
test-unit-context (0.3.0)
|
64
|
+
test-unit (>= 2.4.0)
|
67
65
|
tilt (1.3.3)
|
68
66
|
tzinfo (0.3.35)
|
69
67
|
|
@@ -77,8 +75,9 @@ DEPENDENCIES
|
|
77
75
|
bcrypt-ruby (~> 3.0.0)
|
78
76
|
erubis
|
79
77
|
jruby-openssl
|
80
|
-
mocha
|
78
|
+
mocha (~> 0.12.1)
|
81
79
|
rake
|
82
80
|
ruby-debug
|
83
81
|
simplecov
|
84
82
|
test-unit
|
83
|
+
test-unit-context
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
== 1.2.9 (03/20/13)
|
2
|
+
|
3
|
+
- [oracle] native database types ala oracle-enhanced adapter
|
4
|
+
- [oracle] fix #insert (broken since execute+to_sql refactoring) keeping binds
|
5
|
+
respect 30 max identifier length with default sequence names
|
6
|
+
- [db2] add as400 primary key support and re-add explain method
|
7
|
+
- [mssql] fix table/column name quoting - do not quote if quoted already
|
8
|
+
- [mssql] change default constrain sql on 2005+ (closes #320)
|
9
|
+
- [mssql] fix substring issue that prevents detecting a query that contains *
|
10
|
+
- [mssql] adapter code cleanup + refactored (ArJdbc::) MsSQL -> MSSQL
|
11
|
+
|
1
12
|
== 1.2.8 (03/13/13)
|
2
13
|
|
3
14
|
- [derby] (native) types review & cleanup, externalize AR patch-ing
|
data/gemfiles/rails23.gemfile
CHANGED
@@ -6,7 +6,8 @@ gem "jruby-openssl", :platform=>:jruby
|
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
8
|
gem "test-unit", :group=>:test
|
9
|
-
gem "
|
9
|
+
gem "test-unit-context", :group=>:test
|
10
|
+
gem "mocha", "~> 0.12.1", :require=>nil, :group=>:test
|
10
11
|
gem "simplecov", :require=>nil, :group=>:test
|
11
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
12
13
|
gem "activerecord", "~> 2.3.16"
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
jruby-openssl (0.7.7)
|
20
20
|
bouncy-castle-java (>= 1.5.0146.1)
|
21
21
|
metaclass (0.0.1)
|
22
|
-
mocha (0.
|
22
|
+
mocha (0.12.8)
|
23
23
|
metaclass (~> 0.0.1)
|
24
24
|
multi_json (1.5.0)
|
25
25
|
rack (1.1.5)
|
@@ -36,6 +36,8 @@ GEM
|
|
36
36
|
simplecov-html (~> 0.7.1)
|
37
37
|
simplecov-html (0.7.1)
|
38
38
|
test-unit (2.5.3)
|
39
|
+
test-unit-context (0.3.0)
|
40
|
+
test-unit (>= 2.4.0)
|
39
41
|
|
40
42
|
PLATFORMS
|
41
43
|
java
|
@@ -45,8 +47,9 @@ DEPENDENCIES
|
|
45
47
|
appraisal
|
46
48
|
bcrypt-ruby (~> 3.0.0)
|
47
49
|
jruby-openssl
|
48
|
-
mocha
|
50
|
+
mocha (~> 0.12.1)
|
49
51
|
rails (~> 2.3.16)
|
50
52
|
rake
|
51
53
|
simplecov
|
52
54
|
test-unit
|
55
|
+
test-unit-context
|
data/gemfiles/rails30.gemfile
CHANGED
@@ -6,7 +6,8 @@ gem "jruby-openssl", :platform=>:jruby
|
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
8
|
gem "test-unit", :group=>:test
|
9
|
-
gem "
|
9
|
+
gem "test-unit-context", :group=>:test
|
10
|
+
gem "mocha", "~> 0.12.1", :require=>nil, :group=>:test
|
10
11
|
gem "simplecov", :require=>nil, :group=>:test
|
11
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
12
13
|
gem "activerecord", "~> 3.0.20"
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
jruby-openssl (0.7.7)
|
23
23
|
bouncy-castle-java (>= 1.5.0146.1)
|
24
24
|
metaclass (0.0.1)
|
25
|
-
mocha (0.
|
25
|
+
mocha (0.12.8)
|
26
26
|
metaclass (~> 0.0.1)
|
27
27
|
multi_json (1.5.0)
|
28
28
|
rake (10.0.3)
|
@@ -31,6 +31,8 @@ GEM
|
|
31
31
|
simplecov-html (~> 0.7.1)
|
32
32
|
simplecov-html (0.7.1)
|
33
33
|
test-unit (2.5.3)
|
34
|
+
test-unit-context (0.3.0)
|
35
|
+
test-unit (>= 2.4.0)
|
34
36
|
tzinfo (0.3.35)
|
35
37
|
|
36
38
|
PLATFORMS
|
@@ -41,7 +43,8 @@ DEPENDENCIES
|
|
41
43
|
appraisal
|
42
44
|
bcrypt-ruby (~> 3.0.0)
|
43
45
|
jruby-openssl
|
44
|
-
mocha
|
46
|
+
mocha (~> 0.12.1)
|
45
47
|
rake
|
46
48
|
simplecov
|
47
49
|
test-unit
|
50
|
+
test-unit-context
|
data/gemfiles/rails31.gemfile
CHANGED
@@ -6,7 +6,8 @@ gem "jruby-openssl", :platform=>:jruby
|
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
8
|
gem "test-unit", :group=>:test
|
9
|
-
gem "
|
9
|
+
gem "test-unit-context", :group=>:test
|
10
|
+
gem "mocha", "~> 0.12.1", :require=>nil, :group=>:test
|
10
11
|
gem "simplecov", :require=>nil, :group=>:test
|
11
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
12
13
|
gem "activerecord", "~> 3.1.10"
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
jruby-openssl (0.7.7)
|
24
24
|
bouncy-castle-java (>= 1.5.0146.1)
|
25
25
|
metaclass (0.0.1)
|
26
|
-
mocha (0.
|
26
|
+
mocha (0.12.8)
|
27
27
|
metaclass (~> 0.0.1)
|
28
28
|
multi_json (1.2.0)
|
29
29
|
rake (10.0.3)
|
@@ -32,6 +32,8 @@ GEM
|
|
32
32
|
simplecov-html (~> 0.7.1)
|
33
33
|
simplecov-html (0.7.1)
|
34
34
|
test-unit (2.5.3)
|
35
|
+
test-unit-context (0.3.0)
|
36
|
+
test-unit (>= 2.4.0)
|
35
37
|
tzinfo (0.3.35)
|
36
38
|
|
37
39
|
PLATFORMS
|
@@ -42,7 +44,8 @@ DEPENDENCIES
|
|
42
44
|
appraisal
|
43
45
|
bcrypt-ruby (~> 3.0.0)
|
44
46
|
jruby-openssl
|
45
|
-
mocha
|
47
|
+
mocha (~> 0.12.1)
|
46
48
|
rake
|
47
49
|
simplecov
|
48
50
|
test-unit
|
51
|
+
test-unit-context
|
data/gemfiles/rails32.gemfile
CHANGED
@@ -6,7 +6,8 @@ gem "jruby-openssl", :platform=>:jruby
|
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
8
|
gem "test-unit", :group=>:test
|
9
|
-
gem "
|
9
|
+
gem "test-unit-context", :group=>:test
|
10
|
+
gem "mocha", "~> 0.12.1", :require=>nil, :group=>:test
|
10
11
|
gem "simplecov", :require=>nil, :group=>:test
|
11
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
12
13
|
gem "activerecord", "~> 3.2.11"
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
jruby-openssl (0.7.7)
|
24
24
|
bouncy-castle-java (>= 1.5.0146.1)
|
25
25
|
metaclass (0.0.1)
|
26
|
-
mocha (0.
|
26
|
+
mocha (0.12.8)
|
27
27
|
metaclass (~> 0.0.1)
|
28
28
|
multi_json (1.5.0)
|
29
29
|
rake (10.0.3)
|
@@ -32,6 +32,8 @@ GEM
|
|
32
32
|
simplecov-html (~> 0.7.1)
|
33
33
|
simplecov-html (0.7.1)
|
34
34
|
test-unit (2.5.3)
|
35
|
+
test-unit-context (0.3.0)
|
36
|
+
test-unit (>= 2.4.0)
|
35
37
|
tzinfo (0.3.35)
|
36
38
|
|
37
39
|
PLATFORMS
|
@@ -42,7 +44,8 @@ DEPENDENCIES
|
|
42
44
|
appraisal
|
43
45
|
bcrypt-ruby (~> 3.0.0)
|
44
46
|
jruby-openssl
|
45
|
-
mocha
|
47
|
+
mocha (~> 0.12.1)
|
46
48
|
rake
|
47
49
|
simplecov
|
48
50
|
test-unit
|
51
|
+
test-unit-context
|
@@ -2,9 +2,9 @@ require 'arel/visitors/compat'
|
|
2
2
|
|
3
3
|
module Arel
|
4
4
|
module Visitors
|
5
|
-
class SQLServer <
|
6
|
-
include ArJdbc::
|
7
|
-
include ArJdbc::
|
5
|
+
class SQLServer < ToSql
|
6
|
+
include ArJdbc::MSSQL::LimitHelpers::SqlServerReplaceLimitOffset
|
7
|
+
include ArJdbc::MSSQL::LockHelpers::SqlServerAddLock
|
8
8
|
|
9
9
|
def select_count? o
|
10
10
|
sel = o.cores.length == 1 && o.cores.first
|
@@ -50,7 +50,7 @@ module Arel
|
|
50
50
|
end
|
51
51
|
|
52
52
|
class SQLServer2000 < SQLServer
|
53
|
-
include ArJdbc::
|
53
|
+
include ArJdbc::MSSQL::LimitHelpers::SqlServer2000ReplaceLimitOffset
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/arjdbc/db2/adapter.rb
CHANGED
@@ -14,6 +14,10 @@ module ArJdbc
|
|
14
14
|
def self.lob_callback_added! # :nodoc
|
15
15
|
@@_lob_callback_added = true
|
16
16
|
end
|
17
|
+
|
18
|
+
def explain(query, *binds)
|
19
|
+
# TODO: Explain this! Do not remove !
|
20
|
+
end
|
17
21
|
|
18
22
|
def self.extended(base)
|
19
23
|
if ADD_LOB_CALLBACK && ! lob_callback_added?
|
@@ -173,9 +177,16 @@ module ArJdbc
|
|
173
177
|
def prefetch_primary_key?(table_name = nil)
|
174
178
|
# TRUE if the table has no identity column
|
175
179
|
names = table_name.upcase.split(".")
|
176
|
-
sql = "
|
177
|
-
|
178
|
-
|
180
|
+
sql = ""
|
181
|
+
if as400?
|
182
|
+
sql = "SELECT 1 FROM SYSIBM.SQLPRIMARYKEYS WHERE "
|
183
|
+
sql += "TABLE_SCHEM = '#{names.first}' AND " if names.size == 2
|
184
|
+
sql += "TABLE_NAME = '#{names.last}'"
|
185
|
+
else
|
186
|
+
sql = "SELECT 1 FROM SYSCAT.COLUMNS WHERE IDENTITY = 'Y' "
|
187
|
+
sql += "AND TABSCHEMA = '#{names.first}' " if names.size == 2
|
188
|
+
sql += "AND TABNAME = '#{names.last}'"
|
189
|
+
end
|
179
190
|
select_one(sql).nil?
|
180
191
|
end
|
181
192
|
|
data/lib/arjdbc/discover.rb
CHANGED
data/lib/arjdbc/jdbc/adapter.rb
CHANGED
Binary file
|
@@ -1,18 +1,85 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
module ConnectionAdapters
|
3
3
|
class JdbcConnection
|
4
|
+
|
5
|
+
attr_reader :adapter, :connection_factory
|
6
|
+
|
7
|
+
# @native_database_types - setup properly by adapter= versus set_native_database_types.
|
8
|
+
# This contains type information for the adapter. Individual adapters can make tweaks
|
9
|
+
# by defined modify_types
|
10
|
+
#
|
11
|
+
# @native_types - This is the default type settings sans any modifications by the
|
12
|
+
# individual adapter. My guess is that if we loaded two adapters of different types
|
13
|
+
# then this is used as a base to be tweaked by each adapter to create @native_database_types
|
14
|
+
|
15
|
+
def initialize(config)
|
16
|
+
self.config = config
|
17
|
+
@connection = nil
|
18
|
+
@jndi_connection = false
|
19
|
+
configure_connection # ConfigHelper#configure_connection
|
20
|
+
connection # force the connection to load (@see RubyJDbcConnection.connection)
|
21
|
+
set_native_database_types
|
22
|
+
@stmts = {} # AR compatibility - statement cache not used
|
23
|
+
rescue ::ActiveRecord::ActiveRecordError
|
24
|
+
raise
|
25
|
+
rescue Java::JavaSql::SQLException => e
|
26
|
+
e = e.cause if defined?(NativeException) && e.is_a?(NativeException) # JRuby-1.6.8
|
27
|
+
error = e.getMessage || e.getSQLState
|
28
|
+
error = error ? "#{e.java_class.name}: #{error}" : e.java_class.name
|
29
|
+
error = ::ActiveRecord::JDBCError.new("The driver encountered an unknown error: #{error}")
|
30
|
+
error.errno = e.getErrorCode
|
31
|
+
error.sql_exception = e
|
32
|
+
raise error
|
33
|
+
end
|
34
|
+
|
35
|
+
def jndi_connection?
|
36
|
+
@jndi_connection == true
|
37
|
+
end
|
38
|
+
|
39
|
+
def active?
|
40
|
+
!! @connection
|
41
|
+
end
|
42
|
+
|
43
|
+
def adapter=(adapter)
|
44
|
+
@adapter = adapter
|
45
|
+
@native_database_types = dup_native_types
|
46
|
+
@adapter.modify_types(@native_database_types)
|
47
|
+
@adapter.config.replace(config)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# Duplicate all native types into new hash structure so it can be modified
|
53
|
+
# without destroying original structure.
|
54
|
+
def dup_native_types
|
55
|
+
types = {}
|
56
|
+
@native_types.each_pair do |k, v|
|
57
|
+
types[k] = v.inject({}) do |memo, kv|
|
58
|
+
last = kv.last
|
59
|
+
memo[kv.first] = last.is_a?(Numeric) ? last : (last.dup rescue last)
|
60
|
+
memo
|
61
|
+
end
|
62
|
+
end
|
63
|
+
types
|
64
|
+
end
|
65
|
+
|
4
66
|
module ConfigHelper
|
67
|
+
|
5
68
|
attr_reader :config
|
6
69
|
|
7
70
|
def config=(config)
|
8
71
|
@config = config.symbolize_keys
|
9
72
|
end
|
10
73
|
|
74
|
+
# Configure this connection from the available configuration.
|
75
|
+
# @see #configure_jdbc
|
76
|
+
# @see #configure_jndi
|
77
|
+
#
|
78
|
+
# @note this has nothing to do with the configure_connection implemented
|
79
|
+
# on some of the concrete adapters (e.g. {#ArJdbc::Postgres})
|
11
80
|
def configure_connection
|
12
81
|
config[:retry_count] ||= 5
|
13
82
|
config[:connection_alive_sql] ||= "select 1"
|
14
|
-
@jndi_connection = false
|
15
|
-
@connection = nil
|
16
83
|
if config[:jndi]
|
17
84
|
begin
|
18
85
|
configure_jndi
|
@@ -50,6 +117,7 @@ module ActiveRecord
|
|
50
117
|
end
|
51
118
|
|
52
119
|
private
|
120
|
+
|
53
121
|
def configure_url
|
54
122
|
url = config[:url].to_s
|
55
123
|
if Hash === config[:options]
|
@@ -65,68 +133,10 @@ module ActiveRecord
|
|
65
133
|
url
|
66
134
|
end
|
67
135
|
|
68
|
-
end
|
69
|
-
|
70
|
-
attr_reader :adapter, :connection_factory
|
71
|
-
|
72
|
-
# @native_database_types - setup properly by adapter= versus set_native_database_types.
|
73
|
-
# This contains type information for the adapter. Individual adapters can make tweaks
|
74
|
-
# by defined modify_types
|
75
|
-
#
|
76
|
-
# @native_types - This is the default type settings sans any modifications by the
|
77
|
-
# individual adapter. My guess is that if we loaded two adapters of different types
|
78
|
-
# then this is used as a base to be tweaked by each adapter to create @native_database_types
|
79
|
-
|
80
|
-
def initialize(config)
|
81
|
-
self.config = config
|
82
|
-
configure_connection
|
83
|
-
connection # force the connection to load
|
84
|
-
set_native_database_types
|
85
|
-
@stmts = {}
|
86
|
-
rescue ::ActiveRecord::ActiveRecordError
|
87
|
-
raise
|
88
|
-
rescue Java::JavaSql::SQLException => e
|
89
|
-
e = e.cause if defined?(NativeException) && e.is_a?(NativeException) # JRuby-1.6.8
|
90
|
-
error = e.getMessage || e.getSQLState
|
91
|
-
error = error ? "#{e.java_class.name}: #{error}" : e.java_class.name
|
92
|
-
error = ::ActiveRecord::JDBCError.new("The driver encountered an unknown error: #{error}")
|
93
|
-
error.errno = e.getErrorCode
|
94
|
-
error.sql_exception = e
|
95
|
-
raise error
|
96
|
-
end
|
97
|
-
|
98
|
-
def adapter=(adapter)
|
99
|
-
@adapter = adapter
|
100
|
-
@native_database_types = dup_native_types
|
101
|
-
@adapter.modify_types(@native_database_types)
|
102
|
-
@adapter.config.replace(config)
|
103
|
-
end
|
104
|
-
|
105
|
-
# Duplicate all native types into new hash structure so it can be modified
|
106
|
-
# without destroying original structure.
|
107
|
-
def dup_native_types
|
108
|
-
types = {}
|
109
|
-
@native_types.each_pair do |k, v|
|
110
|
-
types[k] = v.inject({}) do |memo, kv|
|
111
|
-
last = kv.last
|
112
|
-
memo[kv.first] = last.is_a?(Numeric) ? last : (last.dup rescue last)
|
113
|
-
memo
|
114
|
-
end
|
115
|
-
end
|
116
|
-
types
|
117
|
-
end
|
118
|
-
private :dup_native_types
|
119
|
-
|
120
|
-
def jndi_connection?
|
121
|
-
@jndi_connection == true
|
122
|
-
end
|
123
|
-
|
124
|
-
def active?
|
125
|
-
@connection
|
126
|
-
end
|
127
|
-
|
128
|
-
private
|
136
|
+
end # ConfigHelper
|
137
|
+
|
129
138
|
include ConfigHelper
|
139
|
+
|
130
140
|
end
|
131
141
|
end
|
132
142
|
end
|