aboutsummaryrefslogtreecommitdiffstats
path: root/test/visitors
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-20 17:16:18 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-20 17:16:18 -0700
commite42506f9ea58511246f638e81002947ee3c36b18 (patch)
tree5f7b88a09b345c124fffefa733d8c49343552cc6 /test/visitors
parent4041d7d33ad3f0acb0b04ed51da3ae29123250cb (diff)
downloadrails-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 'test/visitors')
-rw-r--r--test/visitors/test_mysql.rb21
-rw-r--r--test/visitors/test_sqlite.rb18
2 files changed, 39 insertions, 0 deletions
diff --git a/test/visitors/test_mysql.rb b/test/visitors/test_mysql.rb
new file mode 100644
index 0000000000..1d38161caf
--- /dev/null
+++ b/test/visitors/test_mysql.rb
@@ -0,0 +1,21 @@
+require 'helper'
+
+module Arel
+ module Visitors
+ describe 'the mysql visitor' do
+ before do
+ @visitor = MySQL.new Table.engine
+ end
+
+ ###
+ # :'(
+ # http://dev.mysql.com/doc/refman/5.0/en/select.html#id3482214
+ it 'defaults limit to 18446744073709551615' do
+ stmt = Nodes::SelectStatement.new
+ stmt.offset = Nodes::Offset.new(1)
+ sql = @visitor.accept(stmt)
+ sql.must_be_like "SELECT LIMIT 18446744073709551615 OFFSET 1"
+ end
+ end
+ end
+end
diff --git a/test/visitors/test_sqlite.rb b/test/visitors/test_sqlite.rb
new file mode 100644
index 0000000000..fb8392c504
--- /dev/null
+++ b/test/visitors/test_sqlite.rb
@@ -0,0 +1,18 @@
+require 'helper'
+
+module Arel
+ module Visitors
+ describe 'the sqlite visitor' do
+ before do
+ @visitor = SQLite.new Table.engine
+ end
+
+ it 'defaults limit to -1' do
+ stmt = Nodes::SelectStatement.new
+ stmt.offset = Nodes::Offset.new(1)
+ sql = @visitor.accept(stmt)
+ sql.must_be_like "SELECT LIMIT -1 OFFSET 1"
+ end
+ end
+ end
+end