module Sequel::Postgres::StatementCache::DatabaseMethods

  1. lib/sequel/extensions/pg_statement_cache.rb
Parent: StatementCache

Methods

Public Class

  1. extended

Public Instance

  1. alter_table
  2. drop_table

Public Class methods

extended (db)

Setup the after_connect proc for the connection pool to make sure the connection object is extended with the appropriate module. This disconnects any existing connections to ensure that all connections in the pool have been extended appropriately.

[show source]
# File lib/sequel/extensions/pg_statement_cache.rb, line 276
def self.extended(db)
  # Respect existing after_connect proc if one is present
  pr = db.opts[:after_connect]

  # Set the after_connect proc to extend the adapter with
  # the statement cache support.
  db.pool.after_connect = db.opts[:after_connect] = proc do |c|
    pr.call(c) if pr
    c.extend(AdapterMethods)
  end

  # Disconnect to make sure all connections get set up with
  # statement cache.
  db.disconnect
end

Public Instance methods

alter_table (*)

Clear statement caches for all connections when altering tables.

[show source]
# File lib/sequel/extensions/pg_statement_cache.rb, line 293
def alter_table(*)
  clear_statement_caches
  super
end
drop_table (*)

Clear statement caches for all connections when dropping tables.

[show source]
# File lib/sequel/extensions/pg_statement_cache.rb, line 299
def drop_table(*)
  clear_statement_caches
  super
end