activerecord-sqlserver-adapter 3.0.18 → 3.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,17 @@
1
1
 
2
+ * 3.0.19 *
3
+
4
+ * Create a #configure_connection method that can be overridden. Think "SET TEXTSIZE...".
5
+
6
+ * Create a #configure_application_name method that can be overridden for unique TinyTDS app names
7
+ to show up in SQL Server's activity monitor.
8
+
9
+ * Fixed the #finish_statement_handle to cancel the TinyTDS connection if needed.
10
+
11
+ * Fix the #indexes method to fail gracefully if sp_helptext permissions fail.
12
+
13
+
14
+
2
15
  * 3.0.18 *
3
16
 
4
17
  * Make #rollback_db_transaction smarter.
@@ -398,7 +398,8 @@ module ActiveRecord
398
398
 
399
399
  def finish_statement_handle(handle)
400
400
  case @connection_options[:mode]
401
- when :dblib
401
+ when :dblib
402
+ handle.cancel if handle
402
403
  when :odbc
403
404
  handle.drop if handle && handle.respond_to?(:drop) && !handle.finished?
404
405
  when :adonet
@@ -20,7 +20,8 @@ module ActiveRecord
20
20
 
21
21
  def indexes(table_name, name = nil)
22
22
  unquoted_table_name = unqualify_table_name(table_name)
23
- select("EXEC sp_helpindex #{quote_table_name(unquoted_table_name)}",name).inject([]) do |indexes,index|
23
+ data = select("EXEC sp_helpindex #{quote_table_name(unquoted_table_name)}",name) rescue []
24
+ data.inject([]) do |indexes,index|
24
25
  index = index.with_indifferent_access
25
26
  if index[:index_description] =~ /primary key/
26
27
  indexes
@@ -164,7 +164,7 @@ module ActiveRecord
164
164
  include Sqlserver::Errors
165
165
 
166
166
  ADAPTER_NAME = 'SQLServer'.freeze
167
- VERSION = '3.0.18'.freeze
167
+ VERSION = '3.0.19'.freeze
168
168
  DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+"?(\d{4}|\w+)"?/
169
169
  SUPPORTED_VERSIONS = [2005,2008,2010,2011].freeze
170
170
 
@@ -358,7 +358,7 @@ module ActiveRecord
358
358
  config = @connection_options
359
359
  @connection = case @connection_options[:mode]
360
360
  when :dblib
361
- appname = config[:appname] || Rails.application.class.name.split('::').first rescue nil
361
+ appname = config[:appname] || configure_application_name || Rails.application.class.name.split('::').first rescue nil
362
362
  login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil
363
363
  timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil
364
364
  encoding = config[:encoding].present? ? config[:encoding] : nil
@@ -423,10 +423,24 @@ module ActiveRecord
423
423
  connection.open
424
424
  end
425
425
  end
426
+ configure_connection
426
427
  rescue
427
428
  raise unless @auto_connecting
428
429
  end
429
430
 
431
+ # Override this method so every connection can be configured to your needs.
432
+ # For example:
433
+ # do_execute "SET TEXTSIZE #{64.megabytes}"
434
+ # do_execute "SET CONCAT_NULL_YIELDS_NULL ON"
435
+ def configure_connection
436
+ end
437
+
438
+ # Override this method so every connection can have a unique name. Max 30 characters. Used by TinyTDS only.
439
+ # For example:
440
+ # "myapp_#{$$}_#{Thread.current.object_id}".to(29)
441
+ def configure_application_name
442
+ end
443
+
430
444
  def remove_database_connections_and_rollback(database=nil)
431
445
  database ||= current_database
432
446
  do_execute "ALTER DATABASE #{quote_table_name(database)} SET SINGLE_USER WITH ROLLBACK IMMEDIATE"
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: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
- - 18
10
- version: 3.0.18
9
+ - 19
10
+ version: 3.0.19
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: 2011-10-04 00:00:00 -04:00
22
+ date: 2011-10-23 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency