diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/nodes.rb | 1 | ||||
-rw-r--r-- | lib/arel/nodes/as.rb | 6 | ||||
-rw-r--r-- | lib/arel/predications.rb | 6 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
4 files changed, 16 insertions, 1 deletions
diff --git a/lib/arel/nodes.rb b/lib/arel/nodes.rb index 2affd01fa8..95dcc0480e 100644 --- a/lib/arel/nodes.rb +++ b/lib/arel/nodes.rb @@ -6,6 +6,7 @@ require 'arel/nodes/not_equal' require 'arel/nodes/assignment' require 'arel/nodes/or' require 'arel/nodes/and' +require 'arel/nodes/as' require 'arel/nodes/not' require 'arel/nodes/greater_than' require 'arel/nodes/greater_than_or_equal' diff --git a/lib/arel/nodes/as.rb b/lib/arel/nodes/as.rb new file mode 100644 index 0000000000..9009fe12f4 --- /dev/null +++ b/lib/arel/nodes/as.rb @@ -0,0 +1,6 @@ +module Arel + module Nodes + class As < Arel::Nodes::Binary + end + end +end diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb index 03cbb7aa3f..5a5c3d4495 100644 --- a/lib/arel/predications.rb +++ b/lib/arel/predications.rb @@ -1,5 +1,9 @@ module Arel module Predications + def as other + Nodes::As.new self, other + end + def not_eq other Nodes::NotEqual.new self, other end @@ -174,4 +178,4 @@ module Arel } end end -end
\ No newline at end of file +end diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index bbc1eb3105..ae90c0c4b6 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -250,6 +250,10 @@ module Arel end end + def visit_Arel_Nodes_As o + "#{visit o.left} AS #{visit o.right}" + end + def visit_Arel_Nodes_UnqualifiedColumn o "#{quote_column_name o.name}" end |