activerecord-jdbc-alt-adapter 71.0.0.alpha2-java → 72.0.0.alpha1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6590c4d705c35e5a4849e4ef0bb076efba93509b8bcd8b4c2db49a4bc84b0f31
4
- data.tar.gz: cb87d9f9f2763b178f990359efecb6b1199cbe15866460bb837232fcdd8b75e1
3
+ metadata.gz: 9368e28d99e49de4164150e2e006ce8991be7d7aab58e6773936866f86dbbdd0
4
+ data.tar.gz: '03983c9218db6dd3a9ab278b0364ded1d9f5c315853b7ed6b543a05cca8c6c6c'
5
5
  SHA512:
6
- metadata.gz: 511e55410d149724a0765b5494a15ca4fe493bbd36b969a587d7bab23458cb32a45d34c01f79ca8b170b7f1e86fdf58e81bc4ba3ea15d464fe954a8266c41743
7
- data.tar.gz: 9fdfe69ab63373f8e31cd2d60f5ae88fd3f4499250010aab4ffbeabb9c9345f017bb012932598a84297bd63d8b28f5bc38d18213f95b19b3307a93f38ecfc775
6
+ metadata.gz: 450ddae41c05f2519c53ff0ad17de0bfd3cfefa1a471775a9d27946843f2d685301ff12cbbcdd4f434f275ee4f067798fc500ff49a2f2ec79f2339dfede6fc8c
7
+ data.tar.gz: aa9aa18ad21ead09d7bab3180032c8fa71ffee37fbb43dbba6a52ac3b436da34010e229e10cf1d6eec9edb2a803addcd0585a0b8ac78bdba05281f77dc7f5924
@@ -27,7 +27,7 @@ jobs:
27
27
  ruby-version: ['jruby-head']
28
28
  db: ['mysql2']
29
29
  test_targets: ["rails:test_mysql2"]
30
- ar_version: ["7-1-stable"]
30
+ ar_version: ["7-2-stable"]
31
31
  prepared_statements: ['false', 'true']
32
32
  driver: ['MySQL']
33
33
 
@@ -42,7 +42,7 @@ jobs:
42
42
  AR_VERSION: ${{ matrix.ar_version }}
43
43
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
44
44
  DRIVER: ${{ matrix.driver }}
45
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
45
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
46
46
 
47
47
  steps:
48
48
  - uses: actions/checkout@v4
@@ -79,7 +79,7 @@ jobs:
79
79
  ruby-version: [ 'jruby-head' ]
80
80
  db: [ 'postgresql' ]
81
81
  test_targets: [ "rails:test_postgresql" ]
82
- ar_version: ["7-1-stable"]
82
+ ar_version: ["7-2-stable"]
83
83
  prepared_statements: [ 'false', 'true' ]
84
84
 
85
85
  services:
@@ -95,7 +95,7 @@ jobs:
95
95
  env:
96
96
  DB: ${{ matrix.db }}
97
97
  AR_VERSION: ${{ matrix.ar_version }}
98
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
98
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
99
99
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
100
100
  PGHOST: localhost
101
101
  PGPORT: 5432
@@ -129,12 +129,12 @@ jobs:
129
129
  ruby-version: ['jruby-head']
130
130
  db: ['sqlite3']
131
131
  test_targets: ["rails:test_sqlite3"]
132
- ar_version: ["7-1-stable", "main"]
132
+ ar_version: ["7-2-stable"]
133
133
 
134
134
  env:
135
135
  DB: ${{ matrix.db }}
136
136
  AR_VERSION: ${{ matrix.ar_version }}
137
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
137
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
138
138
 
139
139
  steps:
140
140
  - uses: actions/checkout@v4
@@ -149,7 +149,7 @@ jobs:
149
149
  rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
150
150
  - name: Run tests
151
151
  run: |
152
- bundle exec rake ${{ matrix.test_targets }}
152
+ bundle exec rake ${{ matrix.test_targets }} --trace
153
153
 
154
154
  test-arjdbc-mysql:
155
155
 
@@ -173,7 +173,7 @@ jobs:
173
173
  env:
174
174
  DB: ${{ matrix.db }}
