diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-12 15:19:17 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-12 15:19:17 -0800 |
commit | 4bf7071d630114fced0e474a93ba9fc16bae10e7 (patch) | |
tree | 123cf87704f67dde0fd8182f055c9190b3464e91 /activerecord/lib | |
parent | 4dc42045e20114783a17a0c286b065a3969e6025 (diff) | |
download | rails-4bf7071d630114fced0e474a93ba9fc16bae10e7.tar.gz rails-4bf7071d630114fced0e474a93ba9fc16bae10e7.tar.bz2 rails-4bf7071d630114fced0e474a93ba9fc16bae10e7.zip |
`execute` is a hotspot, so let's reduce branches
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 8 |
1 files changed, 2 insertions, 6 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 7768c24967..23edc8b955 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -298,11 +298,7 @@ module ActiveRecord # Executes the SQL statement in the context of this connection. def execute(sql, name = nil) - if name == :skip_logging - @connection.query(sql) - else - log(sql, name) { @connection.query(sql) } - end + log(sql, name) { @connection.query(sql) } end # MysqlAdapter has to free a result after using it, so we use this method to write @@ -775,7 +771,7 @@ module ActiveRecord end.compact.join(', ') # ...and send them all in one query - execute("SET #{encoding} #{variable_assignments}", :skip_logging) + @connection.query "SET #{encoding} #{variable_assignments}" end end end |