Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove special handling for older TDS connections #1275

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions test/cases/column_test_sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def assert_obj_set_and_save(attribute, value)
_(col.sql_type).must_equal "date"
_(col.type).must_equal :date
_(col.null).must_equal true
_(col.default).must_equal connection_tds_73 ? Date.civil(1, 1, 1) : "0001-01-01"
_(col.default).must_equal Date.civil(1, 1, 1)
_(obj.date).must_equal Date.civil(1, 1, 1)
_(col.default_function).must_be_nil
type = connection.lookup_cast_type_from_column(col)
Expand Down Expand Up @@ -357,7 +357,6 @@ def assert_obj_set_and_save(attribute, value)
end

it "datetime2" do
skip "datetime2 not supported in this protocol version" unless connection_tds_73
col = column("datetime2_7")
_(col.sql_type).must_equal "datetime2(7)"
_(col.type).must_equal :datetime
Expand Down Expand Up @@ -422,7 +421,6 @@ def assert_obj_set_and_save(attribute, value)
end

it "datetimeoffset" do
skip "datetimeoffset not supported in this protocol version" unless connection_tds_73
col = column("datetimeoffset_7")
_(col.sql_type).must_equal "datetimeoffset(7)"
_(col.type).must_equal :datetimeoffset
Expand Down Expand Up @@ -491,7 +489,6 @@ def assert_obj_set_and_save(attribute, value)
end

it "time(7)" do
skip "time() not supported in this protocol version" unless connection_tds_73
col = column("time_7")
_(col.sql_type).must_equal "time(7)"
_(col.type).must_equal :time
Expand Down Expand Up @@ -523,7 +520,6 @@ def assert_obj_set_and_save(attribute, value)
end

it "time(2)" do
skip "time() not supported in this protocol version" unless connection_tds_73
col = column("time_2")
_(col.sql_type).must_equal "time(2)"
_(col.type).must_equal :time
Expand Down Expand Up @@ -553,7 +549,6 @@ def assert_obj_set_and_save(attribute, value)
end

it "time using default precision" do
skip "time() not supported in this protocol version" unless connection_tds_73
col = column("time_default")
_(col.sql_type).must_equal "time(7)"
_(col.type).must_equal :time
Expand Down
16 changes: 6 additions & 10 deletions test/cases/schema_dumper_test_sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ class SchemaDumperTestSQLServer < ActiveRecord::TestCase
# Date and Time
assert_line :date, type: "date", default: "01-01-0001"
assert_line :datetime, type: "datetime", precision: nil, default: "01-01-1753 00:00:00.123"
if connection_tds_73
assert_line :datetime2_7, type: "datetime", precision: 7, default: "12-31-9999 23:59:59.9999999"
assert_line :datetime2_3, type: "datetime", precision: 3
assert_line :datetime2_1, type: "datetime", precision: 1
end
assert_line :datetime2_7, type: "datetime", precision: 7, default: "12-31-9999 23:59:59.9999999"
assert_line :datetime2_3, type: "datetime", precision: 3
assert_line :datetime2_1, type: "datetime", precision: 1
assert_line :smalldatetime, type: "smalldatetime", default: "01-01-1901 15:45:00.0"
if connection_tds_73
assert_line :time_7, type: "time", precision: 7, default: "04:20:00.2883215"
assert_line :time_2, type: "time", precision: 2
assert_line :time_default, type: "time", precision: 7, default: "15:03:42.0621978"
end
assert_line :time_7, type: "time", precision: 7, default: "04:20:00.2883215"
assert_line :time_2, type: "time", precision: 2
assert_line :time_default, type: "time", precision: 7, default: "15:03:42.0621978"
# Character Strings
assert_line :char_10, type: "char", limit: 10, default: "1234567890"
assert_line :varchar_50, type: "varchar", limit: 50, default: "test varchar_50"
Expand Down
5 changes: 0 additions & 5 deletions test/support/connection_reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ def connection_options
connection.instance_variable_get :@connection_parameters
end

def connection_tds_73
rc = connection.raw_connection
rc.respond_to?(:tds_73?) && rc.tds_73?
end

def connection_sqlserver_azure?
connection.sqlserver_azure?
end
Expand Down