175
175
  DRIVER: ${{ matrix.driver }}
176
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
176
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
177
177
  MY_USER: root
178
178
  MY_PASSWORD: root
179
179
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
@@ -222,7 +222,7 @@ jobs:
222
222
  env:
223
223
  DB: ${{ matrix.db }}
224
224
  DRIVER: ${{ matrix.driver }}
225
- JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
225
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
226
226
  PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
227
227
  INSERT_RETURNING: ${{ matrix.insert_returning }}
228
228
  PGHOST: localhost
data/Gemfile CHANGED
@@ -62,13 +62,13 @@ group :test do
62
62
  gem 'mocha', '~> 1.2', require: false # Rails has '~> 0.14'
63
63
 
64
64
  gem 'bcrypt', '~> 3.1.11', require: false
65
- gem 'jdbc-mssql', '~> 12.2', require: nil
65
+ gem 'jdbc-mssql', '~> 12.6', require: nil
66
66
  # gem 'pry-debugger-jruby', platform: :jruby
67
67
  end
68
68
 
69
69
  group :rails do
70
70
  group :test do
71
- gem 'minitest', require: nil
71
+ gem 'minitest', '~> 5.24.0', require: nil
72
72
  gem 'minitest-excludes', require: nil
73
73
  gem 'minitest-rg', require: nil
74
74
 
data/README.md CHANGED
@@ -145,9 +145,10 @@ Versions are targeted at certain versions of Rails and live on their own branche
145
145
  | 60.x | 6.0.x | 60-stable | 9.2.7 | 8 |
146
146
  | 61.x | 6.1.x | 61-stable | 9.2.7 | 8 |
147
147
  | 70.x | 7.0.x | 70-stable | 9.3.0 | 8 |
148
- | 71.x | 7.1.x | master | 9.4.3 | 8 |
148
+ | 71.x | 7.1.x | 71-stable | 9.4.3 | 8 |
149
+ | 72.x | 7.2.x | master | 9.4.3 | 8 |
149
150
 
150
- Note: 71.x is still under development and not supported yet.
151
+ Note: 72.x is still under development and not supported yet.
151
152
 
152
153
  Note that JRuby 9.1.x and JRuby 9.2.x are at end-of-life. We recommend Java 8
153
154
  at a minimum for all versions.
@@ -41,7 +41,7 @@ Gem::Specification.new do |gem|
41
41
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
42
42
  gem.test_files = gem.files.grep(%r{^test/})
43
43
 
44
- gem.add_dependency 'activerecord', '~> 7.1.3'
44
+ gem.add_dependency "activerecord", "~> 7.2.2"
45
45
 
46
46
  #gem.add_development_dependency 'test-unit', '2.5.4'
47
47
  #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
@@ -43,7 +43,7 @@ Gem::Specification.new do |gem|
43
43
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
44
44
  gem.test_files = gem.files.grep(%r{^test/})
45
45
 
46
- gem.add_dependency 'activerecord', '~> 7.1.3'
46
+ gem.add_dependency "activerecord", "~> 7.2.2"
47
47
 
48
48
  #gem.add_development_dependency 'test-unit', '2.5.4'
49
49
  #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
@@ -83,15 +83,17 @@ module Arel
83
83
  @select_statement = nil
84
84
  end
85
85
 
86
- def visit_Arel_Table o, collector
86
+ def visit_Arel_Table(o, collector)
87
87
  # Apparently, o.engine.connection can actually be a different adapter
88
88
  # than sqlserver. Can be removed if fixed in ActiveRecord. See:
89
89
  # github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/450
90
90
  table_name = begin
91
- if o.class.engine.connection.respond_to?(:sqlserver?) && o.class.engine.connection.database_prefix_remote_server?
92
- remote_server_table_name(o)
93
- else
94
- quote_table_name(o.name)
91
+ o.class.engine.with_connection do |connection|
92
+ if connection.respond_to?(:sqlserver?) && connection.database_prefix_remote_server?
93
+ remote_server_table_name(o)
94
+ else
95
+ quote_table_name(o.name)
96
+ end
95
97
  end
96
98
  rescue Exception => e
