aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-03-24 16:50:34 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-03-24 16:50:34 -0700
commitd38352ef9e63ec6e1ffee3e4fe78101df36bd6d8 (patch)
tree55abf16fa07aeea54c8d9510dacb4c901a9cd56a /lib/arel
parent93d72131bcc24ccb5536bec672d2dac94f8de651 (diff)
downloadrails-d38352ef9e63ec6e1ffee3e4fe78101df36bd6d8.tar.gz
rails-d38352ef9e63ec6e1ffee3e4fe78101df36bd6d8.tar.bz2
rails-d38352ef9e63ec6e1ffee3e4fe78101df36bd6d8.zip
build quoted strings
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/factory_methods.rb2
-rw-r--r--lib/arel/predications.rb14
-rw-r--r--lib/arel/select_manager.rb4
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/arel/factory_methods.rb b/lib/arel/factory_methods.rb
index 3b16feae10..cb66f6f888 100644
--- a/lib/arel/factory_methods.rb
+++ b/lib/arel/factory_methods.rb
@@ -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
diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb
index fb98f0a383..74411a0522 100644
--- a/lib/arel/predications.rb
+++ b/lib/arel/predications.rb
@@ -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
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index e3d8792aca..cd84e263ad 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -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