Skip to content

Commit f7292dd

Browse files
committed
Table and column aliases can handle many. Resolves ticket #19 [stonegao]
1 parent 4afee37 commit f7292dd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
MASTER
33

4+
* Table and column aliases can handle many. Resolves ticket #19 [stonegao]
5+
46
* Coerce a few tests that were failing in 2.3.x [Ken Collins]
57

68
* Change column/view cache to happen at class level. Allows connection pool to share same

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def add_limit_offset!(sql, options)
481481
order_by_column, order_direction = field.split(" ")
482482
order_by_column = quote_column_name(order_by_column)
483483
# Investigate the SQL query to figure out if the order_by_column has been renamed.
484-
if sql =~ /#{Regexp.escape(order_by_column)} AS (t\d_r\d\d?)/
484+
if sql =~ /#{Regexp.escape(order_by_column)} AS (t\d+_r\d+)/
485485
# Fx "[foo].[bar] AS t4_r2" was found in the SQL. Use the column alias (ie 't4_r2') for the subsequent orderings
486486
order_by_column = $1
487487
elsif order_by_column =~ /\w+\.\[?(\w+)\]?/

0 commit comments

Comments
 (0)