activerecord-sqlserver-adapter 6.0.0.rc1 → 6.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +29 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile +11 -5
- data/Guardfile +9 -8
- data/Rakefile +12 -16
- data/VERSION +1 -1
- data/activerecord-sqlserver-adapter.gemspec +3 -3
- data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +0 -4
- data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +1 -4
- data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +3 -4
- data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +1 -3
- data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +2 -3
- data/lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb +2 -3
- data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +35 -32
- data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +7 -12
- data/lib/active_record/connection_adapters/sqlserver/errors.rb +0 -3
- data/lib/active_record/connection_adapters/sqlserver/quoting.rb +8 -8
- data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +7 -7
- data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +106 -103
- data/lib/active_record/connection_adapters/sqlserver/showplan.rb +6 -8
- data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +2 -2
- data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +1 -1
- data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +1 -4
- data/lib/active_record/connection_adapters/sqlserver/transaction.rb +4 -8
- data/lib/active_record/connection_adapters/sqlserver/type.rb +35 -35
- data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/char.rb +2 -2
- data/lib/active_record/connection_adapters/sqlserver/type/data.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/date.rb +2 -3
- data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +2 -3
- data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/float.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/json.rb +0 -1
- data/lib/active_record/connection_adapters/sqlserver/type/money.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/real.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/string.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/text.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/time.rb +2 -3
- data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +6 -9
- data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +1 -3
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +1 -2
- data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +1 -3
- data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +1 -3
- data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver/utils.rb +8 -11
- data/lib/active_record/connection_adapters/sqlserver/version.rb +0 -2
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +85 -83
- data/lib/active_record/connection_adapters/sqlserver_column.rb +0 -2
- data/lib/active_record/sqlserver_base.rb +1 -1
- data/lib/active_record/tasks/sqlserver_database_tasks.rb +26 -32
- data/lib/activerecord-sqlserver-adapter.rb +1 -1
- data/lib/arel/visitors/sqlserver.rb +18 -14
- data/lib/arel_sqlserver.rb +2 -2
- data/test/cases/adapter_test_sqlserver.rb +161 -182
- data/test/cases/change_column_null_test_sqlserver.rb +12 -12
- data/test/cases/coerced_tests.rb +88 -270
- data/test/cases/column_test_sqlserver.rb +281 -283
- data/test/cases/connection_test_sqlserver.rb +15 -20
- data/test/cases/execute_procedure_test_sqlserver.rb +18 -20
- data/test/cases/fetch_test_sqlserver.rb +14 -22
- data/test/cases/fully_qualified_identifier_test_sqlserver.rb +12 -18
- data/test/cases/helper_sqlserver.rb +13 -15
- data/test/cases/in_clause_test_sqlserver.rb +9 -9
- data/test/cases/index_test_sqlserver.rb +13 -15
- data/test/cases/json_test_sqlserver.rb +23 -25
- data/test/cases/migration_test_sqlserver.rb +22 -28
- data/test/cases/order_test_sqlserver.rb +51 -54
- data/test/cases/pessimistic_locking_test_sqlserver.rb +25 -33
- data/test/cases/rake_test_sqlserver.rb +31 -45
- data/test/cases/schema_dumper_test_sqlserver.rb +104 -108
- data/test/cases/schema_test_sqlserver.rb +18 -26
- data/test/cases/scratchpad_test_sqlserver.rb +2 -4
- data/test/cases/showplan_test_sqlserver.rb +24 -33
- data/test/cases/specific_schema_test_sqlserver.rb +66 -65
- data/test/cases/transaction_test_sqlserver.rb +16 -19
- data/test/cases/trigger_test_sqlserver.rb +12 -12
- data/test/cases/utils_test_sqlserver.rb +68 -70
- data/test/cases/uuid_test_sqlserver.rb +11 -13
- data/test/debug.rb +6 -6
- data/test/migrations/create_clients_and_change_column_null.rb +1 -1
- data/test/migrations/transaction_table/1_table_will_never_be_created.rb +2 -4
- data/test/models/sqlserver/booking.rb +1 -1
- data/test/models/sqlserver/customers_view.rb +1 -1
- data/test/models/sqlserver/dollar_table_name.rb +1 -1
- data/test/models/sqlserver/edge_schema.rb +1 -3
- data/test/models/sqlserver/fk_has_fk.rb +1 -1
- data/test/models/sqlserver/fk_has_pk.rb +1 -1
- data/test/models/sqlserver/natural_pk_data.rb +2 -2
- data/test/models/sqlserver/natural_pk_int_data.rb +1 -1
- data/test/models/sqlserver/no_pk_data.rb +1 -1
- data/test/models/sqlserver/object_default.rb +1 -1
- data/test/models/sqlserver/quoted_table.rb +2 -2
- data/test/models/sqlserver/quoted_view_1.rb +1 -1
- data/test/models/sqlserver/quoted_view_2.rb +1 -1
- data/test/models/sqlserver/sst_memory.rb +1 -1
- data/test/models/sqlserver/string_default.rb +1 -1
- data/test/models/sqlserver/string_defaults_big_view.rb +1 -1
- data/test/models/sqlserver/string_defaults_view.rb +1 -1
- data/test/models/sqlserver/tinyint_pk.rb +1 -1
- data/test/models/sqlserver/trigger.rb +2 -2
- data/test/models/sqlserver/trigger_history.rb +1 -1
- data/test/models/sqlserver/upper.rb +1 -1
- data/test/models/sqlserver/uppered.rb +1 -1
- data/test/models/sqlserver/uuid.rb +1 -1
- data/test/schema/sqlserver_specific_schema.rb +20 -22
- data/test/support/coerceable_test_sqlserver.rb +1 -4
- data/test/support/connection_reflection.rb +1 -2
- data/test/support/core_ext/query_cache.rb +1 -1
- data/test/support/load_schema_sqlserver.rb +3 -5
- data/test/support/minitest_sqlserver.rb +1 -1
- data/test/support/paths_sqlserver.rb +9 -11
- data/test/support/rake_helpers.rb +12 -10
- data/test/support/sql_counter_sqlserver.rb +0 -4
- data/test/support/test_in_memory_oltp.rb +7 -7
- metadata +5 -4
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class SSTestTrigger < ActiveRecord::Base
|
4
|
-
self.table_name =
|
4
|
+
self.table_name = "sst_table_with_trigger"
|
5
5
|
end
|
6
6
|
|
7
7
|
class SSTestTriggerUuid < ActiveRecord::Base
|
8
|
-
self.table_name =
|
8
|
+
self.table_name = "sst_table_with_uuid_trigger"
|
9
9
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
ActiveRecord::Schema.define do
|
4
|
-
|
5
4
|
# Exhaustive Data Types
|
6
5
|
|
7
6
|
execute File.read(ARTest::SQLServer.schema_datatypes_2012_file)
|
@@ -45,28 +44,28 @@ ActiveRecord::Schema.define do
|
|
45
44
|
|
46
45
|
# Edge Cases
|
47
46
|
|
48
|
-
if ENV[
|
49
|
-
create_table
|
50
|
-
|
47
|
+
if ENV["IN_MEMORY_OLTP"] && supports_in_memory_oltp?
|
48
|
+
create_table "sst_memory", force: true, id: false,
|
49
|
+
options: "WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA)" do |t|
|
51
50
|
t.primary_key_nonclustered :id
|
52
51
|
t.string :name
|
53
52
|
t.timestamps
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
create_table
|
56
|
+
create_table "sst_bookings", force: true do |t|
|
58
57
|
t.string :name
|
59
58
|
t.datetime2 :created_at, null: false
|
60
59
|
t.datetime2 :updated_at, null: false
|
61
60
|
end
|
62
61
|
|
63
|
-
create_table
|
62
|
+
create_table "sst_uuids", force: true, id: :uuid do |t|
|
64
63
|
t.string :name
|
65
|
-
t.uuid :other_uuid, default:
|
64
|
+
t.uuid :other_uuid, default: "NEWID()"
|
66
65
|
t.uuid :uuid_nil_default, default: nil
|
67
66
|
end
|
68
67
|
|
69
|
-
create_table
|
68
|
+
create_table "sst_my$strange_table", force: true do |t|
|
70
69
|
t.string :name
|
71
70
|
end
|
72
71
|
|
@@ -79,27 +78,27 @@ ActiveRecord::Schema.define do
|
|
79
78
|
t.string :name
|
80
79
|
end
|
81
80
|
|
82
|
-
create_table
|
81
|
+
create_table "sst_quoted-table", force: true do |t|
|
83
82
|
end
|
84
83
|
execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'sst_quoted-view1') DROP VIEW [sst_quoted-view1]"
|
85
84
|
execute "CREATE VIEW [sst_quoted-view1] AS SELECT * FROM [sst_quoted-table]"
|
86
85
|
execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'sst_quoted-view2') DROP VIEW [sst_quoted-view2]"
|
87
|
-
execute "CREATE VIEW [sst_quoted-view2] AS \n /*#{'x'*4000}}*/ \n SELECT * FROM [sst_quoted-table]"
|
86
|
+
execute "CREATE VIEW [sst_quoted-view2] AS \n /*#{'x' * 4000}}*/ \n SELECT * FROM [sst_quoted-table]"
|
88
87
|
|
89
88
|
create_table :sst_string_defaults, force: true do |t|
|
90
89
|
t.column :string_with_null_default, :string, default: nil
|
91
|
-
t.column :string_with_pretend_null_one, :string, default:
|
92
|
-
t.column :string_with_pretend_null_two, :string, default:
|
93
|
-
t.column :string_with_pretend_null_three, :string, default:
|
94
|
-
t.column :string_with_pretend_null_four, :string, default:
|
95
|
-
t.column :string_with_pretend_paren_three, :string, default:
|
90
|
+
t.column :string_with_pretend_null_one, :string, default: "null"
|
91
|
+
t.column :string_with_pretend_null_two, :string, default: "(null)"
|
92
|
+
t.column :string_with_pretend_null_three, :string, default: "NULL"
|
93
|
+
t.column :string_with_pretend_null_four, :string, default: "(NULL)"
|
94
|
+
t.column :string_with_pretend_paren_three, :string, default: "(3)"
|
96
95
|
t.column :string_with_multiline_default, :string, default: "Some long default with a\nnew line."
|
97
96
|
end
|
98
97
|
|
99
98
|
create_table :sst_edge_schemas, force: true do |t|
|
100
99
|
t.string :description
|
101
|
-
t.column
|
102
|
-
t.column
|
100
|
+
t.column "crazy]]quote", :string
|
101
|
+
t.column "with spaces", :string
|
103
102
|
end
|
104
103
|
|
105
104
|
execute "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sst_natural_pk_data') DROP TABLE sst_natural_pk_data"
|
@@ -132,7 +131,7 @@ ActiveRecord::Schema.define do
|
|
132
131
|
|
133
132
|
execute "DROP DEFAULT [sst_getdateobject];" rescue nil
|
134
133
|
execute "CREATE DEFAULT [sst_getdateobject] AS getdate();" rescue nil
|
135
|
-
create_table
|
134
|
+
create_table "sst_defaultobjects", force: true do |t|
|
136
135
|
t.string :name
|
137
136
|
t.date :date
|
138
137
|
end
|
@@ -151,7 +150,7 @@ ActiveRecord::Schema.define do
|
|
151
150
|
t.column(:fk_id2, :bigint)
|
152
151
|
end
|
153
152
|
|
154
|
-
create_table(:sst_has_pks, force: true) {
|
153
|
+
create_table(:sst_has_pks, force: true) {}
|
155
154
|
execute <<-ADDFKSQL
|
156
155
|
ALTER TABLE sst_has_fks
|
157
156
|
ADD CONSTRAINT FK__sst_has_fks_id
|
@@ -183,7 +182,7 @@ ActiveRecord::Schema.define do
|
|
183
182
|
execute <<-STRINGDEFAULTSBIGVIEW
|
184
183
|
CREATE VIEW sst_string_defaults_big_view AS
|
185
184
|
SELECT id, string_with_pretend_null_one as pretend_null
|
186
|
-
/*#{'x'*4000}}*/
|
185
|
+
/*#{'x' * 4000}}*/
|
187
186
|
FROM sst_string_defaults
|
188
187
|
STRINGDEFAULTSBIGVIEW
|
189
188
|
|
@@ -228,7 +227,7 @@ ActiveRecord::Schema.define do
|
|
228
227
|
# Another schema.
|
229
228
|
|
230
229
|
create_table :sst_schema_columns, force: true do |t|
|
231
|
-
t.column :field1
|
230
|
+
t.column :field1, :integer
|
232
231
|
end
|
233
232
|
|
234
233
|
execute "IF NOT EXISTS(SELECT * FROM sys.schemas WHERE name = 'test') EXEC sp_executesql N'CREATE SCHEMA test'"
|
@@ -278,5 +277,4 @@ ActiveRecord::Schema.define do
|
|
278
277
|
field_2 int NOT NULL PRIMARY KEY,
|
279
278
|
)
|
280
279
|
SCHEMATESTMULTIPLESCHEMA
|
281
|
-
|
282
280
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module ARTest
|
4
4
|
module SQLServer
|
5
5
|
module CoerceableTest
|
6
|
-
|
7
6
|
extend ActiveSupport::Concern
|
8
7
|
|
9
8
|
included do
|
@@ -12,7 +11,6 @@ module ARTest
|
|
12
11
|
end
|
13
12
|
|
14
13
|
module ClassMethods
|
15
|
-
|
16
14
|
def coerce_tests!(*methods)
|
17
15
|
methods.each do |method|
|
18
16
|
self.coerced_tests.push(method)
|
@@ -23,6 +21,7 @@ module ARTest
|
|
23
21
|
def coerce_all_tests!
|
24
22
|
instance_methods(false).each do |method|
|
25
23
|
next unless method.to_s =~ /\Atest/
|
24
|
+
|
26
25
|
undef_method(method)
|
27
26
|
end
|
28
27
|
STDOUT.puts "🙉 🙈 🙊 Undefined all tests: #{self.name}"
|
@@ -50,9 +49,7 @@ module ARTest
|
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
53
|
-
|
54
52
|
end
|
55
|
-
|
56
53
|
end
|
57
54
|
end
|
58
55
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module ARTest
|
4
4
|
module SQLServer
|
5
5
|
module ConnectionReflection
|
6
|
-
|
7
6
|
extend ActiveSupport::Concern
|
8
7
|
|
9
8
|
included { extend ConnectionReflection }
|
@@ -22,6 +21,7 @@ module ARTest
|
|
22
21
|
|
23
22
|
def connection_dblib_73?
|
24
23
|
return false unless connection_dblib?
|
24
|
+
|
25
25
|
rc = connection.raw_connection
|
26
26
|
rc.respond_to?(:tds_73?) && rc.tds_73?
|
27
27
|
end
|
@@ -29,7 +29,6 @@ module ARTest
|
|
29
29
|
def connection_sqlserver_azure?
|
30
30
|
connection.sqlserver_azure?
|
31
31
|
end
|
32
|
-
|
33
32
|
end
|
34
33
|
end
|
35
34
|
end
|
@@ -2,19 +2,18 @@
|
|
2
2
|
|
3
3
|
module ARTest
|
4
4
|
module SQLServer
|
5
|
-
|
6
5
|
extend self
|
7
6
|
|
8
7
|
def schema_root
|
9
|
-
File.join ARTest::SQLServer.test_root_sqlserver,
|
8
|
+
File.join ARTest::SQLServer.test_root_sqlserver, "schema"
|
10
9
|
end
|
11
10
|
|
12
11
|
def schema_file
|
13
|
-
File.join schema_root,
|
12
|
+
File.join schema_root, "sqlserver_specific_schema.rb"
|
14
13
|
end
|
15
14
|
|
16
15
|
def schema_datatypes_2012_file
|
17
|
-
File.join schema_root,
|
16
|
+
File.join schema_root, "datatypes", "2012.sql"
|
18
17
|
end
|
19
18
|
|
20
19
|
def load_schema
|
@@ -24,7 +23,6 @@ module ARTest
|
|
24
23
|
ensure
|
25
24
|
$stdout = original_stdout
|
26
25
|
end
|
27
|
-
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
@@ -2,31 +2,30 @@
|
|
2
2
|
|
3
3
|
module ARTest
|
4
4
|
module SQLServer
|
5
|
-
|
6
5
|
extend self
|
7
6
|
|
8
7
|
def root_sqlserver
|
9
|
-
File.expand_path File.join(File.dirname(__FILE__),
|
8
|
+
File.expand_path File.join(File.dirname(__FILE__), "..", "..")
|
10
9
|
end
|
11
10
|
|
12
11
|
def test_root_sqlserver
|
13
|
-
File.join root_sqlserver,
|
12
|
+
File.join root_sqlserver, "test"
|
14
13
|
end
|
15
14
|
|
16
15
|
def root_activerecord
|
17
|
-
File.join Gem.loaded_specs[
|
16
|
+
File.join Gem.loaded_specs["rails"].full_gem_path, "activerecord"
|
18
17
|
end
|
19
18
|
|
20
19
|
def root_activerecord_lib
|
21
|
-
File.join root_activerecord,
|
20
|
+
File.join root_activerecord, "lib"
|
22
21
|
end
|
23
22
|
|
24
23
|
def root_activerecord_test
|
25
|
-
File.join root_activerecord,
|
24
|
+
File.join root_activerecord, "test"
|
26
25
|
end
|
27
26
|
|
28
27
|
def test_load_paths
|
29
|
-
[
|
28
|
+
["lib", "test", root_activerecord_lib, root_activerecord_test]
|
30
29
|
end
|
31
30
|
|
32
31
|
def add_to_load_paths!
|
@@ -34,17 +33,16 @@ module ARTest
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def migrations_root
|
37
|
-
File.join test_root_sqlserver,
|
36
|
+
File.join test_root_sqlserver, "migrations"
|
38
37
|
end
|
39
38
|
|
40
39
|
def arconfig_file
|
41
|
-
File.join test_root_sqlserver,
|
40
|
+
File.join test_root_sqlserver, "config.yml"
|
42
41
|
end
|
43
42
|
|
44
43
|
def arconfig_file_env!
|
45
|
-
ENV[
|
44
|
+
ENV["ARCONFIG"] = arconfig_file
|
46
45
|
end
|
47
|
-
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -1,29 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
SQLSERVER_HELPER =
|
4
|
-
SQLSERVER_COERCED =
|
3
|
+
SQLSERVER_HELPER = "test/cases/helper_sqlserver.rb"
|
4
|
+
SQLSERVER_COERCED = "test/cases/coerced_tests.rb"
|
5
5
|
|
6
6
|
def env_ar_test_files
|
7
|
-
return unless ENV[
|
7
|
+
return unless ENV["TEST_FILES_AR"] && !ENV["TEST_FILES_AR"].empty?
|
8
|
+
|
8
9
|
@env_ar_test_files ||= begin
|
9
|
-
ENV[
|
10
|
+
ENV["TEST_FILES_AR"].split(",").map { |file|
|
10
11
|
File.join ARTest::SQLServer.root_activerecord, file.strip
|
11
12
|
}.sort
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
16
|
def env_test_files
|
16
|
-
return unless ENV[
|
17
|
-
|
17
|
+
return unless ENV["TEST_FILES"] && !ENV["TEST_FILES"].empty?
|
18
|
+
|
19
|
+
@env_test_files ||= ENV["TEST_FILES"].split(",").map(&:strip)
|
18
20
|
end
|
19
21
|
|
20
22
|
def sqlserver_cases
|
21
|
-
@sqlserver_cases ||= Dir.glob(
|
23
|
+
@sqlserver_cases ||= Dir.glob("test/cases/*_test_sqlserver.rb")
|
22
24
|
end
|
23
25
|
|
24
26
|
def ar_cases
|
25
27
|
@ar_cases ||= begin
|
26
|
-
Dir.glob("#{ARTest::SQLServer.root_activerecord}/test/cases/**/*_test.rb").reject{ |x| x =~ /\/adapters\// }.sort
|
28
|
+
Dir.glob("#{ARTest::SQLServer.root_activerecord}/test/cases/**/*_test.rb").reject { |x| x =~ /\/adapters\// }.sort
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
@@ -32,9 +34,9 @@ def test_files
|
|
32
34
|
[SQLSERVER_HELPER] + env_ar_test_files
|
33
35
|
elsif env_test_files
|
34
36
|
env_test_files
|
35
|
-
elsif ENV[
|
37
|
+
elsif ENV["ONLY_SQLSERVER"]
|
36
38
|
sqlserver_cases
|
37
|
-
elsif ENV[
|
39
|
+
elsif ENV["ONLY_ACTIVERECORD"]
|
38
40
|
[SQLSERVER_HELPER] + (ar_cases + [SQLSERVER_COERCED])
|
39
41
|
else
|
40
42
|
[SQLSERVER_HELPER] + (ar_cases + [SQLSERVER_COERCED] + sqlserver_cases)
|
@@ -2,16 +2,13 @@
|
|
2
2
|
|
3
3
|
module ARTest
|
4
4
|
module SQLServer
|
5
|
-
|
6
5
|
module SqlCounterSqlserver
|
7
|
-
|
8
6
|
# Only return the log vs. log_all
|
9
7
|
def capture_sql_ss
|
10
8
|
ActiveRecord::SQLCounter.clear_log
|
11
9
|
yield
|
12
10
|
ActiveRecord::SQLCounter.log.dup
|
13
11
|
end
|
14
|
-
|
15
12
|
end
|
16
13
|
|
17
14
|
ignored_sql = [
|
@@ -26,6 +23,5 @@ module ARTest
|
|
26
23
|
|
27
24
|
sqlcounter = ObjectSpace.each_object(ActiveRecord::SQLCounter).to_a.first
|
28
25
|
sqlcounter.instance_variable_set :@ignore, Regexp.union(ignored_sql.push(sqlcounter.ignore))
|
29
|
-
|
30
26
|
end
|
31
27
|
end
|