activerecord-jdbc-alt-adapter 80.0.0.rc1-java → 80.1.0.rc1-java
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/.github/workflows/main.yml +11 -3
- data/activerecord-jdbc-adapter.gemspec +1 -1
- data/activerecord-jdbc-alt-adapter.gemspec +1 -1
- data/lib/arjdbc/abstract/database_statements.rb +4 -26
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/mssql/adapter.rb +1 -0
- data/lib/arjdbc/mssql/column.rb +2 -2
- data/lib/arjdbc/mssql/database_statements.rb +5 -4
- data/lib/arjdbc/mssql/schema_creation.rb +1 -1
- data/lib/arjdbc/mssql/schema_statements.rb +4 -0
- data/lib/arjdbc/mssql/type_metadata.rb +36 -0
- data/lib/arjdbc/mssql/types/binary_types.rb +5 -4
- data/lib/arjdbc/mssql/types/deprecated_types.rb +15 -12
- data/lib/arjdbc/mssql/types/string_types.rb +10 -8
- data/lib/arjdbc/mssql.rb +1 -1
- data/lib/arjdbc/postgresql/adapter.rb +0 -4
- data/lib/arjdbc/postgresql/database_statements.rb +4 -3
- data/lib/arjdbc/postgresql/schema_statements.rb +7 -0
- data/lib/arjdbc/tasks/mssql_database_tasks.rb +1 -21
- data/lib/arjdbc/version.rb +1 -1
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +3 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 633e3fdf964a200968304873babd37145c39fdcacf75c0e29bd78e75df99bad0
|
|
4
|
+
data.tar.gz: 979e73fa4890863a4eea2adfbe66667cf17c0aa3bb510fdc99ca4a794977768b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ac0755284b9164a031dae9e2b3bcaebd65380d32637a85abeb09ce11ff63ca6c95f69d50e02398fb47fc87cf4a89522bd33768eb38e2d4b603d4ffe42918837
|
|
7
|
+
data.tar.gz: 14c8650cbc96db74c2d58d331d33e9cf8ed1a9d74ddb944dd150c166a890d24b53e8474c02de2ce894b8199b6070453fd145e124670bbd0659b00046bad79686
|
data/.github/workflows/main.yml
CHANGED
|
@@ -30,6 +30,8 @@ jobs:
|
|
|
30
30
|
ruby-version: ['jruby-10.0.6.0']
|
|
31
31
|
db: ['mssql']
|
|
32
32
|
test_targets: ['test_mssql']
|
|
33
|
+
prepared_statements: ['true', 'false']
|
|
34
|
+
ar_version: ["8-1-stable-dev"]
|
|
33
35
|
|
|
34
36
|
# NOTE: using a specific tag, it fails with 2019-latest.
|
|
35
37
|
# it seems the issue is related to some changes in mssql tools
|
|
@@ -55,6 +57,8 @@ jobs:
|
|
|
55
57
|
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
|
|
56
58
|
SQLUSER: SA
|
|
57
59
|
SQLPASS: Password12!
|
|
60
|
+
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
|
|
61
|
+
AR_VERSION: ${{ matrix.ar_version }}
|
|
58
62
|
|
|
59
63
|
steps:
|
|
60
64
|
- uses: actions/checkout@v3
|
|
@@ -85,10 +89,12 @@ jobs:
|
|
|
85
89
|
ruby-version: ['jruby-10.0.6.0']
|
|
86
90
|
db: ['sqlite3']
|
|
87
91
|
test_targets: ['test_sqlite3']
|
|
92
|
+
ar_version: ["8-1-stable-dev"]
|
|
88
93
|
|
|
89
94
|
env:
|
|
90
95
|
DB: ${{ matrix.db }}
|
|
91
96
|
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M --dev"
|
|
97
|
+
AR_VERSION: ${{ matrix.ar_version }}
|
|
92
98
|
|
|
93
99
|
steps:
|
|
94
100
|
- uses: actions/checkout@v4
|
|
@@ -116,6 +122,7 @@ jobs:
|
|
|
116
122
|
test_targets: ["db:postgresql test_postgresql"]
|
|
117
123
|
prepared_statements: ['false', 'true']
|
|
118
124
|
insert_returning: ['false', 'true']
|
|
125
|
+
ar_version: ["8-1-stable-dev"]
|
|
119
126
|
|
|
120
127
|
services:
|
|
121
128
|
postgres:
|
|
@@ -132,6 +139,7 @@ jobs:
|
|
|
132
139
|
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
|
|
133
140
|
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
|
|
134
141
|
INSERT_RETURNING: ${{ matrix.insert_returning }}
|
|
142
|
+
AR_VERSION: ${{ matrix.ar_version }}
|
|
135
143
|
PGHOST: localhost
|
|
136
144
|
PGPORT: 5432
|
|
137
145
|
PGUSER: postgres
|
|
@@ -160,7 +168,7 @@ jobs:
|
|
|
160
168
|
ruby-version: [ 'jruby-10.0.6.0' ]
|
|
161
169
|
db: [ 'mssql' ]
|
|
162
170
|
test_targets: [ "rails:test_mssql" ]
|
|
163
|
-
ar_version: ["8-
|
|
171
|
+
ar_version: ["8-1-stable-dev"]
|
|
164
172
|
|
|
165
173
|
services:
|
|
166
174
|
mssql:
|
|
@@ -216,7 +224,7 @@ jobs:
|
|
|
216
224
|
ruby-version: ['jruby-10.0.6.0']
|
|
217
225
|
db: ['sqlite3']
|
|
218
226
|
test_targets: ["rails:test_sqlite3"]
|
|
219
|
-
ar_version: ["8-
|
|
227
|
+
ar_version: ["8-1-stable-dev"]
|
|
220
228
|
|
|
221
229
|
env:
|
|
222
230
|
DB: ${{ matrix.db }}
|
|
@@ -248,7 +256,7 @@ jobs:
|
|
|
248
256
|
ruby-version: [ 'jruby-10.0.6.0' ]
|
|
249
257
|
db: [ 'postgresql' ]
|
|
250
258
|
test_targets: [ "rails:test_postgresql" ]
|
|
251
|
-
ar_version: ["8-
|
|
259
|
+
ar_version: ["8-1-stable-dev"]
|
|
252
260
|
prepared_statements: [ 'false', 'true' ]
|
|
253
261
|
|
|
254
262
|
services:
|
|
@@ -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", "~> 8.0"
|
|
44
|
+
gem.add_dependency "activerecord", "~> 8.1.0"
|
|
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", "~> 8.
|
|
46
|
+
gem.add_dependency "activerecord", "~> 8.1.0"
|
|
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'
|
|
@@ -10,13 +10,7 @@ module ArJdbc
|
|
|
10
10
|
NO_BINDS = [].freeze
|
|
11
11
|
|
|
12
12
|
def exec_insert(sql, name = nil, binds = NO_BINDS, pk = nil, sequence_name = nil, returning: nil)
|
|
13
|
-
|
|
14
|
-
raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
mark_transaction_written_if_write(sql)
|
|
18
|
-
|
|
19
|
-
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
|
|
13
|
+
sql = preprocess_query(sql)
|
|
20
14
|
|
|
21
15
|
type_casted_binds = type_casted_binds(binds)
|
|
22
16
|
|
|
@@ -36,13 +30,7 @@ module ArJdbc
|
|
|
36
30
|
# It appears that at this point (AR 5.0) "prepare" should only ever be true
|
|
37
31
|
# if prepared statements are enabled
|
|
38
32
|
def internal_exec_query(sql, name = nil, binds = NO_BINDS, prepare: false, async: false, allow_retry: false, materialize_transactions: true)
|
|
39
|
-
|
|
40
|
-
raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
mark_transaction_written_if_write(sql)
|
|
44
|
-
|
|
45
|
-
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
|
|
33
|
+
sql = preprocess_query(sql)
|
|
46
34
|
|
|
47
35
|
# puts "[1]internal----->sql: #{sql}, binds: #{binds}"
|
|
48
36
|
type_casted_binds = type_casted_binds(binds)
|
|
@@ -52,7 +40,7 @@ module ArJdbc
|
|
|
52
40
|
if without_prepared_statement?(binds)
|
|
53
41
|
log(sql, name, async: async) { conn.execute_query(sql) }
|
|
54
42
|
else
|
|
55
|
-
log(sql, name, type_casted_binds, async: async) do
|
|
43
|
+
log(sql, name, binds, type_casted_binds, async: async) do
|
|
56
44
|
# this is different from normal AR that always caches
|
|
57
45
|
cached_statement = fetch_cached_statement(sql) if prepare && @jdbc_statement_cache_enabled
|
|
58
46
|
conn.execute_prepared_query(sql, binds, cached_statement)
|
|
@@ -62,11 +50,7 @@ module ArJdbc
|
|
|
62
50
|
end
|
|
63
51
|
|
|
64
52
|
def exec_update(sql, name = 'SQL', binds = NO_BINDS)
|
|
65
|
-
|
|
66
|
-
raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
mark_transaction_written_if_write(sql)
|
|
53
|
+
sql = preprocess_query(sql)
|
|
70
54
|
|
|
71
55
|
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
|
|
72
56
|
|
|
@@ -103,12 +87,6 @@ module ArJdbc
|
|
|
103
87
|
ActiveRecord::Relation::QueryAttribute.new(nil, type_cast(value, column), ActiveModel::Type::Value.new)
|
|
104
88
|
end
|
|
105
89
|
end
|
|
106
|
-
|
|
107
|
-
def preprocess_query(sql)
|
|
108
|
-
check_if_write_query(sql) if respond_to?(:check_if_write_query, true)
|
|
109
|
-
mark_transaction_written_if_write(sql) if respond_to?(:mark_transaction_written_if_write, true)
|
|
110
|
-
sql
|
|
111
|
-
end
|
|
112
90
|
end
|
|
113
91
|
end
|
|
114
92
|
end
|
|
Binary file
|
data/lib/arjdbc/mssql/adapter.rb
CHANGED
data/lib/arjdbc/mssql/column.rb
CHANGED
|
@@ -6,12 +6,12 @@ module ActiveRecord
|
|
|
6
6
|
class MSSQLColumn < Column
|
|
7
7
|
attr_reader :table_name
|
|
8
8
|
|
|
9
|
-
def initialize(name, raw_default, sql_type_metadata = nil, null = true, table_name = nil, default_function = nil, collation = nil, comment: nil)
|
|
9
|
+
def initialize(name, cast_type, raw_default, sql_type_metadata = nil, null = true, table_name = nil, default_function = nil, collation = nil, comment: nil)
|
|
10
10
|
@table_name = table_name
|
|
11
11
|
|
|
12
12
|
default_val, default_fun = extract_default(raw_default)
|
|
13
13
|
|
|
14
|
-
super(name, default_val, sql_type_metadata, null, default_fun, collation: collation, comment: comment)
|
|
14
|
+
super(name, cast_type, default_val, sql_type_metadata, null, default_fun, collation: collation, comment: comment)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def extract_default(value)
|
|
@@ -92,12 +92,12 @@ module ActiveRecord
|
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
def internal_exec_query(sql, name = 'SQL', binds = [], prepare: false, async: false, allow_retry: false)
|
|
95
|
+
def internal_exec_query(sql, name = 'SQL', binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true)
|
|
96
96
|
sql = preprocess_query(sql)
|
|
97
97
|
|
|
98
98
|
# binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
|
|
99
99
|
|
|
100
|
-
# puts "[1]
|
|
100
|
+
# puts "[1]internal_exec_query----->sql: #{sql}, binds: #{binds}"
|
|
101
101
|
type_casted_binds = type_casted_binds(binds)
|
|
102
102
|
# puts "[2]internal----->sql: #{type_casted_binds.size}, binds: #{type_casted_binds}"
|
|
103
103
|
|
|
@@ -112,7 +112,7 @@ module ActiveRecord
|
|
|
112
112
|
end
|
|
113
113
|
end
|
|
114
114
|
else
|
|
115
|
-
log(sql, name, type_casted_binds) do
|
|
115
|
+
log(sql, name, binds, type_casted_binds, async: async) do
|
|
116
116
|
with_raw_connection do |conn|
|
|
117
117
|
# this is different from normal AR that always caches
|
|
118
118
|
cached_statement = fetch_cached_statement(sql) if prepare && @jdbc_statement_cache_enabled
|
|
@@ -144,7 +144,7 @@ module ActiveRecord
|
|
|
144
144
|
else
|
|
145
145
|
log(sql, name, binds, type_casted_binds) do
|
|
146
146
|
with_raw_connection do |conn|
|
|
147
|
-
result = conn.execute_prepared_update(sql,
|
|
147
|
+
result = conn.execute_prepared_update(sql, binds)
|
|
148
148
|
verified!
|
|
149
149
|
result
|
|
150
150
|
end
|
|
@@ -198,6 +198,7 @@ module ActiveRecord
|
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch:)
|
|
201
|
+
# puts "perform_query----->sql: #{sql}, binds: #{binds}"
|
|
201
202
|
result = conditional_indentity_insert(sql) { raw_connection.execute(sql) }
|
|
202
203
|
|
|
203
204
|
count = 0
|
|
@@ -55,7 +55,7 @@ module ActiveRecord
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def add_column_options!(sql, options)
|
|
58
|
-
sql << " DEFAULT #{
|
|
58
|
+
sql << " DEFAULT #{quote_default_expression_for_column_definition(options[:default], options[:column])}" if options_include_default?(options)
|
|
59
59
|
|
|
60
60
|
sql << ' NOT NULL' if options[:null] == false
|
|
61
61
|
|
|
@@ -419,6 +419,10 @@ module ActiveRecord
|
|
|
419
419
|
field
|
|
420
420
|
end
|
|
421
421
|
|
|
422
|
+
def fetch_type_metadata(sql_type)
|
|
423
|
+
MSSQL::TypeMetadata.new(super(sql_type))
|
|
424
|
+
end
|
|
425
|
+
|
|
422
426
|
def create_db_edition_options(options = {})
|
|
423
427
|
edition_config = options.select { |k, _v| k.match?('azure') }
|
|
424
428
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ActiveRecord
|
|
4
|
+
module ConnectionAdapters
|
|
5
|
+
module MSSQL
|
|
6
|
+
class TypeMetadata < DelegateClass(SqlTypeMetadata)
|
|
7
|
+
undef to_yaml if method_defined?(:to_yaml)
|
|
8
|
+
|
|
9
|
+
include Deduplicable
|
|
10
|
+
|
|
11
|
+
def initialize(type_metadata)
|
|
12
|
+
super(type_metadata)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def ==(other)
|
|
16
|
+
other.is_a?(TypeMetadata) &&
|
|
17
|
+
__getobj__ == other.__getobj__
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
alias eql? ==
|
|
21
|
+
|
|
22
|
+
def hash
|
|
23
|
+
TypeMetadata.hash ^
|
|
24
|
+
__getobj__.hash
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def deduplicated
|
|
30
|
+
__setobj__(__getobj__.deduplicate)
|
|
31
|
+
super
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -20,12 +20,13 @@ module ActiveRecord
|
|
|
20
20
|
|
|
21
21
|
# This is the Rails binary type
|
|
22
22
|
class VarbinaryMax < ActiveRecord::Type::Binary
|
|
23
|
-
def
|
|
24
|
-
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
25
|
+
@limit = 2_147_483_647
|
|
25
26
|
end
|
|
26
27
|
|
|
27
|
-
def
|
|
28
|
-
|
|
28
|
+
def type
|
|
29
|
+
:binary
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -7,32 +7,35 @@ module ActiveRecord
|
|
|
7
7
|
module Type
|
|
8
8
|
|
|
9
9
|
class Text < ActiveRecord::Type::String
|
|
10
|
-
def
|
|
11
|
-
|
|
10
|
+
def initialize(**args)
|
|
11
|
+
super
|
|
12
|
+
@limit = 2_147_483_647
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
def
|
|
15
|
-
|
|
15
|
+
def type
|
|
16
|
+
:text_basic
|
|
16
17
|
end
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
class Ntext < ActiveRecord::Type::String
|
|
20
|
-
def
|
|
21
|
-
|
|
21
|
+
def initialize(**args)
|
|
22
|
+
super
|
|
23
|
+
@limit = 2_147_483_647
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
def
|
|
25
|
-
|
|
26
|
+
def type
|
|
27
|
+
:ntext
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
class Image < ActiveRecord::Type::Binary
|
|
30
|
-
def
|
|
31
|
-
|
|
32
|
+
def initialize(**args)
|
|
33
|
+
super
|
|
34
|
+
@limit = 2_147_483_647
|
|
32
35
|
end
|
|
33
36
|
|
|
34
|
-
def
|
|
35
|
-
|
|
37
|
+
def type
|
|
38
|
+
:image
|
|
36
39
|
end
|
|
37
40
|
end
|
|
38
41
|
|
|
@@ -19,12 +19,13 @@ module ActiveRecord
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
class VarcharMax < ActiveRecord::Type::String
|
|
22
|
-
def
|
|
23
|
-
|
|
22
|
+
def initialize(**args)
|
|
23
|
+
super
|
|
24
|
+
@limit = 2_147_483_647
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
def
|
|
27
|
-
|
|
27
|
+
def type
|
|
28
|
+
:varchar_max
|
|
28
29
|
end
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -43,12 +44,13 @@ module ActiveRecord
|
|
|
43
44
|
|
|
44
45
|
# This is Rails logical text type
|
|
45
46
|
class NvarcharMax < ActiveRecord::Type::String
|
|
46
|
-
def
|
|
47
|
-
|
|
47
|
+
def initialize(**args)
|
|
48
|
+
super
|
|
49
|
+
@limit = 2_147_483_647
|
|
48
50
|
end
|
|
49
51
|
|
|
50
|
-
def
|
|
51
|
-
|
|
52
|
+
def type
|
|
53
|
+
:text
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
|
data/lib/arjdbc/mssql.rb
CHANGED
|
@@ -957,8 +957,6 @@ module ActiveRecord::ConnectionAdapters
|
|
|
957
957
|
FEATURE_NOT_SUPPORTED = "0A000" # :nodoc:
|
|
958
958
|
|
|
959
959
|
def execute_and_clear(sql, name, binds, prepare: false, async: false)
|
|
960
|
-
check_if_write_query(sql)
|
|
961
|
-
|
|
962
960
|
if !prepare || without_prepared_statement?(binds)
|
|
963
961
|
result = exec_no_cache(sql, name, binds, async: async)
|
|
964
962
|
else
|
|
@@ -975,7 +973,6 @@ module ActiveRecord::ConnectionAdapters
|
|
|
975
973
|
|
|
976
974
|
def exec_no_cache(sql, name, binds, async: false)
|
|
977
975
|
materialize_transactions
|
|
978
|
-
mark_transaction_written_if_write(sql)
|
|
979
976
|
|
|
980
977
|
# make sure we carry over any changes to ActiveRecord.default_timezone that have been
|
|
981
978
|
# made since we established the connection
|
|
@@ -993,7 +990,6 @@ module ActiveRecord::ConnectionAdapters
|
|
|
993
990
|
|
|
994
991
|
def exec_cache(sql, name, binds, async: false)
|
|
995
992
|
materialize_transactions
|
|
996
|
-
mark_transaction_written_if_write(sql)
|
|
997
993
|
update_typemap_for_default_timezone
|
|
998
994
|
|
|
999
995
|
stmt_key = prepare_statement(sql, binds)
|
|
@@ -21,15 +21,15 @@ module ArJdbc
|
|
|
21
21
|
def internal_exec_query(sql, name = nil, binds = [], prepare: false, async: false, allow_retry: false, materialize_transactions: true)
|
|
22
22
|
sql = preprocess_query(sql)
|
|
23
23
|
|
|
24
|
-
# puts "[1]
|
|
24
|
+
# puts "[1]internal_exec_query----->sql: #{sql}, binds: #{binds}"
|
|
25
25
|
type_casted_binds = type_casted_binds(binds)
|
|
26
|
-
# puts "[2]
|
|
26
|
+
# puts "[2]internal_exec_query----->sql: #{type_casted_binds.size}, binds: #{type_casted_binds}"
|
|
27
27
|
|
|
28
28
|
with_raw_connection do |conn|
|
|
29
29
|
if without_prepared_statement?(binds)
|
|
30
30
|
log(sql, name, async: async) { conn.execute_query(sql) }
|
|
31
31
|
else
|
|
32
|
-
log(sql, name, type_casted_binds, async: async) do
|
|
32
|
+
log(sql, name, binds, type_casted_binds, async: async) do
|
|
33
33
|
# this is different from normal AR that always caches
|
|
34
34
|
cached_statement = fetch_cached_statement(sql) if prepare && @jdbc_statement_cache_enabled
|
|
35
35
|
conn.execute_prepared_query(sql, type_casted_binds, cached_statement)
|
|
@@ -39,6 +39,7 @@ module ArJdbc
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notification_payload:, batch:)
|
|
42
|
+
# puts "perform_query----->sql: #{sql}, binds: #{binds}"
|
|
42
43
|
result = raw_connection.execute(sql)
|
|
43
44
|
|
|
44
45
|
count = 0
|
|
@@ -11,6 +11,13 @@ module ArJdbc
|
|
|
11
11
|
_arjdbc_array_parser.parse_pg_array(value)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
# Returns an array of the names of all schemas presently in the effective search path,
|
|
15
|
+
# in their priority order.
|
|
16
|
+
def current_schemas # :nodoc:
|
|
17
|
+
schemas = query_value("SELECT current_schemas(false)", "SCHEMA")
|
|
18
|
+
decode_string_array(schemas)
|
|
19
|
+
end
|
|
20
|
+
|
|
14
21
|
private
|
|
15
22
|
|
|
16
23
|
def _arjdbc_array_parser
|
|
@@ -4,7 +4,7 @@ require 'active_record/tasks/database_tasks'
|
|
|
4
4
|
|
|
5
5
|
module ArJdbc
|
|
6
6
|
module Tasks # :nodoc:
|
|
7
|
-
class MSSQLDatabaseTasks # :nodoc:
|
|
7
|
+
class MSSQLDatabaseTasks < ActiveRecord::Tasks::AbstractTasks # :nodoc:
|
|
8
8
|
def self.using_database_configurations?
|
|
9
9
|
true
|
|
10
10
|
end
|
|
@@ -127,25 +127,5 @@ module ArJdbc
|
|
|
127
127
|
msg
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
|
-
|
|
131
|
-
module DatabaseTasksMSSQL
|
|
132
|
-
extend ActiveSupport::Concern
|
|
133
|
-
|
|
134
|
-
module ClassMethods
|
|
135
|
-
|
|
136
|
-
def check_protected_environments!
|
|
137
|
-
super
|
|
138
|
-
rescue ActiveRecord::JDBCError => e
|
|
139
|
-
case e.message
|
|
140
|
-
when /cannot open database .* requested by the login/i
|
|
141
|
-
else
|
|
142
|
-
raise
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
ActiveRecord::Tasks::DatabaseTasks.send(:include, DatabaseTasksMSSQL)
|
|
150
130
|
end
|
|
151
131
|
end
|
data/lib/arjdbc/version.rb
CHANGED
|
@@ -3186,9 +3186,11 @@ public class RubyJdbcConnection extends RubyObject {
|
|
|
3186
3186
|
|
|
3187
3187
|
final IRubyObject type_metadata = adapter.callMethod(context, "fetch_type_metadata", sqlType);
|
|
3188
3188
|
|
|
3189
|
+
final IRubyObject cast_type = adapter.callMethod(context, "lookup_cast_type", sqlType);
|
|
3190
|
+
|
|
3189
3191
|
// (name, default, sql_type_metadata = nil, null = true, table_name = nil, default_function = nil, collation = nil, comment: nil)
|
|
3190
3192
|
final IRubyObject[] args = new IRubyObject[] {
|
|
3191
|
-
columnName, defaultValue, type_metadata, nullable, tableName
|
|
3193
|
+
columnName, cast_type, defaultValue, type_metadata, nullable, tableName
|
|
3192
3194
|
};
|
|
3193
3195
|
columns.append(context, Column.newInstance(context, args, Block.NULL_BLOCK));
|
|
3194
3196
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-jdbc-alt-adapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 80.
|
|
4
|
+
version: 80.1.0.rc1
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Sieger, Ola Bini, Karol Bucek, Jesse Chavez, and JRuby contributors
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 8.
|
|
18
|
+
version: 8.1.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 8.
|
|
25
|
+
version: 8.1.0
|
|
26
26
|
description: 'Fork of the ActiveRecord JDBC adapter with support for SQL Server and
|
|
27
27
|
Azure SQL, for more information and help look at the README file in the github repository.
|
|
28
28
|
AR-JDBC is a database adapter for Rails'' ActiveRecord component designed to be
|
|
@@ -124,6 +124,7 @@ files:
|
|
|
124
124
|
- lib/arjdbc/mssql/schema_statements.rb
|
|
125
125
|
- lib/arjdbc/mssql/server_version.rb
|
|
126
126
|
- lib/arjdbc/mssql/transaction.rb
|
|
127
|
+
- lib/arjdbc/mssql/type_metadata.rb
|
|
127
128
|
- lib/arjdbc/mssql/types.rb
|
|
128
129
|
- lib/arjdbc/mssql/types/binary_types.rb
|
|
129
130
|
- lib/arjdbc/mssql/types/date_and_time_types.rb
|