From 590c784a30b13153667f8db7915998d7731e24e5 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 17 Nov 2014 14:52:38 -0800 Subject: Add order to BindParams in the ToSql collector This removes the need for us to do the re-ordering by walking the AST in ActiveRecord. We're using a block to communicate with the collector, since the collector needs to be the thing which knows about the index, while the visitor is the thing that needs to know the syntax. The BindParam needs to know about neither of these things, so it's been changed to stop being a subclass of SqlLiteral I could also see an alternative implementation using format strings if for some reason blocks cause a problem. --- lib/arel/nodes/bind_param.rb | 6 ++++++ lib/arel/nodes/sql_literal.rb | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 lib/arel/nodes/bind_param.rb (limited to 'lib/arel/nodes') diff --git a/lib/arel/nodes/bind_param.rb b/lib/arel/nodes/bind_param.rb new file mode 100644 index 0000000000..160bc21b91 --- /dev/null +++ b/lib/arel/nodes/bind_param.rb @@ -0,0 +1,6 @@ +module Arel + module Nodes + class BindParam < Node + end + end +end diff --git a/lib/arel/nodes/sql_literal.rb b/lib/arel/nodes/sql_literal.rb index b43288b29c..2c56644b99 100644 --- a/lib/arel/nodes/sql_literal.rb +++ b/lib/arel/nodes/sql_literal.rb @@ -10,8 +10,5 @@ module Arel coder.scalar = self.to_s end end - - class BindParam < SqlLiteral - end end end -- cgit v1.2.3