activerecord-sqlserver-adapter 4.2.8 → 4.2.9
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/CHANGELOG.md +12 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +2 -1
- data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +4 -0
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +1 -1
- data/test/cases/execute_procedure_test_sqlserver.rb +6 -0
- data/test/schema/sqlserver_specific_schema.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5d6ca15cc209e9b813902b9858da21c7e7c884
|
4
|
+
data.tar.gz: 6bd880c3daa536eee4df06414864df65cd8745c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5245acb11cbaa31099871f12c5a9387776dc5def556bbdcfecc25eebc3a1b167a29ebb14b6aa1cd58ad8fa52241bd58ef0f784aa29167a68a3c4c3d1f55aa9d2
|
7
|
+
data.tar.gz: 514c6fa8bc3c4e7d16df6db884c5705aa6932b5de7b3fd857cfb2346409efe004a117fc8c51de90a4d67ac26c1bca4c1c4753ce25c5913edf17651646809417f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## v4.2.9
|
2
|
+
|
3
|
+
#### Fixed
|
4
|
+
|
5
|
+
* Conform to new data_sources interfaces. See: https://git.io/va4Fp
|
6
|
+
* The `primary_key` method falls back to Identity columns. Not the other way around. Fixes #454. Thanks @marceloeloelo
|
7
|
+
* Ensure that `execute_procedure` returns proper time zones. Fixes #449
|
8
|
+
|
9
|
+
#### Changed
|
10
|
+
|
11
|
+
* Run tests with verbose false.
|
12
|
+
|
1
13
|
|
2
14
|
## v4.2.8
|
3
15
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.2.
|
1
|
+
4.2.9
|
@@ -117,7 +117,8 @@ module ActiveRecord
|
|
117
117
|
case @connection_options[:mode]
|
118
118
|
when :dblib
|
119
119
|
result = @connection.execute(sql)
|
120
|
-
|
120
|
+
options = { as: :hash, cache_rows: true, timezone: ActiveRecord::Base.default_timezone || :utc }
|
121
|
+
result.each(options) do |row|
|
121
122
|
r = row.with_indifferent_access
|
122
123
|
yield(r) if block_given?
|
123
124
|
end
|
@@ -7,6 +7,10 @@ module ActiveRecord
|
|
7
7
|
@native_database_types ||= initialize_native_database_types.freeze
|
8
8
|
end
|
9
9
|
|
10
|
+
def data_sources
|
11
|
+
tables + views
|
12
|
+
end
|
13
|
+
|
10
14
|
def tables(table_type = 'BASE TABLE')
|
11
15
|
select_values "SELECT #{lowercase_schema_reflection_sql('TABLE_NAME')} FROM INFORMATION_SCHEMA.TABLES #{"WHERE TABLE_TYPE = '#{table_type}'" if table_type} ORDER BY TABLE_NAME", 'SCHEMA'
|
12
16
|
end
|
@@ -181,7 +181,7 @@ module ActiveRecord
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def primary_key(table_name)
|
184
|
-
|
184
|
+
schema_cache.columns(table_name).find(&:is_primary?).try(:name) || identity_column(table_name).try(:name)
|
185
185
|
end
|
186
186
|
|
187
187
|
# === SQLServer Specific (DB Reflection) ======================== #
|
@@ -35,4 +35,10 @@ class ExecuteProcedureTestSQLServer < ActiveRecord::TestCase
|
|
35
35
|
assert_equal 'VIEW', table_info['TABLE_TYPE'], "Table Info: #{table_info.inspect}"
|
36
36
|
end
|
37
37
|
|
38
|
+
it 'uses the proper timezone' do
|
39
|
+
date_proc = connection.execute_procedure('my_getutcdate').first['utcdate']
|
40
|
+
date_base = connection.select_value('select GETUTCDATE()')
|
41
|
+
assert_equal date_base, date_proc
|
42
|
+
end
|
43
|
+
|
38
44
|
end
|
@@ -119,6 +119,12 @@ ActiveRecord::Schema.define do
|
|
119
119
|
end
|
120
120
|
execute "sp_bindefault 'sst_getdateobject', 'sst_defaultobjects.date'"
|
121
121
|
|
122
|
+
execute "DROP PROCEDURE my_getutcdate" rescue nil
|
123
|
+
execute <<-SQL
|
124
|
+
CREATE PROCEDURE my_getutcdate AS
|
125
|
+
SELECT GETUTCDATE() utcdate
|
126
|
+
SQL
|
127
|
+
|
122
128
|
# Constraints
|
123
129
|
|
124
130
|
create_table(:sst_has_fks, force: true) { |t| t.column(:fk_id, :integer, null: false) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-sqlserver-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2016-
|
17
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: activerecord
|