From 9c514f39bd040c45ffa7df43bab24c2a0c88c6e3 Mon Sep 17 00:00:00 2001 From: Noemj Date: Tue, 29 Jan 2013 21:39:36 +0200 Subject: Denied the quoting of SqlLiterals --- lib/arel/visitors/to_sql.rb | 1 + test/test_update_manager.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index c4c2e6fe0f..050a9b2e63 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -589,6 +589,7 @@ key on UpdateManager using UpdateManager#key= end def quote value, column = nil + return value if Arel::Nodes::SqlLiteral === value @connection.quote value, column end diff --git a/test/test_update_manager.rb b/test/test_update_manager.rb index f9704af425..1dd881b259 100644 --- a/test/test_update_manager.rb +++ b/test/test_update_manager.rb @@ -8,6 +8,14 @@ module Arel end end + it "should not quote sql literals" do + table = Table.new(:users) + um = Arel::UpdateManager.new Table.engine + um.table table + um.set [[table[:name], (Arel::Nodes::BindParam.new '?')]] + um.to_sql.must_be_like %{ UPDATE "users" SET "name" = ? } + end + it 'handles limit properly' do table = Table.new(:users) um = Arel::UpdateManager.new Table.engine -- cgit v1.2.3