activerecord-sqlserver-adapter 3.0.4 → 3.0.5

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.
data/CHANGELOG CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ * master *
3
+
4
+
5
+ * 3.0.5 *
6
+
7
+ * Fixed native database type memoization, now at connection instance level. Fix #execute_procedure for :dblib mode to return indifferent access rows too.
8
+
9
+ * Make login timeout and query timeout backward database.yml friendly for :dblib mode.
10
+
11
+
2
12
  * 3.0.4 *
3
13
 
4
14
  * Add multiple results set support with #execute_procedure for :dblib mode. [Ken Collins]
@@ -80,7 +80,7 @@ module ActiveRecord
80
80
  r = row.with_indifferent_access
81
81
  yield(r) if block_given?
82
82
  end
83
- result.each
83
+ result.each.map{ |row| row.is_a?(Hash) ? row.with_indifferent_access : row }
84
84
  when :odbc
85
85
  results = []
86
86
  raw_connection_run(sql) do |handle|
@@ -4,7 +4,7 @@ module ActiveRecord
4
4
  module SchemaStatements
5
5
 
6
6
  def native_database_types
7
- ActiveRecord::ConnectionAdapters::SQLServerAdapter::NATIVE_DATABASE_TYPES
7
+ @native_database_types ||= initialize_native_database_types.freeze
8
8
  end
9
9
 
10
10
  def tables(name = nil)
@@ -148,8 +148,7 @@ module ActiveRecord
148
148
  # === SQLServer Specific ======================================== #
149
149
 
150
150
  def initialize_native_database_types
151
- return if defined?(ActiveRecord::ConnectionAdapters::SQLServerAdapter::NATIVE_DATABASE_TYPES)
152
- ActiveRecord::ConnectionAdapters::SQLServerAdapter.const_set(:NATIVE_DATABASE_TYPES,{
151
+ {
153
152
  :primary_key => "int NOT NULL IDENTITY(1,1) PRIMARY KEY",
154
153
  :string => { :name => native_string_database_type, :limit => 255 },
155
154
  :text => { :name => native_text_database_type },
@@ -170,7 +169,7 @@ module ActiveRecord
170
169
  :nvarchar_max => { :name => "nvarchar(max)" },
171
170
  :ntext => { :name => "ntext" },
172
171
  :ss_timestamp => { :name => 'timestamp' }
173
- })
172
+ }
174
173
  end
175
174
 
176
175
  def column_definitions(table_name)
@@ -163,7 +163,7 @@ module ActiveRecord
163
163
  include Sqlserver::Errors
164
164
 
165
165
  ADAPTER_NAME = 'SQLServer'.freeze
166
- VERSION = '3.0.4'.freeze
166
+ VERSION = '3.0.5'.freeze
167
167
  DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/
168
168
  SUPPORTED_VERSIONS = [2005,2008].freeze
169
169
 
@@ -180,7 +180,6 @@ module ActiveRecord
180
180
  super(@connection, logger)
181
181
  @database_version = info_schema_query { select_value('SELECT @@version') }
182
182
  @database_year = DATABASE_VERSION_REGEXP.match(@database_version)[1].to_i rescue 0
183
- initialize_native_database_types
184
183
  initialize_sqlserver_caches
185
184
  use_database
186
185
  unless SUPPORTED_VERSIONS.include?(@database_year)
@@ -346,6 +345,8 @@ module ActiveRecord
346
345
  @connection = case @connection_options[:mode]
347
346
  when :dblib
348
347
  appname = config[:appname] || Rails.application.class.name.split('::').first rescue nil
348
+ login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil
349
+ timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil
349
350
  encoding = config[:encoding].present? ? config[:encoding] : nil
350
351
  TinyTds::Client.new({
351
352
  :dataserver => config[:dataserver],
@@ -353,8 +354,8 @@ module ActiveRecord
353
354
  :password => config[:password],
354
355
  :database => config[:database],
355
356
  :appname => appname,
356
- :login_timeout => config[:dblib_login_timeout],
357
- :timeout => config[:dblib_timeout],
357
+ :login_timeout => login_timeout,
358
+ :timeout => timeout,
358
359
  :encoding => encoding
359
360
  }).tap do |client|
360
361
  client.execute("SET ANSI_DEFAULTS ON").do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-sqlserver-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 4
10
- version: 3.0.4
9
+ - 5
10
+ version: 3.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Collins
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-10-26 00:00:00 -04:00
22
+ date: 2010-10-31 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency