activerecord-sqlserver-adapter 7.0.7 → 7.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -2
- data/CHANGELOG.md +2 -94
- data/Gemfile +3 -0
- data/README.md +16 -11
- data/Rakefile +2 -6
- data/VERSION +1 -1
- data/activerecord-sqlserver-adapter.gemspec +1 -1
- data/lib/active_record/connection_adapters/sqlserver/core_ext/abstract_adapter.rb +20 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +42 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +4 -4
- data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +10 -2
- data/lib/active_record/connection_adapters/sqlserver/core_ext/preloader.rb +15 -3
- data/lib/active_record/connection_adapters/sqlserver/database_limits.rb +0 -31
- data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +87 -131
- data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +5 -5
- data/lib/active_record/connection_adapters/sqlserver/quoting.rb +3 -2
- data/lib/active_record/connection_adapters/sqlserver/savepoints.rb +24 -0
- data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +71 -58
- data/lib/active_record/connection_adapters/sqlserver/showplan.rb +3 -3
- data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +6 -0
- data/lib/active_record/connection_adapters/sqlserver/transaction.rb +4 -6
- data/lib/active_record/connection_adapters/sqlserver/type/data.rb +10 -0
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +81 -118
- data/lib/active_record/connection_adapters/sqlserver_column.rb +1 -0
- data/lib/active_record/sqlserver_base.rb +1 -10
- data/lib/active_record/tasks/sqlserver_database_tasks.rb +5 -2
- data/lib/arel/visitors/sqlserver.rb +0 -33
- data/test/cases/adapter_test_sqlserver.rb +8 -7
- data/test/cases/coerced_tests.rb +558 -248
- data/test/cases/column_test_sqlserver.rb +6 -6
- data/test/cases/connection_test_sqlserver.rb +3 -6
- data/test/cases/disconnected_test_sqlserver.rb +5 -8
- data/test/cases/execute_procedure_test_sqlserver.rb +1 -1
- data/test/cases/rake_test_sqlserver.rb +1 -1
- data/test/cases/schema_dumper_test_sqlserver.rb +2 -2
- data/test/cases/view_test_sqlserver.rb +6 -10
- data/test/config.yml +1 -2
- data/test/support/connection_reflection.rb +2 -8
- data/test/support/core_ext/query_cache.rb +7 -1
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_6_1_topic_associations.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_7_1_topic.dump +0 -0
- data/test/support/marshal_compatibility_fixtures/SQLServer/rails_7_1_topic_associations.dump +0 -0
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '009fdf722e06ca141f900257d1980016e76edc153d5af717d5f15ae6792ea4d4'
|
4
|
+
data.tar.gz: 292f605553c6bfbfc357efc6c9e26fca3be1414921d8a4b810ccd17ce46f4e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2c2363f6445554a6067f15ca1467130dfe4499513746e2a1d374c2e27635d68f0eb5c1682cc49621c101c31531723f66c5670e1d73d89b798cb6eda90d52f39
|
7
|
+
data.tar.gz: a788af6fbd28c02f0ab1e9d6283f4a11934f9bb702d93a7428d0d1e37aed4cb9e72f9fba4f4e21c18057b789204a9bfd0cc353b988f1751c8e65689ec8b4b686
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,101 +1,9 @@
|
|
1
|
-
## v7.0.
|
1
|
+
## v7.1.0.beta1
|
2
2
|
|
3
3
|
#### Changed
|
4
4
|
|
5
|
-
- [#1200](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1200) Remove ActiveRecord::Relation#calculate patch
|
6
|
-
|
7
|
-
## v7.0.6
|
8
|
-
|
9
|
-
#### Added
|
10
|
-
|
11
|
-
- [#1141](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1141) Added support for check constraints.
|
12
|
-
|
13
|
-
## v7.0.5.1
|
14
|
-
|
15
|
-
#### Fixed
|
16
|
-
|
17
|
-
- [#1133](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1133) Fix matching view's real column name
|
18
|
-
|
19
|
-
## v7.0.5.0
|
20
|
-
|
21
|
-
#### Fixed
|
22
|
-
|
23
|
-
- [#1113](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1113) Fix issue with default view value not being found because of case sensitivity
|
24
|
-
- [#1126](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1113) Fix view issue with default column value not found
|
25
|
-
|
26
|
-
## v7.0.4.0
|
27
|
-
|
28
|
-
#### Changed
|
29
|
-
|
30
|
-
- [#1073](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1073) Improve performance of view default function lookup
|
31
|
-
|
32
|
-
#### Fixed
|
33
|
-
|
34
|
-
- [#1088](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1088) Fix creation of stored procedures that contain insert statements
|
35
|
-
- [#1089](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1089) When changing columns set date-time columns to datetime(6) by default
|
36
|
-
|
37
|
-
## v7.0.3.0
|
38
|
-
|
39
|
-
#### Fixed
|
40
|
-
|
41
|
-
- [#1052](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1052) Ignore casing of VALUES clause when inserting records using SQL
|
42
|
-
- [#1053](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1053) Fix insertion of records to non-default schema table using raw SQL
|
43
|
-
- [#1059](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1059) Fix enums defined on string columns
|
44
|
-
|
45
|
-
#### Changed
|
46
|
-
|
47
|
-
- [#1057](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1057) Set precision 6 by default for timestamps.
|
48
|
-
|
49
|
-
## v7.0.2.0
|
50
|
-
|
51
|
-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/v7.0.1.0...v7.0.2.0)
|
52
|
-
|
53
|
-
#### Fixed
|
54
|
-
|
55
|
-
- [#1049](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1049) Fix for inserting records into non-dbo schema table.
|
56
|
-
|
57
|
-
## v7.0.1.0
|
58
|
-
|
59
|
-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/v7.0.0.0...v7.0.1.0)
|
60
|
-
|
61
|
-
#### Fixed
|
62
|
-
|
63
|
-
- [#1029](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1029) Handle views defined in other databases.
|
64
|
-
- [#1033](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1033) Support proc default values in ruby 3.2.
|
65
|
-
- [#1020](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1020) Support using adapter as a stand-alone gem.
|
66
|
-
- [#1039](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1039) Fix hook method that allows custom connection configuration.
|
67
|
-
|
68
|
-
#### Changed
|
69
|
-
|
70
|
-
- [#1021](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1021) Freeze the SQL sent to instrumentation.
|
71
|
-
|
72
|
-
## v7.0.0.0
|
73
|
-
|
74
|
-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/v7.0.0.0.rc1...v7.0.0.0)
|
75
|
-
|
76
5
|
#### Fixed
|
77
6
|
|
78
|
-
- [#1002](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1002) Fix support for index types
|
79
|
-
|
80
|
-
#### Changed
|
81
|
-
|
82
|
-
- [#1004](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1004) Dump the precision for datetime columns following the new defaults.
|
83
|
-
|
84
|
-
## v7.0.0.0.rc1
|
85
|
-
|
86
|
-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/6-1-stable...v7.0.0.0.rc1)
|
87
|
-
|
88
|
-
#### Changed
|
89
|
-
|
90
|
-
- [#968](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/968) Define adapter type maps statically
|
91
|
-
- [#983](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/983) Optimize remove_columns to use a single SQL statement
|
92
|
-
- [#984](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/984) Better handle SQL queries with invalid encoding
|
93
|
-
- [#988](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/988) Raise `ActiveRecord::StatementInvalid` when `columns` is called with a non-existing table (***breaking change***)
|
94
|
-
|
95
7
|
#### Added
|
96
8
|
|
97
|
-
|
98
|
-
- [#981](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/981) Support `find_by` an encrypted attribute
|
99
|
-
- [#985](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/985) Support string returning clause for `ActiveRecord#insert_all`
|
100
|
-
|
101
|
-
Please check [6-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/6-1-stable/CHANGELOG.md) for previous changes.
|
9
|
+
Please check [7-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/7-0-stable/CHANGELOG.md) for previous changes.
|
data/Gemfile
CHANGED
@@ -12,9 +12,12 @@ gem "sqlite3", "~> 1.4"
|
|
12
12
|
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
13
13
|
gem "benchmark-ips"
|
14
14
|
gem "minitest", ">= 5.15.0", "< 5.16"
|
15
|
+
gem "msgpack", ">= 1.7.0"
|
15
16
|
|
16
17
|
if ENV["RAILS_SOURCE"]
|
17
18
|
gemspec path: ENV["RAILS_SOURCE"]
|
19
|
+
elsif ENV["RAILS_MAIN"]
|
20
|
+
gem "rails", github: "rails/rails", branch: 'main'
|
18
21
|
else
|
19
22
|
# Need to get rails source because the gem doesn't include tests
|
20
23
|
version = ENV["RAILS_VERSION"] || begin
|
data/README.md
CHANGED
@@ -11,15 +11,16 @@ The SQL Server adapter for ActiveRecord using SQL Server 2012 or higher.
|
|
11
11
|
|
12
12
|
Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 7.x version of the adapter is only for the latest 7.x version of Rails. If you need the adapter for SQL Server 2008 or 2005, you are still in the right spot. Just install the latest 3.2.x to 4.1.x version of the adapter that matches your Rails version. We also have stable branches for each major/minor release of ActiveRecord.
|
13
13
|
|
14
|
-
| Adapter Version | Rails Version | Support
|
15
|
-
|
16
|
-
| `
|
17
|
-
| `
|
18
|
-
| `6.
|
19
|
-
| `
|
20
|
-
| `5.1
|
21
|
-
| `
|
22
|
-
| `4.
|
14
|
+
| Adapter Version | Rails Version | Support | Branch |
|
15
|
+
|-----------------|---------------|----------------|-------------------------------------------------------------------------------------------------|
|
16
|
+
| `v7.1.0.beta1` | `7.1.0` | In development | [main](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/main) |
|
17
|
+
| `7.0.4.0` | `7.0.x` | Active | [7-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/7-0-stable) |
|
18
|
+
| `6.1.2.1` | `6.1.x` | Active | [6-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-1-stable) |
|
19
|
+
| `6.0.3` | `6.0.x` | Active | [6-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-0-stable) |
|
20
|
+
| `5.2.1` | `5.2.x` | Ended | [5-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-2-stable) |
|
21
|
+
| `5.1.6` | `5.1.x` | Ended | [5-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-1-stable) |
|
22
|
+
| `4.2.18` | `4.2.x` | Ended | [4-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-2-stable) |
|
23
|
+
| `4.1.8` | `4.1.x` | Ended | [4-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/4-1-stable) |
|
23
24
|
|
24
25
|
For older versions, please check their stable branches.
|
25
26
|
|
@@ -89,13 +90,16 @@ end
|
|
89
90
|
|
90
91
|
#### Configure Connection
|
91
92
|
|
92
|
-
|
93
|
+
The adapter conforms to the AbstractAdapter interface to configure connections. If you require additional connection
|
94
|
+
configuration then implement the `configure_connection` method in an initializer like so. In the following
|
95
|
+
example we are setting the `TEXTSIZE` to 64 megabytes.
|
93
96
|
|
94
97
|
```ruby
|
95
98
|
module ActiveRecord
|
96
99
|
module ConnectionAdapters
|
97
100
|
class SQLServerAdapter < AbstractAdapter
|
98
101
|
def configure_connection
|
102
|
+
super
|
99
103
|
raw_connection_do "SET TEXTSIZE #{64.megabytes}"
|
100
104
|
end
|
101
105
|
end
|
@@ -170,7 +174,8 @@ To then connect the application to your SQL Server instance edit the `config/dat
|
|
170
174
|
|
171
175
|
## Installation
|
172
176
|
|
173
|
-
The adapter has no strict gem dependencies outside of `ActiveRecord
|
177
|
+
The adapter has no strict gem dependencies outside of `ActiveRecord` and
|
178
|
+
[TinyTDS](https://github.com/rails-sqlserver/tiny_tds).
|
174
179
|
|
175
180
|
```ruby
|
176
181
|
gem 'activerecord-sqlserver-adapter'
|
data/Rakefile
CHANGED
@@ -9,6 +9,8 @@ task test: ["test:dblib"]
|
|
9
9
|
task default: [:test]
|
10
10
|
|
11
11
|
namespace :test do
|
12
|
+
ENV["ARCONN"] = "sqlserver"
|
13
|
+
|
12
14
|
%w(dblib).each do |mode|
|
13
15
|
Rake::TestTask.new(mode) do |t|
|
14
16
|
t.libs = ARTest::SQLServer.test_load_paths
|
@@ -17,14 +19,8 @@ namespace :test do
|
|
17
19
|
t.verbose = false
|
18
20
|
end
|
19
21
|
end
|
20
|
-
|
21
|
-
task "dblib:env" do
|
22
|
-
ENV["ARCONN"] = "dblib"
|
23
|
-
end
|
24
22
|
end
|
25
23
|
|
26
|
-
task "test:dblib" => "test:dblib:env"
|
27
|
-
|
28
24
|
namespace :profile do
|
29
25
|
["dblib"].each do |mode|
|
30
26
|
namespace mode.to_sym do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.0.
|
1
|
+
7.1.0.beta1
|
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_dependency "activerecord", "~> 7.
|
30
|
+
spec.add_dependency "activerecord", "~> 7.1.1"
|
31
31
|
spec.add_dependency "tiny_tds"
|
32
32
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
module SQLServer
|
6
|
+
module CoreExt
|
7
|
+
module AbstractAdapter
|
8
|
+
def sqlserver?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
ActiveSupport.on_load(:active_record) do
|
18
|
+
mod = ActiveRecord::ConnectionAdapters::SQLServer::CoreExt::AbstractAdapter
|
19
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(mod)
|
20
|
+
end
|
@@ -8,9 +8,51 @@ module ActiveRecord
|
|
8
8
|
module SQLServer
|
9
9
|
module CoreExt
|
10
10
|
module Calculations
|
11
|
+
def calculate(operation, column_name)
|
12
|
+
if klass.connection.sqlserver?
|
13
|
+
_calculate(operation, column_name)
|
14
|
+
else
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
11
18
|
|
12
19
|
private
|
13
20
|
|
21
|
+
# Same as original `calculate` method except we don't perform PostgreSQL hack that removes ordering.
|
22
|
+
def _calculate(operation, column_name)
|
23
|
+
operation = operation.to_s.downcase
|
24
|
+
|
25
|
+
if @none
|
26
|
+
case operation
|
27
|
+
when "count", "sum"
|
28
|
+
result = group_values.any? ? Hash.new : 0
|
29
|
+
return @async ? Promise::Complete.new(result) : result
|
30
|
+
when "average", "minimum", "maximum"
|
31
|
+
result = group_values.any? ? Hash.new : nil
|
32
|
+
return @async ? Promise::Complete.new(result) : result
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
if has_include?(column_name)
|
37
|
+
relation = apply_join_dependency
|
38
|
+
|
39
|
+
if operation == "count"
|
40
|
+
unless distinct_value || distinct_select?(column_name || select_for_count)
|
41
|
+
relation.distinct!
|
42
|
+
relation.select_values = [ klass.primary_key || table[Arel.star] ]
|
43
|
+
end
|
44
|
+
# PostgreSQL: ORDER BY expressions must appear in SELECT list when using DISTINCT
|
45
|
+
# Start of monkey-patch
|
46
|
+
# relation.order_values = [] if group_values.empty?
|
47
|
+
# End of monkey-patch
|
48
|
+
end
|
49
|
+
|
50
|
+
relation.calculate(operation, column_name)
|
51
|
+
else
|
52
|
+
perform_calculation(operation, column_name)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
14
56
|
def build_count_subquery(relation, column_name, distinct)
|
15
57
|
return super unless klass.connection.adapter_name == "SQLServer"
|
16
58
|
|
@@ -8,20 +8,20 @@ module ActiveRecord
|
|
8
8
|
SQLSERVER_STATEMENT_PREFIX = "EXEC sp_executesql "
|
9
9
|
SQLSERVER_STATEMENT_REGEXP = /N'(.+)', N'(.+)', (.+)/
|
10
10
|
|
11
|
-
def exec_explain(queries)
|
11
|
+
def exec_explain(queries, options = [])
|
12
12
|
return super unless connection.adapter_name == "SQLServer"
|
13
13
|
|
14
14
|
unprepared_queries = queries.map do |(sql, binds)|
|
15
15
|
[unprepare_sqlserver_statement(sql, binds), binds]
|
16
16
|
end
|
17
|
-
super(unprepared_queries)
|
17
|
+
super(unprepared_queries, options)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
# This is somewhat hacky, but it should reliably reformat our prepared sql
|
22
|
+
# This is somewhat hacky, but it should reliably reformat our prepared sql statement
|
23
23
|
# which uses sp_executesql to just the first argument, then unquote it. Likewise our
|
24
|
-
# `sp_executesql` method should
|
24
|
+
# `sp_executesql` method should substitute the @n args with the quoted values.
|
25
25
|
def unprepare_sqlserver_statement(sql, binds)
|
26
26
|
return sql unless sql.start_with?(SQLSERVER_STATEMENT_PREFIX)
|
27
27
|
|
@@ -10,18 +10,26 @@ module ActiveRecord
|
|
10
10
|
module FinderMethods
|
11
11
|
private
|
12
12
|
|
13
|
-
# Same as original except we order by values in distinct select if present.
|
14
13
|
def construct_relation_for_exists(conditions)
|
15
|
-
|
14
|
+
if klass.connection.sqlserver?
|
15
|
+
_construct_relation_for_exists(conditions)
|
16
|
+
else
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
16
20
|
|
21
|
+
# Same as original except we order by values in distinct select if present.
|
22
|
+
def _construct_relation_for_exists(conditions)
|
17
23
|
conditions = sanitize_forbidden_attributes(conditions)
|
18
24
|
|
19
25
|
if distinct_value && offset_value
|
26
|
+
# Start of monkey-patch
|
20
27
|
if select_values.present?
|
21
28
|
relation = order(*select_values).limit!(1)
|
22
29
|
else
|
23
30
|
relation = except(:order).limit!(1)
|
24
31
|
end
|
32
|
+
# End of monkey-patch
|
25
33
|
else
|
26
34
|
relation = except(:select, :distinct, :order)._select!(::ActiveRecord::FinderMethods::ONE_AS_ONE).limit!(1)
|
27
35
|
end
|
@@ -8,10 +8,22 @@ module ActiveRecord
|
|
8
8
|
module CoreExt
|
9
9
|
module LoaderQuery
|
10
10
|
def load_records_for_keys(keys, &block)
|
11
|
-
return super unless scope.connection.
|
11
|
+
return super unless scope.connection.sqlserver?
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
if association_key_name.is_a?(Array)
|
14
|
+
query_constraints = Hash.new { |hsh, key| hsh[key] = Set.new }
|
15
|
+
|
16
|
+
keys.each_with_object(query_constraints) do |values_set, constraints|
|
17
|
+
association_key_name.zip(values_set).each do |key_name, value|
|
18
|
+
constraints[key_name] << value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
scope.where(query_constraints).load(&block)
|
23
|
+
else
|
24
|
+
keys.each_slice(in_clause_length).flat_map do |slice|
|
25
|
+
scope.where(association_key_name => slice).load(&block).records
|
26
|
+
end
|
15
27
|
end
|
16
28
|
end
|
17
29
|
|
@@ -8,45 +8,14 @@ module ActiveRecord
|
|
8
8
|
128
|
9
9
|
end
|
10
10
|
|
11
|
-
def column_name_length
|
12
|
-
128
|
13
|
-
end
|
14
|
-
deprecate :column_name_length
|
15
|
-
|
16
11
|
def table_name_length
|
17
12
|
128
|
18
13
|
end
|
19
|
-
deprecate :table_name_length
|
20
14
|
|
21
15
|
def index_name_length
|
22
16
|
128
|
23
17
|
end
|
24
18
|
|
25
|
-
def columns_per_table
|
26
|
-
1024
|
27
|
-
end
|
28
|
-
deprecate :columns_per_table
|
29
|
-
|
30
|
-
def indexes_per_table
|
31
|
-
999
|
32
|
-
end
|
33
|
-
deprecate :indexes_per_table
|
34
|
-
|
35
|
-
def columns_per_multicolumn_index
|
36
|
-
16
|
37
|
-
end
|
38
|
-
deprecate :columns_per_multicolumn_index
|
39
|
-
|
40
|
-
def sql_query_length
|
41
|
-
65_536 * 4_096
|
42
|
-
end
|
43
|
-
deprecate :sql_query_length
|
44
|
-
|
45
|
-
def joins_per_query
|
46
|
-
256
|
47
|
-
end
|
48
|
-
deprecate :joins_per_query
|
49
|
-
|
50
19
|
private
|
51
20
|
|
52
21
|
# The max number of binds is 2100, but because sp_executesql takes
|