diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 09:47:50 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 09:47:50 -0700 |
commit | ac2bdd1dd31c8b89578ae7f490a898838b9ef6e0 (patch) | |
tree | eaa458133ed06fc90532a4bdc0872ac09e05b65e /lib/arel/visitors | |
parent | 9efae8f92de2361d50dc3ee9b674b2da1e782575 (diff) | |
download | rails-ac2bdd1dd31c8b89578ae7f490a898838b9ef6e0.tar.gz rails-ac2bdd1dd31c8b89578ae7f490a898838b9ef6e0.tar.bz2 rails-ac2bdd1dd31c8b89578ae7f490a898838b9ef6e0.zip |
adding an offset node
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 25b7f005ea..d45253abd5 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -52,6 +52,7 @@ module Arel o.cores.map { |x| visit x }.join, ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?), ("LIMIT #{o.limit}" if o.limit), + (visit(o.offset) if o.offset), (visit(o.lock) if o.lock), ].compact.join ' ' end @@ -70,6 +71,10 @@ module Arel "HAVING #{visit o.expr}" end + def visit_Arel_Nodes_Offset o + "OFFSET #{visit o.value}" + end + # FIXME: this does nothing on SQLLite3, but should do things on other # databases. def visit_Arel_Nodes_Lock o |