@@ -207,9 +207,10 @@ def initialize(connection, logger, pool, config)
207207 connect
208208 @database_version = select_value 'SELECT @@version' , 'SCHEMA'
209209 @database_year = begin
210- if @database_version =~ /Microsoft SQL Azure/i
210+ if @database_version =~ /Azure/i
211211 @sqlserver_azure = true
212- @database_version . match ( /\s (\d {4})\s / ) [ 1 ] . to_i
212+ @database_version . match ( /\s -\s ([0-9.]+)/ ) [ 1 ]
213+ year = 2012
213214 else
214215 year = DATABASE_VERSION_REGEXP . match ( @database_version ) [ 1 ]
215216 year == "Denali" ? 2011 : year . to_i
@@ -222,7 +223,7 @@ def initialize(connection, logger, pool, config)
222223 @edition = select_value "SELECT CAST(SERVERPROPERTY('edition') AS VARCHAR(128))" , 'SCHEMA'
223224 initialize_dateformatter
224225 use_database
225- unless SUPPORTED_VERSIONS . include? ( @database_year )
226+ unless ( @sqlserver_azure == true || SUPPORTED_VERSIONS . include? ( @database_year ) )
226227 raise NotImplementedError , "Currently, only #{ SUPPORTED_VERSIONS . to_sentence } are supported. We got back #{ @database_version } ."
227228 end
228229 end
@@ -437,6 +438,7 @@ def connect
437438 client . execute ( "SET ANSI_PADDING ON" ) . do
438439 client . execute ( "SET QUOTED_IDENTIFIER ON" )
439440 client . execute ( "SET ANSI_WARNINGS ON" ) . do
441+ client . execute ( "SET CONCAT_NULL_YIELDS_NULL ON" ) . do
440442 else
441443 client . execute ( "SET ANSI_DEFAULTS ON" ) . do
442444 client . execute ( "SET CURSOR_CLOSE_ON_COMMIT OFF" ) . do
@@ -524,9 +526,10 @@ def auto_reconnected?
524526 @auto_connecting = true
525527 count = 0
526528 while count <= ( auto_connect_duration / 2 )
527- sleep 2 ** count
529+ result = reconnect!
528530 ActiveRecord ::Base . did_retry_sqlserver_connection ( self , count )
529- return true if reconnect!
531+ return true if result
532+ sleep 2 ** count
530533 count += 1
531534 end
532535 ActiveRecord ::Base . did_lose_sqlserver_connection ( self )
0 commit comments