diff options
3 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index e01419224b..3318075e9e 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -332,6 +332,7 @@ module ActiveRecord rows end + # Clear prepared statement cache. def clear_cache! @statements.values.each do |cache| cache[:stmt].close diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 94cf8d45d6..ba7852192e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -237,6 +237,7 @@ module ActiveRecord @local_tz = execute('SHOW TIME ZONE', 'SCHEMA').first["TimeZone"] end + # Clear prepared statement cache. def clear_cache! @statements.each_value do |value| @connection.query "DEALLOCATE #{value}" diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 5d2ebff9a7..326f22ce82 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -96,6 +96,7 @@ module ActiveRecord @connection.close rescue nil end + # Clear prepared statement cache. def clear_cache! @statements.clear end |