97
99
  quote_table_name(o.name)
@@ -241,15 +243,30 @@ module Arel
241
243
 
242
244
  # column_name = schema_cache.primary_keys(t.name) || column_cache(t.name).first.try(:second).try(:name)
243
245
  # NOTE: for table name aliases columns_hash('table_alias') requires to return an empty hash.
244
- column_name = @connection.schema_cache.primary_keys(t.name) ||
245
- @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
246
+ primary_keys = @connection.schema_cache.primary_keys(t.name)
247
+ column_name = nil
248
+
249
+ case primary_keys
250
+ when NilClass
251
+ column_name = @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
252
+ when String
253
+ column_name = primary_keys
254
+ when Array
255
+ candidate_columns = @connection.schema_cache.columns_hash(t.name).slice(*primary_keys).values
256
+ candidate_column = candidate_columns.find(&:identity?)
257
+ candidate_column ||= candidate_columns.first
258
+ column_name = candidate_column.try(:name)
259
+ end
260
+
246
261
  column_name ? t[column_name] : nil
247
262
  end
248
263
 
249
- def remote_server_table_name o
250
- ActiveRecord::ConnectionAdapters::SQLServer::Utils.extract_identifiers(
251
- "#{o.class.engine.connection.database_prefix}#{o.name}"
252
- ).quoted
264
+ def remote_server_table_name(o)
265
+ o.class.engine.with_connection do |connection|
266
+ ActiveRecord::ConnectionAdapters::SQLServer::Utils.extract_identifiers(
267
+ "#{connection.database_prefix}#{o.name}"
268
+ ).quoted
269
+ end
253
270
  end
254
271
 
255
272
  # Need to remove ordering from subqueries unless TOP/OFFSET also used. Otherwise, SQLServer
@@ -46,13 +46,12 @@ module ArJdbc
46
46
  end
47
47
 
48
48
  def reconnect
49
- if active?
50
- @raw_connection.rollback rescue nil
51
- else
52
- connect
53
- end
54
- end
49
+ @raw_connection&.close
50
+
51
+ @raw_connection = nil
55
52
 
53
+ connect
54
+ end
56
55
  end
57
56
  end
58
57
  end
@@ -78,20 +78,8 @@ module ArJdbc
78
78
  end
79
79
  alias :exec_delete :exec_update
80
80
 
81
- def execute(sql, name = nil, async: false, allow_retry: false, materialize_transactions: true)
82
- sql = transform_query(sql)
83
-
84
- if preventing_writes? && write_query?(sql)
85
- raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
86
- end
87
-
88
- mark_transaction_written_if_write(sql)
89
-
90
- raw_execute(sql, name, async: async, allow_retry: allow_retry, materialize_transactions: materialize_transactions)
91
- end
92
-
93
81
  # overridden to support legacy binds
94
- def select_all(arel, name = nil, binds = NO_BINDS, preparable: nil, async: false)
82
+ def select_all(arel, name = nil, binds = NO_BINDS, preparable: nil, async: false, allow_retry: false)
95
83
  binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
96
84
  super
97
85
  end
@@ -107,7 +95,9 @@ module ArJdbc
107
95
  def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: true)
108
96
  log(sql, name, async: async) do
