mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
590c784a30
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.
24 lines
370 B
Ruby
24 lines
370 B
Ruby
# encoding: utf-8
|
|
|
|
require 'arel/collectors/plain_string'
|
|
|
|
module Arel
|
|
module Collectors
|
|
class SQLString < PlainString
|
|
def initialize(*)
|
|
super
|
|
@bind_index = 1
|
|
end
|
|
|
|
def add_bind bind
|
|
self << yield(@bind_index)
|
|
@bind_index += 1
|
|
self
|
|
end
|
|
|
|
def compile bvs
|
|
value
|
|
end
|
|
end
|
|
end
|
|
end
|