@@ -176,7 +176,7 @@ class SQLServerAdapter < AbstractAdapter
176176 DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s +"?(\d {4}|\w +)"?/
177177 SUPPORTED_VERSIONS = [ 2005 , 2008 , 2010 , 2011 ] . freeze
178178
179- attr_reader :database_version , :database_year , :spid
179+ attr_reader :database_version , :database_year , :spid , :product_level , :product_version , :edition
180180
181181 cattr_accessor :native_text_database_type , :native_binary_database_type , :native_string_database_type ,
182182 :log_info_schema_queries , :enable_default_unicode_types , :auto_connect ,
@@ -323,20 +323,8 @@ def version
323323 self . class ::VERSION
324324 end
325325
326- def product_level
327- @product_level ||= info_schema_query { select_value ( "SELECT CAST(SERVERPROPERTY('productlevel') AS VARCHAR(128))" ) }
328- end
329-
330- def product_version
331- @product_version ||= info_schema_query { select_value ( "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(128))" ) }
332- end
333-
334- def edition
335- @edition ||= info_schema_query { select_value ( "SELECT CAST(SERVERPROPERTY('edition') AS VARCHAR(128))" ) }
336- end
337-
338326 def inspect
339- "#<#{ self . class } version: #{ version } , year: #{ @database_year } , product_level: #{ product_level . inspect } , product_version: #{ product_version . inspect } , edition: #{ edition . inspect } , connection_options: #{ @connection_options . inspect } >"
327+ "#<#{ self . class } version: #{ version } , year: #{ @database_year } , product_level: #{ @ product_level. inspect } , product_version: #{ @ product_version. inspect } , edition: #{ @ edition. inspect } , connection_options: #{ @connection_options . inspect } >"
340328 end
341329
342330 def auto_connect
@@ -443,7 +431,10 @@ def connect
443431 end
444432 end
445433 end
446- @spid = _raw_select ( "SELECT @@SPID" , :fetch => :rows ) . first . first
434+ @spid = _raw_select ( "SELECT @@SPID" , :fetch => :rows ) . first . first
435+ @product_level = _raw_select ( "SELECT CAST(SERVERPROPERTY('productlevel') AS VARCHAR(128))" , :fetch => :rows ) . first . first
436+ @product_version = _raw_select ( "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(128))" , :fetch => :rows ) . first . first
437+ @edition = _raw_select ( "SELECT CAST(SERVERPROPERTY('edition') AS VARCHAR(128))" , :fetch => :rows ) . first . first
447438 configure_connection
448439 rescue
449440 raise unless @auto_connecting
0 commit comments