aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/base_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-12-14 08:34:14 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2015-12-15 10:15:24 +0100
commitaf3dc42ee357a8f70148c9dc9572276a9824aeec (patch)
tree71e4a043ffe26af38effac2881ca1909987d17a7 /activerecord/test/cases/base_test.rb
parente12c2a6d11a9ebc28b85f34230b11fb654503726 (diff)
downloadrails-af3dc42ee357a8f70148c9dc9572276a9824aeec.tar.gz
rails-af3dc42ee357a8f70148c9dc9572276a9824aeec.tar.bz2
rails-af3dc42ee357a8f70148c9dc9572276a9824aeec.zip
Use a bind param for `LIMIT` and `OFFSET`
We currently generate an unbounded number of prepared statements when `limit` or `offset` are called with a dynamic argument. This changes `LIMIT` and `OFFSET` to use bind params, eliminating the problem. `Type::Value#hash` needed to be implemented, as it turns out we busted the query cache if the type object used wasn't exactly the same object. This drops support for passing an `Arel::Nodes::SqlLiteral` to `limit`. Doing this relied on AR internals, and was never officially supported usage. Fixes #22250.
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r--activerecord/test/cases/base_test.rb6
1 files changed, 0 insertions, 6 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index b449280fb4..dc555caaff 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -147,12 +147,6 @@ class BasicsTest < ActiveRecord::TestCase
end
end
- unless current_adapter?(:MysqlAdapter, :Mysql2Adapter)
- def test_limit_should_allow_sql_literal
- assert_equal 1, Topic.limit(Arel.sql('2-1')).to_a.length
- end
- end
-
def test_select_symbol
topic_ids = Topic.select(:id).map(&:id).sort
assert_equal Topic.pluck(:id).sort, topic_ids