activerecord-jdbc-adapter 1.3.25 → 5.0.pre1
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 +4 -4
- data/.travis.yml +57 -72
- data/Appraisals +7 -2
- data/Gemfile +3 -7
- data/History.md +0 -50
- data/RUNNING_TESTS.md +4 -0
- data/activerecord-jdbc-adapter.gemspec +2 -1
- data/lib/arjdbc/common_jdbc_methods.rb +89 -0
- data/lib/arjdbc/db2/adapter.rb +58 -69
- data/lib/arjdbc/db2/as400.rb +2 -13
- data/lib/arjdbc/db2/column.rb +1 -1
- data/lib/arjdbc/derby/adapter.rb +2 -6
- data/lib/arjdbc/firebird/adapter.rb +7 -16
- data/lib/arjdbc/h2/adapter.rb +4 -13
- data/lib/arjdbc/hsqldb/adapter.rb +5 -5
- data/lib/arjdbc/jdbc/adapter.rb +15 -76
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/adapter_require.rb +12 -31
- data/lib/arjdbc/jdbc/base_ext.rb +6 -25
- data/lib/arjdbc/jdbc/column.rb +15 -1
- data/lib/arjdbc/jdbc/connection_methods.rb +7 -1
- data/lib/arjdbc/jdbc/type_cast.rb +16 -4
- data/lib/arjdbc/jdbc/type_converter.rb +0 -1
- data/lib/arjdbc/mssql/adapter.rb +9 -21
- data/lib/arjdbc/mysql/adapter.rb +14 -19
- data/lib/arjdbc/mysql/connection_methods.rb +3 -5
- data/lib/arjdbc/oracle/adapter.rb +4 -38
- data/lib/arjdbc/oracle/connection_methods.rb +0 -4
- data/lib/arjdbc/postgresql/adapter.rb +18 -22
- data/lib/arjdbc/postgresql/connection_methods.rb +2 -5
- data/lib/arjdbc/postgresql/oid/bytea.rb +0 -1
- data/lib/arjdbc/postgresql/oid_types.rb +6 -6
- data/lib/arjdbc/sqlite3/adapter.rb +493 -404
- data/lib/arjdbc/tasks/database_tasks.rb +1 -1
- data/lib/arjdbc/tasks/databases3.rake +1 -1
- data/lib/arjdbc/tasks/databases4.rake +3 -8
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/db.rake +5 -8
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +102 -37
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +0 -7
- metadata +10 -17
- data/lib/arjdbc/jdbc/arel_support.rb +0 -133
- data/lib/arjdbc/mssql/attributes_for_update.rb +0 -22
- data/lib/arjdbc/sqlite3/explain_support.rb +0 -29
data/lib/arjdbc/db2/as400.rb
CHANGED
@@ -13,9 +13,6 @@ module ArJdbc
|
|
13
13
|
# @see ActiveRecord::ConnectionAdapters::JdbcAdapter#jdbc_connection_class
|
14
14
|
def self.jdbc_connection_class; DB2.jdbc_connection_class; end
|
15
15
|
|
16
|
-
# @see ActiveRecord::ConnectionAdapters::Jdbc::ArelSupport
|
17
|
-
def self.arel_visitor_type(config = nil); DB2.arel_visitor_type(config); end
|
18
|
-
|
19
16
|
def self.column_selector
|
20
17
|
[ /as400/i, lambda { |config, column| column.extend(Column) } ]
|
21
18
|
end
|
@@ -60,11 +57,8 @@ module ArJdbc
|
|
60
57
|
@connection.execute_update "call qsys.qcmdexc('QSYS/CHGJOB INQMSGRPY(*SYSRPYL)',0000000031.00000)"
|
61
58
|
@connection.execute_update "call qsys.qcmdexc('ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY(''I'')',0000000045.00000)"
|
62
59
|
rescue Exception => e
|
63
|
-
|
64
|
-
|
65
|
-
raise "Could not call CHGJOB INQMSGRPY(*SYSRPYL) and ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY('I').\n" +
|
66
|
-
"Do you have authority to do this?\n\n#{e.inspect}"
|
67
|
-
end
|
60
|
+
raise "Could not call CHGJOB INQMSGRPY(*SYSRPYL) and ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY('I').\n" +
|
61
|
+
"Do you have authority to do this?\n\n#{e.inspect}"
|
68
62
|
end
|
69
63
|
|
70
64
|
begin
|
@@ -103,11 +97,6 @@ module ArJdbc
|
|
103
97
|
true
|
104
98
|
end
|
105
99
|
|
106
|
-
# AS400 does not support TRUNCATE command. Deleting everything from the table is should be close enough
|
107
|
-
def truncate(table_name, name = nil)
|
108
|
-
@connection.execute_update "DELETE FROM #{table_name}"
|
109
|
-
end
|
110
|
-
|
111
100
|
private
|
112
101
|
|
113
102
|
# @override
|
data/lib/arjdbc/db2/column.rb
CHANGED
@@ -47,7 +47,7 @@ module ArJdbc
|
|
47
47
|
|
48
48
|
# @override
|
49
49
|
def type_cast(value)
|
50
|
-
return nil if value.nil? || value
|
50
|
+
return nil if value.nil? || value == 'NULL' || value =~ /^\s*NULL\s*$/i
|
51
51
|
case type
|
52
52
|
when :string then value
|
53
53
|
when :integer then value.respond_to?(:to_i) ? value.to_i : (value ? 1 : 0)
|
data/lib/arjdbc/derby/adapter.rb
CHANGED
@@ -2,6 +2,7 @@ ArJdbc.load_java_part :Derby
|
|
2
2
|
|
3
3
|
require 'arjdbc/util/table_copier'
|
4
4
|
require 'arjdbc/derby/schema_creation' # AR 4.x
|
5
|
+
require 'arel/visitors/derby'
|
5
6
|
|
6
7
|
module ArJdbc
|
7
8
|
module Derby
|
@@ -93,11 +94,6 @@ module ArJdbc
|
|
93
94
|
|
94
95
|
end
|
95
96
|
|
96
|
-
# @see ActiveRecord::ConnectionAdapters::Jdbc::ArelSupport
|
97
|
-
def self.arel_visitor_type(config = nil)
|
98
|
-
require 'arel/visitors/derby'; ::Arel::Visitors::Derby
|
99
|
-
end
|
100
|
-
|
101
97
|
ADAPTER_NAME = 'Derby'.freeze
|
102
98
|
|
103
99
|
def adapter_name
|
@@ -511,7 +507,7 @@ module ArJdbc
|
|
511
507
|
# Returns the value of an identity column of the last *INSERT* statement
|
512
508
|
# made over this connection.
|
513
509
|
# @note Check the *IDENTITY_VAL_LOCAL* function for documentation.
|
514
|
-
# @return [
|
510
|
+
# @return [Fixnum]
|
515
511
|
def last_insert_id
|
516
512
|
@connection.identity_val_local
|
517
513
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
ArJdbc.load_java_part :Firebird
|
2
2
|
|
3
|
+
require 'arel/visitors/firebird'
|
4
|
+
|
3
5
|
module ArJdbc
|
4
6
|
module Firebird
|
5
7
|
|
@@ -62,16 +64,6 @@ module ArJdbc
|
|
62
64
|
# @see ActiveRecord::ConnectionAdapters::JdbcAdapter#jdbc_column_class
|
63
65
|
def jdbc_column_class; ::ActiveRecord::ConnectionAdapters::FirebirdColumn end
|
64
66
|
|
65
|
-
# @see ArJdbc::ArelHelper::ClassMethods#arel_visitor_type
|
66
|
-
def self.arel_visitor_type(config = nil)
|
67
|
-
require 'arel/visitors/firebird'; ::Arel::Visitors::Firebird
|
68
|
-
end
|
69
|
-
|
70
|
-
# @deprecated no longer used
|
71
|
-
def self.arel2_visitors(config = nil)
|
72
|
-
{ 'firebird' => arel_visitor_type, 'firebirdsql' => arel_visitor_type }
|
73
|
-
end
|
74
|
-
|
75
67
|
# @private
|
76
68
|
@@emulate_booleans = true
|
77
69
|
|
@@ -224,11 +216,6 @@ module ArJdbc
|
|
224
216
|
true
|
225
217
|
end
|
226
218
|
|
227
|
-
# Does this adapter support using DISTINCT within COUNT?
|
228
|
-
def supports_count_distinct?
|
229
|
-
true
|
230
|
-
end
|
231
|
-
|
232
219
|
# Does this adapter support DDL rollbacks in transactions? That is, would
|
233
220
|
# CREATE TABLE or ALTER TABLE get rolled back by a transaction? PostgreSQL,
|
234
221
|
# SQL Server, and others support this. MySQL and others do not.
|
@@ -354,7 +341,7 @@ module ArJdbc
|
|
354
341
|
when NilClass then 'NULL'
|
355
342
|
when TrueClass then (type == :integer ? '1' : quoted_true)
|
356
343
|
when FalseClass then (type == :integer ? '0' : quoted_false)
|
357
|
-
when Float,
|
344
|
+
when Float, Fixnum, Bignum then value.to_s
|
358
345
|
# BigDecimals need to be output in a non-normalized form and quoted.
|
359
346
|
when BigDecimal then value.to_s('F')
|
360
347
|
when Symbol then "'#{quote_string(value.to_s)}'"
|
@@ -434,6 +421,10 @@ module ActiveRecord::ConnectionAdapters
|
|
434
421
|
super
|
435
422
|
end
|
436
423
|
|
424
|
+
def arel_visitor
|
425
|
+
Arel::Visitors::Firebird.new(self)
|
426
|
+
end
|
427
|
+
|
437
428
|
end
|
438
429
|
|
439
430
|
class FirebirdColumn < JdbcColumn
|
data/lib/arjdbc/h2/adapter.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
ArJdbc.load_java_part :H2
|
2
2
|
require 'arjdbc/hsqldb/adapter'
|
3
|
+
require 'arel/visitors/h2'
|
3
4
|
|
4
5
|
module ArJdbc
|
5
6
|
module H2
|
@@ -10,11 +11,6 @@ module ArJdbc
|
|
10
11
|
::ActiveRecord::ConnectionAdapters::H2JdbcConnection
|
11
12
|
end
|
12
13
|
|
13
|
-
# @see ActiveRecord::ConnectionAdapters::JdbcAdapter#jdbc_column_class
|
14
|
-
def jdbc_column_class
|
15
|
-
::ActiveRecord::ConnectionAdapters::H2Column
|
16
|
-
end
|
17
|
-
|
18
14
|
# @see ActiveRecord::ConnectionAdapters::JdbcColumn#column_types
|
19
15
|
def self.column_selector
|
20
16
|
[ /\.h2\./i, lambda { |config, column| column.extend(Column) } ]
|
@@ -77,11 +73,6 @@ module ArJdbc
|
|
77
73
|
|
78
74
|
end
|
79
75
|
|
80
|
-
# @see ActiveRecord::ConnectionAdapters::Jdbc::ArelSupport
|
81
|
-
def self.arel_visitor_type(config = nil)
|
82
|
-
require 'arel/visitors/h2'; ::Arel::Visitors::H2
|
83
|
-
end
|
84
|
-
|
85
76
|
ADAPTER_NAME = 'H2'.freeze
|
86
77
|
|
87
78
|
# @override
|
@@ -303,10 +294,10 @@ module ActiveRecord::ConnectionAdapters
|
|
303
294
|
|
304
295
|
class H2Adapter < JdbcAdapter
|
305
296
|
include ArJdbc::H2
|
306
|
-
end
|
307
297
|
|
308
|
-
|
309
|
-
|
298
|
+
def arel_visitor
|
299
|
+
Arel::Visitors::H2.new(self)
|
300
|
+
end
|
310
301
|
end
|
311
302
|
|
312
303
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
ArJdbc.load_java_part :HSQLDB
|
2
2
|
require 'arjdbc/hsqldb/explain_support'
|
3
3
|
require 'arjdbc/hsqldb/schema_creation' # AR 4.x
|
4
|
+
require 'arel/visitors/hsqldb'
|
4
5
|
|
5
6
|
module ArJdbc
|
6
7
|
module HSQLDB
|
@@ -64,11 +65,6 @@ module ArJdbc
|
|
64
65
|
|
65
66
|
end
|
66
67
|
|
67
|
-
# @see ActiveRecord::ConnectionAdapters::Jdbc::ArelSupport
|
68
|
-
def self.arel_visitor_type(config = nil)
|
69
|
-
require 'arel/visitors/hsqldb'; ::Arel::Visitors::HSQLDB
|
70
|
-
end
|
71
|
-
|
72
68
|
ADAPTER_NAME = 'HSQLDB'.freeze
|
73
69
|
|
74
70
|
def adapter_name
|
@@ -291,6 +287,10 @@ module ActiveRecord::ConnectionAdapters
|
|
291
287
|
|
292
288
|
class HsqldbAdapter < JdbcAdapter
|
293
289
|
include ArJdbc::HSQLDB
|
290
|
+
|
291
|
+
def arel_visitor # :nodoc:
|
292
|
+
Arel::Visitors::HSQLDB
|
293
|
+
end
|
294
294
|
end
|
295
295
|
|
296
296
|
end
|
data/lib/arjdbc/jdbc/adapter.rb
CHANGED
@@ -8,7 +8,6 @@ require 'arjdbc/jdbc/connection_methods'
|
|
8
8
|
require 'arjdbc/jdbc/driver'
|
9
9
|
require 'arjdbc/jdbc/column'
|
10
10
|
require 'arjdbc/jdbc/connection'
|
11
|
-
require 'arjdbc/jdbc/arel_support'
|
12
11
|
require 'arjdbc/jdbc/callbacks'
|
13
12
|
require 'arjdbc/jdbc/extension'
|
14
13
|
require 'arjdbc/jdbc/type_converter'
|
@@ -33,12 +32,9 @@ module ActiveRecord
|
|
33
32
|
# compatibility with native (MRI) adapters it's perfectly fine to sub-class
|
34
33
|
# the adapter and override some of its API methods.
|
35
34
|
class JdbcAdapter < AbstractAdapter
|
36
|
-
extend ShadowCoreMethods
|
37
|
-
|
38
|
-
include Jdbc::ArelSupport
|
39
35
|
include Jdbc::ConnectionPoolCallbacks
|
40
36
|
|
41
|
-
attr_reader :config
|
37
|
+
attr_reader :config, :prepared_statements
|
42
38
|
|
43
39
|
def self.new(connection, logger = nil, pool = nil)
|
44
40
|
adapter = super
|
@@ -55,14 +51,13 @@ module ActiveRecord
|
|
55
51
|
# @param logger the `ActiveRecord::Base.logger` to use (or nil)
|
56
52
|
# @param config the database configuration
|
57
53
|
# @note `initialize(logger, config)` with 2 arguments is supported as well
|
58
|
-
def initialize(connection, logger, config = nil)
|
59
|
-
# AR : initialize(connection, logger = nil, pool = nil)
|
60
|
-
# AR < 3.2 : initialize(connection, logger = nil)
|
61
|
-
if config.nil? && logger.respond_to?(:key?) # (logger, config)
|
62
|
-
config, logger, connection = logger, connection, nil
|
63
|
-
end
|
64
|
-
|
54
|
+
def initialize(connection, logger = nil, config = nil)
|
65
55
|
@config = config.respond_to?(:symbolize_keys) ? config.symbolize_keys : config
|
56
|
+
# FIXME: Rails 5 defaults to prepared statements on and we do not seem
|
57
|
+
# to work yet. So default to off unless it is requested until that is
|
58
|
+
# fixed.
|
59
|
+
@config[:prepared_statements] = false if !@config[:prepared_statements]
|
60
|
+
|
66
61
|
# NOTE: JDBC 4.0 drivers support checking if connection isValid
|
67
62
|
# thus no need to @config[:connection_alive_sql] ||= 'SELECT 1'
|
68
63
|
#
|
@@ -75,7 +70,7 @@ module ActiveRecord
|
|
75
70
|
# NOTE: adapter spec's init_connection only called if instantiated here :
|
76
71
|
connection ||= jdbc_connection_class(spec).new(@config, self)
|
77
72
|
|
78
|
-
super(connection, logger)
|
73
|
+
super(connection, logger, @config)
|
79
74
|
|
80
75
|
# kind of like `extend ArJdbc::MyDB if self.class == JdbcAdapter` :
|
81
76
|
klass = @config[:adapter_class]
|
@@ -83,8 +78,6 @@ module ActiveRecord
|
|
83
78
|
|
84
79
|
# NOTE: should not be necessary for JNDI due reconnect! on checkout :
|
85
80
|
configure_connection if respond_to?(:configure_connection)
|
86
|
-
|
87
|
-
@visitor = new_visitor # nil if no AREL (AR-2.3)
|
88
81
|
end
|
89
82
|
|
90
83
|
# Returns the (JDBC) connection class to be used for this adapter.
|
@@ -296,40 +289,15 @@ module ActiveRecord
|
|
296
289
|
|
297
290
|
# @override
|
298
291
|
def reconnect!
|
299
|
-
super # clear_cache! && reset_transaction
|
300
292
|
@connection.reconnect! # handles adapter.configure_connection
|
301
293
|
@connection
|
302
294
|
end
|
303
295
|
|
304
296
|
# @override
|
305
297
|
def disconnect!
|
306
|
-
super # clear_cache! && reset_transaction
|
307
|
-
return unless @connection
|
308
298
|
@connection.disconnect!
|
309
299
|
end
|
310
300
|
|
311
|
-
if ActiveRecord::VERSION::MAJOR < 3
|
312
|
-
|
313
|
-
# @private
|
314
|
-
def jdbc_insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
|
315
|
-
insert_sql(sql, name, pk, id_value, sequence_name)
|
316
|
-
end
|
317
|
-
alias_chained_method :insert, :query_dirty, :jdbc_insert
|
318
|
-
|
319
|
-
# @private
|
320
|
-
def jdbc_update(sql, name = nil, binds = [])
|
321
|
-
execute(sql, name, binds)
|
322
|
-
end
|
323
|
-
alias_chained_method :update, :query_dirty, :jdbc_update
|
324
|
-
|
325
|
-
# @private
|
326
|
-
def jdbc_select_all(sql, name = nil, binds = [])
|
327
|
-
select(sql, name, binds)
|
328
|
-
end
|
329
|
-
alias_chained_method :select_all, :query_cache, :jdbc_select_all
|
330
|
-
|
331
|
-
end
|
332
|
-
|
333
301
|
# @note Used on AR 2.3 and 3.0
|
334
302
|
# @override
|
335
303
|
def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
|
@@ -575,20 +543,6 @@ module ActiveRecord
|
|
575
543
|
end
|
576
544
|
end
|
577
545
|
|
578
|
-
# @private documented above
|
579
|
-
def execute(sql, name = nil, skip_logging = false)
|
580
|
-
if skip_logging.is_a?(Array)
|
581
|
-
binds, skip_logging = skip_logging, false
|
582
|
-
sql = suble_binds to_sql(sql, binds), binds
|
583
|
-
end
|
584
|
-
if skip_logging || name == :skip_logging
|
585
|
-
_execute(sql, name)
|
586
|
-
else
|
587
|
-
log(sql, name) { _execute(sql, name) }
|
588
|
-
end
|
589
|
-
end if ActiveRecord::VERSION::MAJOR < 3 ||
|
590
|
-
( ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0 )
|
591
|
-
|
592
546
|
# We need to do it this way, to allow Rails stupid tests to always work
|
593
547
|
# even if we define a new `execute` method. Instead of mixing in a new
|
594
548
|
# `execute`, an `_execute` should be mixed in.
|
@@ -759,7 +713,11 @@ module ActiveRecord
|
|
759
713
|
# @note AR-4x arguments expected: `(name, temporary, options)`
|
760
714
|
# @private documented bellow
|
761
715
|
def new_table_definition(table_definition, *args)
|
762
|
-
|
716
|
+
if ActiveRecord::VERSION::MAJOR > 4
|
717
|
+
table_definition.new(*args)
|
718
|
+
else
|
719
|
+
table_definition.new native_database_types, *args
|
720
|
+
end
|
763
721
|
end
|
764
722
|
private :new_table_definition
|
765
723
|
|
@@ -829,28 +787,16 @@ module ActiveRecord
|
|
829
787
|
false # off by default - NOTE: on AR 4.x it's on by default !?
|
830
788
|
end
|
831
789
|
|
832
|
-
if @@suble_binds =
|
790
|
+
if @@suble_binds = Java::JavaLang::System.getProperty('arjdbc.adapter.suble_binds')
|
833
791
|
@@suble_binds = Java::JavaLang::Boolean.parseBoolean(@@suble_binds)
|
834
792
|
else
|
835
793
|
@@suble_binds = ActiveRecord::VERSION::MAJOR < 4 # due compatibility
|
836
794
|
end
|
837
795
|
def self.suble_binds?; @@suble_binds; end
|
838
|
-
def self.suble_binds=(flag); @@suble_binds = flag; end
|
796
|
+
def self.suble_binds=(flag); @@suble_binds = flag; end
|
839
797
|
|
840
798
|
private
|
841
799
|
|
842
|
-
# @note Since AR 4.0 we (finally) do not "sub" SQL's '?' parameters !
|
843
|
-
# @deprecated This should go away (hopefully), now here due 1.2.x.
|
844
|
-
def suble_binds(sql, binds)
|
845
|
-
return sql if ! @@suble_binds || binds.nil? || binds.empty?
|
846
|
-
binds = binds.dup; warn = nil
|
847
|
-
result = sql.gsub('?') { warn = true; quote(*binds.shift.reverse) }
|
848
|
-
ActiveSupport::Deprecation.warn(
|
849
|
-
"string binds substitution is deprecated - please refactor your sql", caller[1..-1]
|
850
|
-
) if warn
|
851
|
-
result
|
852
|
-
end
|
853
|
-
|
854
800
|
# @private Supporting "string-subling" on AR 4.0 would require {#to_sql}
|
855
801
|
# to consume binds parameters otherwise it happens twice e.g. for a record
|
856
802
|
# insert it is called during {#insert} as well as on {#exec_insert} ...
|
@@ -858,13 +804,6 @@ module ActiveRecord
|
|
858
804
|
# array and run a query again since it's the very same instance on 4.0 !
|
859
805
|
def suble_binds(sql, binds)
|
860
806
|
sql
|
861
|
-
end if ActiveRecord::VERSION::MAJOR > 3
|
862
|
-
|
863
|
-
# @deprecated No longer used, will be removed.
|
864
|
-
# @see #suble_binds
|
865
|
-
def substitute_binds(sql, binds)
|
866
|
-
return sql if binds.nil? || binds.empty?; binds = binds.dup
|
867
|
-
extract_sql(sql).gsub('?') { quote(*binds.shift.reverse) }
|
868
807
|
end
|
869
808
|
|
870
809
|
# @deprecated No longer used, kept for 1.2 API compatibility.
|
Binary file
|
@@ -23,43 +23,24 @@ module ActiveRecord
|
|
23
23
|
# adapters) would be to mingle with the $LOAD_PATH which seems worse ...
|
24
24
|
case path
|
25
25
|
when 'active_record/connection_adapters/mysql_adapter'
|
26
|
-
|
27
|
-
|
28
|
-
super('arjdbc/mysql')
|
29
|
-
else
|
30
|
-
false
|
31
|
-
end
|
26
|
+
$LOADED_FEATURES << 'active_record/connection_adapters/mysql_adapter.rb'
|
27
|
+
super('arjdbc/mysql')
|
32
28
|
when 'active_record/connection_adapters/mysql2_adapter'
|
33
|
-
|
34
|
-
|
35
|
-
super('arjdbc/mysql')
|
36
|
-
else
|
37
|
-
false
|
38
|
-
end
|
29
|
+
$LOADED_FEATURES << 'active_record/connection_adapters/mysql2_adapter.rb'
|
30
|
+
super('arjdbc/mysql')
|
39
31
|
when 'active_record/connection_adapters/postgresql_adapter'
|
40
|
-
|
41
|
-
|
42
|
-
super('arjdbc/postgresql')
|
43
|
-
else
|
44
|
-
false
|
45
|
-
end
|
32
|
+
$LOADED_FEATURES << 'active_record/connection_adapters/postgresql_adapter.rb'
|
33
|
+
super('arjdbc/postgresql')
|
46
34
|
when 'active_record/connection_adapters/sqlite_adapter'
|
47
|
-
|
48
|
-
|
49
|
-
super('arjdbc/sqlite3')
|
50
|
-
else
|
51
|
-
false
|
52
|
-
end
|
35
|
+
$LOADED_FEATURES << 'active_record/connection_adapters/sqlite_adapter.rb'
|
36
|
+
super('arjdbc/sqlite3')
|
53
37
|
when 'active_record/connection_adapters/sqlite3_adapter'
|
54
|
-
|
55
|
-
|
56
|
-
super('arjdbc/sqlite3')
|
57
|
-
else
|
58
|
-
false
|
59
|
-
end
|
38
|
+
$LOADED_FEATURES << 'active_record/connection_adapters/sqlite3_adapter.rb'
|
39
|
+
super('arjdbc/sqlite3')
|
60
40
|
else super
|
61
41
|
end
|
62
42
|
end
|
43
|
+
|
63
44
|
end
|
64
45
|
|
65
|
-
end
|
46
|
+
end
|
data/lib/arjdbc/jdbc/base_ext.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
module ActiveRecord
|
2
|
-
|
3
|
-
|
4
|
-
class << self
|
2
|
+
class << Base
|
3
|
+
m = Module.new do
|
5
4
|
# Allow adapters to provide their own {#reset_column_information} method.
|
6
5
|
# @note This only affects the current thread's connection.
|
7
|
-
def
|
6
|
+
def reset_column_information # :nodoc:
|
8
7
|
# invoke the adapter-specific reset_column_information method
|
9
8
|
connection.reset_column_information if connection.respond_to?(:reset_column_information)
|
10
|
-
|
11
|
-
end
|
12
|
-
unless method_defined?("reset_column_information_without_arjdbc")
|
13
|
-
alias_method_chain :reset_column_information, :arjdbc
|
9
|
+
super
|
14
10
|
end
|
15
11
|
end
|
12
|
+
|
13
|
+
self.prepend(m)
|
16
14
|
end
|
17
15
|
|
18
16
|
# Represents exceptions that have propagated up through the JDBC API.
|
@@ -43,21 +41,4 @@ module ActiveRecord
|
|
43
41
|
end
|
44
42
|
|
45
43
|
end
|
46
|
-
|
47
|
-
module ConnectionAdapters
|
48
|
-
# Allows properly re-defining methods that may already be alias-chain-ed.
|
49
|
-
# Query caching works even with overriden alias_method_chain'd methods.
|
50
|
-
# @private
|
51
|
-
module ShadowCoreMethods
|
52
|
-
def alias_chained_method(name, feature, target)
|
53
|
-
# NOTE: aliasing for things such as columns (with feature query_cache)
|
54
|
-
# seems to only be used for 2.3 since 3.0 methods are not aliased ...
|
55
|
-
if method_defined?(method = "#{name}_without_#{feature}")
|
56
|
-
alias_method method, target
|
57
|
-
else
|
58
|
-
alias_method name, target if name.to_s != target.to_s
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
44
|
end
|