diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-04-24 06:58:32 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-04-24 17:16:19 +0900 |
commit | c790eae872007140946c0af8bb0904c7b036ba62 (patch) | |
tree | b17b2e7b45fb31d0771fb7f37ff7385e44a7f6d3 /activerecord/lib/active_record | |
parent | a3ecf4ff1dbb92259e1627bdd09546211f25d906 (diff) | |
download | rails-c790eae872007140946c0af8bb0904c7b036ba62.tar.gz rails-c790eae872007140946c0af8bb0904c7b036ba62.tar.bz2 rails-c790eae872007140946c0af8bb0904c7b036ba62.zip |
`columns` is cached in the statement
https://github.com/sparklemotion/sqlite3-ruby/blob/v1.3.13/lib/sqlite3/statement.rb#L101-L104
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index a958600446..800e731f06 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -94,7 +94,7 @@ module ActiveRecord class StatementPool < ConnectionAdapters::StatementPool # :nodoc: private def dealloc(stmt) - stmt[:stmt].close unless stmt[:stmt].closed? + stmt.close unless stmt.closed? end end @@ -224,11 +224,8 @@ module ActiveRecord stmt.close end else - cache = @statements[sql] ||= { - stmt: @connection.prepare(sql) - } - stmt = cache[:stmt] - cols = cache[:cols] ||= stmt.columns + stmt = @statements[sql] ||= @connection.prepare(sql) + cols = stmt.columns stmt.reset! stmt.bind_params(type_casted_binds) records = stmt.to_a |