109
97
  with_raw_connection(allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |conn|
110
- conn.execute(sql)
98
+ result = conn.execute(sql)
99
+ verified!
100
+ result
111
101
  end
112
102
  end
113
103
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_model/attribute"
4
+
5
+ module ActiveRecord
6
+ # NOTE: improved implementation for hash methods that is used to
7
+ # compare objects. AR and arel commonly use `[a, b] - [b]` operations and
8
+ # JRuby internally uses the hash method to implement that operation,
9
+ # on the other hand, CRuby does not use the hash method
10
+ # for small arrays (length <= 16).
11
+ class Relation
12
+ # monkey patch
13
+ module RelationQueryAttributeMonkeyPatch
14
+ def hash
15
+ # [self.class, name, value_for_database, type].hash
16
+ [self.class, name, value_before_type_cast, type].hash
17
+ end
18
+ end
19
+
20
+ class QueryAttribute
21
+ prepend RelationQueryAttributeMonkeyPatch
22
+ end
23
+ end
24
+ end
Binary file
@@ -30,6 +30,10 @@ require 'arjdbc/mssql/errors'
30
30
  require 'arjdbc/mssql/schema_creation'
31
31
  require 'arjdbc/mssql/database_limits'
32
32
 
33
+ require "arjdbc/mssql/adapter_hash_config"
34
+
35
+ require "arjdbc/abstract/relation_query_attribute_monkey_patch"
36
+
33
37
  module ActiveRecord
34
38
  module ConnectionAdapters
35
39
  # MSSQL (SQLServer) adapter class definition
@@ -42,6 +46,7 @@ module ActiveRecord
42
46
  # include ArJdbc::Abstract::DatabaseStatements
43
47
  # include ArJdbc::Abstract::StatementCache
44
48
  include ArJdbc::Abstract::TransactionSupport
49
+ include ArJdbc::MSSQLConfig
45
50
 
46
51
  include MSSQL::Quoting
47
52
  include MSSQL::SchemaStatements
@@ -79,7 +84,8 @@ module ActiveRecord
79
84
  # configure_connection happens in super
80
85
  super
81
86
 
82
- conn_params = @config.compact
87
+ # assign arjdbc extra connection params
88
+ conn_params = build_connection_config(@config.compact)
83
89
 
84
90
  @raw_connection = nil
85
91
 
@@ -338,7 +344,7 @@ module ActiveRecord
338
344
 
339
345
  schemas_and_tables.map do |schema_table|
340
346
  schema, table = schema_table
341
- "#{quote_name_part(schema)}.#{quote_name_part(table)}"
347
+ "#{self.class.mssql_quote_name_part(schema)}.#{self.class.mssql_quote_name_part(table)}"
342
348
  end
343
349
  end
344
350
 
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ArJdbc
4
+ module MSSQLConfig
5
+ def build_connection_config(config)
6
+ config = config.deep_dup
7
+
8
+ load_jdbc_driver
9
+
10
+ config[:driver] ||= database_driver_name
11
+
12
+ config[:host] ||= "localhost"
13
+ config[:connection_alive_sql] ||= "SELECT 1"
14
+ config[:lock_timeout] ||= 5000
15
+
16
+ config[:url] ||= build_connection_url(config)
17
+
18
+ config
19
+ end
20
+
21
+ private
22
+
23
+ def load_jdbc_driver
24
+ require "jdbc/mssql"
25
+
26
+ ::Jdbc::Mssql.load_driver if defined?(::Jdbc::Mssql.load_driver)
27
+ rescue LoadError
28
+ # assuming driver.jar is on the class-path
29
+ end
30
+
31
+ def database_driver_name
32
+ "com.microsoft.sqlserver.jdbc.SQLServerDriver"
33
+ end
34
+
35
+ def build_connection_url(config)
36
+ url = "".dup
37
+ url << "jdbc:sqlserver://#{config[:host]}"
38
+ url << ( config[:port] ? ":#{config[:port]};" : ';' )
39
+ url << "databaseName=#{config[:database]};" if config[:database]
40
+ url << "instanceName=#{config[:instance]};" if config[:instance]
41
+ url << "sendTimeAsDatetime=#{config[:send_time_as_datetime] || false};"
42
+ url << "loginTimeout=#{config[:login_timeout].to_i};" if config[:login_timeout]
43
+ url << "lockTimeout=#{config[:lock_timeout].to_i};"
44
+ url << "encrypt=#{config[:encrypt]};" if config.key?(:encrypt)
45
+ url << "trustServerCertificate=#{config[:trust_server_certificate]};" if config.key?(:trust_server_certificate)
46
+ app = config[:application_name] || config[:appname] || config[:application]
47
+ url << "applicationName=#{app};" if app
48
+ isc = config[:integrated_security] # Win only - needs sqljdbc_auth.dll
49
+ url << "integratedSecurity=#{isc};" unless isc.nil?
50
+ url
51
+ end
52
+ end
53
+ end
@@ -90,7 +90,7 @@ module ActiveRecord
90
90
  end
91
91
  end
92
92
 
93
- def internal_exec_query(sql, name = 'SQL', binds = [], prepare: false, async: false)
93
+ def internal_exec_query(sql, name = 'SQL', binds = [], prepare: false, async: false, allow_retry: false)
94
94
  sql = transform_query(sql)
95
95
 
96
96
  check_if_write_query(sql)
@@ -244,7 +244,7 @@ module ActiveRecord
244
244
  end
245
245
 
246
246
  def raw_jdbc_connection
247
- @raw_connection
247
+ any_raw_connection
248
248
  end
249
249
 
250
250
  # It seems the truncate_tables is mostly used for testing
@@ -4,6 +4,62 @@ module ActiveRecord
4
4
  module ConnectionAdapters
5
5
  module MSSQL
6
6
  module Quoting
7
+ extend ActiveSupport::Concern
8
+
9
+ QUOTED_COLUMN_NAMES = Concurrent::Map.new # :nodoc:
10
+ QUOTED_TABLE_NAMES = Concurrent::Map.new # :nodoc:
11
+
12
+ module ClassMethods # :nodoc:
13
+ def column_name_matcher
14
+ /
15
+ \A
16
+ (
17
+ (?:
18
+ # \[table_name\].\[column_name\] | function(one or no argument)
19
+ ((?:\w+\.|\[\w+\]\.)?(?:\w+|\[\w+\])) | \w+\((?:|\g<2>)\)
20
+ )
21
+ (?:\s+AS\s+(?:\w+|\[\w+\]))?
22
+ )
23
+ (?:\s*,\s*\g<1>)*
24
+ \z
25
+ /ix
26
+ end
27
+
28
+ def column_name_with_order_matcher
29
+ /
30
+ \A
31
+ (
32
+ (?:
33
+ # \[table_name\].\[column_name\] | function(one or no argument)
34
+ ((?:\w+\.|\[\w+\]\.)?(?:\w+|\[\w+\])) | \w+\((?:|\g<2>)\)
35
+ )
36
+ (?:\s+ASC|\s+DESC)?
37
+ )
38
+ (?:\s*,\s*\g<1>)*
39
+ \z
40
+ /ix
41
+ end
42
+
43
+ def quote_column_name(name)
44
+ QUOTED_COLUMN_NAMES[name] ||= mssql_quote_column_name(name)
45
+ end
46
+
47
+ def quote_table_name(name)
48
+ QUOTED_TABLE_NAMES[name] ||= mssql_quote_column_name(name)
49
+ end
50
+
51
+ def mssql_quote_column_name(name)
52
+ name = name.to_s.split(".")
53
+ name.map! { |n| mssql_quote_name_part(n) } # "[#{name}]"
54
+ name.join(".")
55
+ end
56
+
57
+ # Implements the quoting style for SQL Server
58
+ def mssql_quote_name_part(part)
59
+ part =~ /^\[.*\]$/ ? part : "[#{part.gsub(']', ']]')}]"
60
+ end
61
+ end
62
+
7
63
  QUOTED_TRUE = '1'
8
64
  QUOTED_FALSE = '0'
9
65
 
@@ -88,42 +144,6 @@ module ActiveRecord
88
144
  # @see #quote in old adapter
89
145
  BLOB_VALUE_MARKER = "''"
90
146
 
91
- def column_name_matcher
92
- COLUMN_NAME
93
- end
94
-
95
- def column_name_with_order_matcher
96
- COLUMN_NAME_WITH_ORDER
97
- end
98
-
99
- COLUMN_NAME = /
100
- \A
101
- (
102
- (?:
103
- # \[table_name\].\[column_name\] | function(one or no argument)
104
- ((?:\w+\.|\[\w+\]\.)?(?:\w+|\[\w+\])) | \w+\((?:|\g<2>)\)
105
- )
106
- (?:\s+AS\s+(?:\w+|\[\w+\]))?
107
- )
108
- (?:\s*,\s*\g<1>)*
109
- \z
110
- /ix
111
-
112
- COLUMN_NAME_WITH_ORDER = /
113
- \A
114
- (
115
- (?:
116
- # \[table_name\].\[column_name\] | function(one or no argument)
117
- ((?:\w+\.|\[\w+\]\.)?(?:\w+|\[\w+\])) | \w+\((?:|\g<2>)\)
118
- )
119
- (?:\s+ASC|\s+DESC)?
120
- )
121
- (?:\s*,\s*\g<1>)*
122
- \z
123
- /ix
124
-
125
- private_constant :COLUMN_NAME, :COLUMN_NAME_WITH_ORDER
126
-
127
147
  private
128
148
 
129
149
  def time_with_db_timezone(value)
@@ -182,20 +182,8 @@ module ActiveRecord
182
182
  rename_table_indexes(table_name, new_name)
183
183
  end
184
184
 
185
- # This is the same as the abstract method
186
- def quote_table_name(name)
187
- quote_column_name(name)
188
- end
189
-
190
- # This overrides the abstract method to be specific to SQL Server.
191
- def quote_column_name(name)
192
- name = name.to_s.split('.')
193
- name.map! { |n| quote_name_part(n) } # "[#{name}]"
194
- name.join('.')
195
- end
196
-
197
185
  def quote_database_name(name)
198
- quote_name_part(name.to_s)
186
+ self.class.mssql_quote_name_part(name.to_s)
199
187
  end
200
188
 
201
189
  # @private these cannot specify a limit
@@ -439,11 +427,6 @@ module ActiveRecord
439
427
  result
440
428
  end
441
429
 
442
- # Implements the quoting style for SQL Server
443
- def quote_name_part(part)
444
- part =~ /^\[.*\]$/ ? part : "[#{part.gsub(']', ']]')}]"
445
- end
446
-
447
430
  def remove_check_constraints(table_name, column_name)
448
431
  constraints = select_values "SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE where TABLE_NAME = '#{quote_string(table_name)}' and COLUMN_NAME = '#{quote_string(column_name)}'", 'SCHEMA'
449
432
  constraints.each do |constraint|
data/lib/arjdbc/mssql.rb CHANGED
@@ -6,4 +6,4 @@ module ArJdbc
6
6
  MsSQL = MSSQL # compatibility with 1.2
7
7
  end
8
8
 
9
- ArJdbc.warn_unsupported_adapter 'mssql', [7, 0] # warns on AR >= 4.2
9
+ ArJdbc.warn_unsupported_adapter "mssql", [7, 2] # warns on AR >= 4.2
@@ -11,6 +11,10 @@ require 'arjdbc/abstract/database_statements'
11
11
  require 'arjdbc/abstract/statement_cache'
12
12
  require 'arjdbc/abstract/transaction_support'
13
13
 
14
+ require "arjdbc/mysql/adapter_hash_config"
15
+
16
+ require "arjdbc/abstract/relation_query_attribute_monkey_patch"
17
+
14
18
  module ActiveRecord
15
19
  module ConnectionAdapters
16
20
  AbstractMysqlAdapter.class_eval do
@@ -32,6 +36,7 @@ module ActiveRecord
32
36
  include ArJdbc::Abstract::TransactionSupport
33
37
 
34
38
  include ArJdbc::MySQL
39
+ include ArJdbc::MysqlConfig
35
40
 
36
41
  class << self
37
42
  def jdbc_connection_class
@@ -66,6 +71,9 @@ module ActiveRecord
66
71
 
67
72
  @config[:flags] ||= 0
68
73
 
74
+ # assign arjdbc extra connection params
75
+ conn_params = build_connection_config(@config.compact)
76
+
69
77
  # JDBC mysql appears to use found rows by default: https://dev.mysql.com/doc/connector-j/en/connector-j-connp-props-connection.html
70
78
  # if @config[:flags].kind_of? Array
71
79
  # @config[:flags].push "FOUND_ROWS"
@@ -73,7 +81,7 @@ module ActiveRecord
73
81
  # @config[:flags] |= ::Mysql2::Client::FOUND_ROWS
74
82
  # end
75
83
 
76
- @connection_parameters ||= @config
84
+ @connection_parameters = conn_params
77
85
  end
78
86
 
79
87
  def self.database_exists?(config)