We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ddb3ac7 commit f5eee69Copy full SHA for f5eee69
lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -435,11 +435,14 @@ def initialize_dateformatter
435
end
436
437
def version_year
438
- vstring = _raw_select('SELECT @@version', fetch: :rows).first.first.to_s
439
- return 2016 if vstring =~ /vNext/
440
- /SQL Server (\d+)/.match(vstring).to_a.last.to_s.to_i
441
- rescue Exception => e
442
- 2016
+ return @version_year if defined?(@version_year)
+ @version_year = begin
+ vstring = _raw_select('SELECT @@version', fetch: :rows).first.first.to_s
+ return 2016 if vstring =~ /vNext/
+ /SQL Server (\d+)/.match(vstring).to_a.last.to_s.to_i
443
+ rescue Exception => e
444
+ 2016
445
+ end
446
447
448
0 commit comments