diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-20 17:16:18 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-20 17:16:18 -0700 |
commit | e42506f9ea58511246f638e81002947ee3c36b18 (patch) | |
tree | 5f7b88a09b345c124fffefa733d8c49343552cc6 /lib/arel/visitors | |
parent | 4041d7d33ad3f0acb0b04ed51da3ae29123250cb (diff) | |
download | rails-e42506f9ea58511246f638e81002947ee3c36b18.tar.gz rails-e42506f9ea58511246f638e81002947ee3c36b18.tar.bz2 rails-e42506f9ea58511246f638e81002947ee3c36b18.zip |
adding default limits when there is an offset for sqlite and mysql [#5316 state:resolved]
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/mysql.rb | 7 | ||||
-rw-r--r-- | lib/arel/visitors/sqlite.rb | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/arel/visitors/mysql.rb b/lib/arel/visitors/mysql.rb index 0c94ee1b27..594fd5504a 100644 --- a/lib/arel/visitors/mysql.rb +++ b/lib/arel/visitors/mysql.rb @@ -2,6 +2,13 @@ module Arel module Visitors class MySQL < Arel::Visitors::ToSql private + ### + # :'( + # http://dev.mysql.com/doc/refman/5.0/en/select.html#id3482214 + def visit_Arel_Nodes_SelectStatement o + o.limit = 18446744073709551615 if o.offset && !o.limit + super + end def visit_Arel_Nodes_UpdateStatement o [ diff --git a/lib/arel/visitors/sqlite.rb b/lib/arel/visitors/sqlite.rb new file mode 100644 index 0000000000..c45160851d --- /dev/null +++ b/lib/arel/visitors/sqlite.rb @@ -0,0 +1,11 @@ +module Arel + module Visitors + class SQLite < Arel::Visitors::ToSql + private + def visit_Arel_Nodes_SelectStatement o + o.limit = -1 if o.offset && !o.limit + super + end + end + end +end |