Skip to content

Commit f35064e

Browse files
committed
Include version in connection method and inspection.
1 parent 60e9f08 commit f35064e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
*MASTER* ()
33

4-
*
4+
* Include version in connection method and inspection. [Ken Collins]
55

66

77
*2.2.1* (November 25th, 2008)

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def simplified_datetime
150150
class SQLServerAdapter < AbstractAdapter
151151

152152
ADAPTER_NAME = 'SQLServer'.freeze
153+
VERSION = '2.2.1'.freeze
153154
DATABASE_VERSION_REGEXP = /Microsoft SQL Server\s+(\d{4})/
154155
SUPPORTED_VERSIONS = [2000,2005].freeze
155156
LIMITABLE_TYPES = ['string','integer','float','char','nchar','varchar','nvarchar'].freeze
@@ -203,8 +204,12 @@ def sqlserver_2005?
203204
database_year == 2005
204205
end
205206

207+
def version
208+
self.class::VERSION
209+
end
210+
206211
def inspect
207-
"#<#{self.class} year: #{database_year}, connection_options: #{@connection_options.inspect}>"
212+
"#<#{self.class} version: #{version}, year: #{database_year}, connection_options: #{@connection_options.inspect}>"
208213
end
209214

210215
def native_text_database_type

test/cases/adapter_test_sqlserver.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def setup
2727
assert_equal 'SQLServer', @connection.adapter_name
2828
end
2929

30+
should 'include version in inspect' do
31+
assert_match(/version\: \d.\d.\d/,@connection.inspect)
32+
end
33+
3034
should 'support migrations' do
3135
assert @connection.supports_migrations?
3236
end

0 commit comments

Comments
 (0)