diff options
author | Timur Alperovich <timur@maginatics.com> | 2014-01-08 15:08:25 -0800 |
---|---|---|
committer | Timur Alperovich <timur@maginatics.com> | 2014-01-15 10:35:21 -0800 |
commit | 6f16513b587a0805a23eab99d5f283476b1d6687 (patch) | |
tree | 5140b1d17ebd2764af7e7bd9a2434cf70360d8db /activerecord/lib/active_record | |
parent | 8d146c8bec3a33052116ca5730151dc44d766222 (diff) | |
download | rails-6f16513b587a0805a23eab99d5f283476b1d6687.tar.gz rails-6f16513b587a0805a23eab99d5f283476b1d6687.tar.bz2 rails-6f16513b587a0805a23eab99d5f283476b1d6687.zip |
SQLite3: Always close statements.
SQLite3 adapter must make sure to close statements after queries.
Fixes: #13631
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 170dddb08e..b40d7b3a58 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -299,9 +299,12 @@ module ActiveRecord # Don't cache statements if they are not prepared if without_prepared_statement?(binds) stmt = @connection.prepare(sql) - cols = stmt.columns - records = stmt.to_a - stmt.close + begin + cols = stmt.columns + records = stmt.to_a + ensure + stmt.close + end stmt = records else cache = @statements[sql] ||= { |