diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-14 06:57:20 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-14 07:00:45 +0900 |
commit | b571c4f3f2811b5d3dc8b005707cf8c353abdf03 (patch) | |
tree | 66b732ce2db834abc02aa1f4c0cb6d356d2e8edd /activerecord/lib/active_record/relation/predicate_builder | |
parent | 18303838335214771ffce2e881ff8eb9f8247dbe (diff) | |
download | rails-b571c4f3f2811b5d3dc8b005707cf8c353abdf03.tar.gz rails-b571c4f3f2811b5d3dc8b005707cf8c353abdf03.tar.bz2 rails-b571c4f3f2811b5d3dc8b005707cf8c353abdf03.zip |
Fallback to unprepared statement only when bind params limit is exceeded
This is a follow up and/or an alternative of #33844.
Unlike #33844, this would attempt to construct unprepared statement only
when bind params limit (mysql2 65535, pg 65535, sqlite3 249999) is
exceeded.
I only defined 65535 as the limit, not defined 249999 for sqlite3, since
it is an edge case, I'm not excited to add less worth extra code.
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder/array_handler.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb index 0895b9fba6..fadb3c420d 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb @@ -22,8 +22,8 @@ module ActiveRecord when 1 then predicate_builder.build(attribute, values.first) else values.map! do |v| - attr = predicate_builder.build_query_attribute(attribute.name, v) - attr.value_for_database if attr.boundable? + bind = predicate_builder.build_bind_attribute(attribute.name, v) + bind if bind.value.boundable? end.compact! values.empty? ? NullPredicate : attribute.in(values) end |