Skip to content

Commit ac7162f

Browse files
committed
Use method from Rails master
1 parent 033f0ff commit ac7162f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ module QueryMethods
99

1010
private
1111

12-
# Same as original except quoted table name is regex escapes.
12+
# Copy of original from Rails master. This patch can be removed when adapter supports Rails 6.
1313
def table_name_matches?(from)
14-
/(?:\A|(?<!FROM)\s)(?:\b#{table.name}\b|#{Regexp.escape(connection.quote_table_name(table.name))})(?!\.)/i.match?(from.to_s)
14+
table_name = Regexp.escape(table.name)
15+
quoted_table_name = Regexp.escape(connection.quote_table_name(table.name))
16+
/(?:\A|(?<!FROM)\s)(?:\b#{table_name}\b|#{quoted_table_name})(?!\.)/i.match?(from.to_s)
1517
end
1618
end
1719
end

0 commit comments

Comments
 (0)