Skip to content

Commit 8b03991

Browse files
committed
Add table_alias_length for SQL Server.
1 parent 97659ec commit 8b03991

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ def update_sql(sql, name = nil)
550550

551551
# SCHEMA STATEMENTS ========================================#
552552

553+
def table_alias_length
554+
128
555+
end
556+
553557
def tables(name = nil)
554558
execute("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'", name) do |sth|
555559
result = sth.inject([]) do |tables, field|

test/cases/adapter_test_sqlserver.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def setup
1515

1616
context 'For abstract behavior' do
1717

18+
should 'have a 128 max #table_alias_length' do
19+
assert @connection.table_alias_length <= 128
20+
end
21+
1822
should 'raise invalid statement error' do
1923
assert_raise(ActiveRecord::StatementInvalid) { Topic.connection.update_sql("UPDATE XXX") }
2024
end

0 commit comments

Comments
 (0)