Skip to content

Commit e19de7f

Browse files
committed
Include a visit_Arel_Nodes_UpdateStatement method in our Arel visitor to add a limit/top for update that has order and no limit/top.
* See: rails/rails@787194e
1 parent 64f79ea commit e19de7f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG

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

22
* 3.1.0 *
33

4+
* Include a visit_Arel_Nodes_UpdateStatement method in our Arel visitor to add a limit/top for update
5+
that has order and no limit/top. https://github.com/rails/rails/commit/787194ee43ab1fb0a7dc8bfbbfbd5079b047d833
6+
47
* Allow drop_database to be called even when DB does not exist.
58

69
* Remove totally broken ADONET connection mode. Want it back, submit a patch.

lib/arel/visitors/sqlserver.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ def visit_Arel_Nodes_SelectStatement(o)
8888
visit_Arel_Nodes_SelectStatementWithOutOffset(o)
8989
end
9090
end
91+
92+
def visit_Arel_Nodes_UpdateStatement(o)
93+
if o.orders.any? && o.limit.nil?
94+
o.limit = Nodes::Limit.new(2147483647)
95+
end
96+
super
97+
end
9198

9299
def visit_Arel_Nodes_Offset(o)
93100
"WHERE [__rnt].[__rn] > (#{visit o.expr})"

0 commit comments

Comments
 (0)