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.rb | |
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.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index cb70b8bcde..f734cd0ad8 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -57,14 +57,10 @@ module ActiveRecord end def build_bind_attribute(column_name, value) - attr = build_query_attribute(column_name, value) + attr = Relation::QueryAttribute.new(column_name.to_s, value, table.type(column_name)) Arel::Nodes::BindParam.new(attr) end - def build_query_attribute(column_name, value) - Relation::QueryAttribute.new(column_name.to_s, value, table.type(column_name)) - end - protected def expand_from_hash(attributes) return ["1=0"] if attributes.empty? |