Skip to content

Commit

Permalink
Update sqlserver.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan committed May 29, 2024
1 parent 9662595 commit 3a88a8f
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions lib/arel/visitors/sqlserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,31 @@ def visit_Arel_Nodes_UpdateStatement(o, collector)
o.limit = Nodes::Limit.new(9_223_372_036_854_775_807)
end

if o.key && o.key.size > 1
collector.retryable = false
_visit_Arel_Nodes_UpdateStatement(o, collector)
else
super
end
end


collector.retryable = false
# o = prepare_update_statement(o)

def _visit_Arel_Nodes_UpdateStatement(o, collector)
collector << "UPDATE "


visit o.relation.left, collector
if has_join_sources?(o)
visit o.relation.left, collector
else
visit o.relation, collector
end

collect_nodes_for o.values, collector, " SET "

collector << " FROM "
visit o.relation.left, collector

collector << " "
collector = visit o.relation.right, collector
visit o.relation, collector

collect_nodes_for o.wheres, collector, " WHERE ", " AND "
collect_nodes_for o.orders, collector, " ORDER BY "
maybe_visit o.limit, collector


#



# super
end

def visit_Arel_Nodes_Lock(o, collector)
Expand Down

0 comments on commit 3a88a8f

Please sign in to comment.