method
dealloc
v8.1.1 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::StatementPool
dealloc(key)private
No documentation available.
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 317
def dealloc(key)
# This is ugly, but safe: the statement pool is only
# accessed while holding the connection's lock. (And we
# don't need the complication of with_raw_connection because
# a reconnect would invalidate the entire statement pool.)
if (conn = @connection.instance_variable_get(:@raw_connection)) && conn.status == PG::CONNECTION_OK
if @connection.supports_close_prepared?
conn.close_prepared key
else
conn.query "DEALLOCATE #{key}"
end
end
rescue PG::Error
end