module PG::Connection::GeneralLog::ConnectionExt

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/connection_ext.rb, line 5
def initialize(*)
  @stmt_map = {}
  super
end

Public Instance Methods

async_exec(*args) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/connection_ext.rb, line 47
def async_exec(*args)
  sql, params = args
  ret = nil
  time = Benchmark.realtime do
    ret = super
  end
  GeneralLog.general_log.push(sql, params || [], caller_locations, time)
  ret
end
exec(sql) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/connection_ext.rb, line 10
def exec(sql)
  ret = nil
  time = Benchmark.realtime do
    ret = super
  end
  GeneralLog.general_log.push(sql, [], caller_locations, time)
  ret
end
exec_params(*args) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/connection_ext.rb, line 19
def exec_params(*args)
  sql, params = args
  ret = nil
  time = Benchmark.realtime do
    ret = super
  end
  GeneralLog.general_log.push(sql, params, caller_locations, time)
  ret
end
exec_prepared(*args) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/connection_ext.rb, line 35
def exec_prepared(*args)
  stmt_name, params = args
  sql = @stmt_map[stmt_name]

  ret = nil
  time = Benchmark.realtime do
    ret = super
  end
  GeneralLog.general_log.push(sql, params, caller_locations, time)
  ret
end
prepare(*args) click to toggle source
Calls superclass method
# File lib/pg/connection/general_log/connection_ext.rb, line 29
def prepare(*args)
  stmt_name, sql = args
  @stmt_map[stmt_name] = sql
  super
end