mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
build quoted strings
This commit is contained in:
parent
93d72131bc
commit
d38352ef9e
3 changed files with 10 additions and 10 deletions
|
@ -37,7 +37,7 @@ module Arel
|
|||
###
|
||||
# Create a LOWER() function
|
||||
def lower column
|
||||
Nodes::NamedFunction.new 'LOWER', [column]
|
||||
Nodes::NamedFunction.new 'LOWER', [Nodes.build_quoted(column)]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,20 +32,20 @@ module Arel
|
|||
if other.begin == -Float::INFINITY && other.end == Float::INFINITY
|
||||
Nodes::NotIn.new self, []
|
||||
elsif other.end == Float::INFINITY
|
||||
Nodes::GreaterThanOrEqual.new(self, other.begin)
|
||||
Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self))
|
||||
elsif other.begin == -Float::INFINITY && other.exclude_end?
|
||||
Nodes::LessThan.new(self, other.end)
|
||||
Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self))
|
||||
elsif other.begin == -Float::INFINITY
|
||||
Nodes::LessThanOrEqual.new(self, other.end)
|
||||
Nodes::LessThanOrEqual.new(self, Nodes.build_quoted(other.end, self))
|
||||
elsif other.exclude_end?
|
||||
left = Nodes::GreaterThanOrEqual.new(self, other.begin)
|
||||
right = Nodes::LessThan.new(self, other.end)
|
||||
left = Nodes::GreaterThanOrEqual.new(self, Nodes.build_quoted(other.begin, self))
|
||||
right = Nodes::LessThan.new(self, Nodes.build_quoted(other.end, self))
|
||||
Nodes::And.new [left, right]
|
||||
else
|
||||
Nodes::Between.new(self, Nodes::And.new([other.begin, other.end]))
|
||||
Nodes::Between.new(self, Nodes::And.new([Nodes.build_quoted(other.begin, self), Nodes.build_quoted(other.end, self)]))
|
||||
end
|
||||
else
|
||||
Nodes::In.new self, other
|
||||
Nodes::In.new self, other.map { |x| Nodes.build_quoted(x, self) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -203,8 +203,8 @@ module Arel
|
|||
|
||||
def take limit
|
||||
if limit
|
||||
@ast.limit = Nodes::Limit.new(limit)
|
||||
@ctx.top = Nodes::Top.new(limit)
|
||||
@ast.limit = Nodes::Limit.new(Nodes.build_quoted(limit))
|
||||
@ctx.top = Nodes::Top.new(Nodes.build_quoted(limit))
|
||||
else
|
||||
@ast.limit = nil
|
||||
@ctx.top = nil
|
||||
|
|
Loading…
Reference in a new issue