activerecord-sqlserver-adapter 4.2.8 → 4.2.9

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
  SHA1:
3
- metadata.gz: 6f37e4ce81b63e3fe3375111b70da855a95d1251
4
- data.tar.gz: 7b11a582736c9718dbb20097b0b55c392f691b08
3
+ metadata.gz: 8f5d6ca15cc209e9b813902b9858da21c7e7c884
4
+ data.tar.gz: 6bd880c3daa536eee4df06414864df65cd8745c4
5
5
  SHA512:
6
- metadata.gz: f0066beca8922fb26506304059d80069a91f45b9392857e68a2af63640f4706ff300ca4b8e8bb18d807117bb168039188d50d397897488de255b31c454692a1c
7
- data.tar.gz: e52261a203dcc9d9124ed6d04113fbcc15887e09b38f18076e213906da9b2b4fbf71e83032b5ee284483c206a28d9bb237f6f04e67cbdcc7e0b68ece791f8fbb
6
+ metadata.gz: 5245acb11cbaa31099871f12c5a9387776dc5def556bbdcfecc25eebc3a1b167a29ebb14b6aa1cd58ad8fa52241bd58ef0f784aa29167a68a3c4c3d1f55aa9d2
7
+ data.tar.gz: 514c6fa8bc3c4e7d16df6db884c5705aa6932b5de7b3fd857cfb2346409efe004a117fc8c51de90a4d67ac26c1bca4c1c4753ce25c5913edf17651646809417f
@@ -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
@@ -14,7 +14,7 @@ namespace :test do
14
14
  t.libs = ARTest::SQLServer.test_load_paths
15
15
  t.test_files = test_files
16
16
  t.warning = !!ENV['WARNING']
17
- t.verbose = true
17
+ t.verbose = false
18
18
  end
19
19
 
20
20
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.2.8
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
- result.each(as: :hash, cache_rows: true) do |row|
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
- identity_column(table_name).try(:name) || schema_cache.columns(table_name).find(&:is_primary?).try(:name)
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.8
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-02-29 00:00:00.000000000 Z
17
+ date: 2016-03-15 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activerecord