aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
index 4fe0013f0f..4a48812807 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -104,6 +104,8 @@ module ActiveRecord
def initialize(connection, logger, config)
super(connection, logger)
+
+ @active = nil
@statements = StatementPool.new(@connection,
config.fetch(:statement_limit) { 1000 })
@config = config
@@ -154,11 +156,15 @@ module ActiveRecord
true
end
+ def active?
+ @active != false
+ end
+
# Disconnects from the database if already connected. Otherwise, this
# method does nothing.
def disconnect!
super
- clear_cache!
+ @active = false
@connection.close rescue nil
end
@@ -397,7 +403,7 @@ module ActiveRecord
table_name,
row['name'],
row['unique'] != 0,
- exec_query("PRAGMA index_info('#{row['name']}')", "Columns for index #{row['name']} on #{table_name}").map { |col|
+ exec_query("PRAGMA index_info('#{row['name']}')", "SCHEMA").map { |col|
col['name']
})
end