diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-23 07:12:29 -0500 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-23 07:12:29 -0500 |
commit | e81719650a119971e3265af866c1b47f027fa896 (patch) | |
tree | edf8c14d4d3c0e280d9972554b953127c7a30a78 /activerecord/lib/active_record/connection_adapters | |
parent | 976debac891dc9c59fa27d954ed34e6a90c98114 (diff) | |
parent | be0f3179d4458ba3bc8a026469e4acdc1bebd2df (diff) | |
download | rails-e81719650a119971e3265af866c1b47f027fa896.tar.gz rails-e81719650a119971e3265af866c1b47f027fa896.tar.bz2 rails-e81719650a119971e3265af866c1b47f027fa896.zip |
Merge pull request #22037 from kamipo/remove_no_need_binds_empty
Remove no need `binds.empty?` checking
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 765cdf90d2..fddb318553 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -383,7 +383,7 @@ module ActiveRecord type_casted_binds = binds.map { |attr| type_cast(attr.value_for_database) } log(sql, name, binds) do - if binds.empty? || !cache_stmt + if !cache_stmt stmt = @connection.prepare(sql) else cache = @statements[sql] ||= { @@ -399,7 +399,7 @@ module ActiveRecord # place when an error occurs. To support older MySQL versions, we # need to close the statement and delete the statement from the # cache. - if binds.empty? || !cache_stmt + if !cache_stmt stmt.close else @statements.delete sql @@ -417,7 +417,7 @@ module ActiveRecord affected_rows = stmt.affected_rows stmt.free_result - stmt.close if binds.empty? + stmt.close if !cache_stmt [result_set, affected_rows] end |