diff options
author | Eugene Kenny <elkenny@gmail.com> | 2018-04-23 22:00:40 +0100 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2018-04-23 22:00:40 +0100 |
commit | f2a906337355e3ddd5f42182711075e9404f7096 (patch) | |
tree | 4af495de577ea20c7df0e2c524d2807b6b3d21d1 /activerecord | |
parent | e970d15211a8efd7349ff0e90d44d887b85793c2 (diff) | |
download | rails-f2a906337355e3ddd5f42182711075e9404f7096.tar.gz rails-f2a906337355e3ddd5f42182711075e9404f7096.tar.bz2 rails-f2a906337355e3ddd5f42182711075e9404f7096.zip |
Save a hash allocation in MySQL statement pool
There's no need to wrap the statement in a hash with a single key.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 477b09944f..07acb5425e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -44,7 +44,7 @@ module ActiveRecord class StatementPool < ConnectionAdapters::StatementPool # :nodoc: private def dealloc(stmt) - stmt[:stmt].close + stmt.close end end diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index 458c9bfd70..4106ce01be 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -71,10 +71,7 @@ module ActiveRecord log(sql, name, binds, type_casted_binds) do if cache_stmt - cache = @statements[sql] ||= { - stmt: @connection.prepare(sql) - } - stmt = cache[:stmt] + stmt = @statements[sql] ||= @connection.prepare(sql) else stmt = @connection.prepare(sql) end |