class PG::Connection
Public Instance Methods
async_exec(*args,&blk)
click to toggle source
# File lib/patches/db/pg.rb, line 89 def async_exec(*args,&blk) return exec_without_profiling(*args,&blk) unless SqlPatches.should_measure? start = Time.now result = exec_without_profiling(*args,&blk) elapsed_time = SqlPatches.elapsed_time(start) record = ::Rack::MiniProfiler.record_sql(args[0], elapsed_time) result.instance_variable_set("@miniprofiler_sql_id", record) if result result end
Also aliased as: async_exec_without_profiling
exec(*args,&blk)
click to toggle source
# File lib/patches/db/pg.rb, line 49 def exec(*args,&blk) return exec_without_profiling(*args,&blk) unless SqlPatches.should_measure? start = Time.now result = exec_without_profiling(*args,&blk) elapsed_time = SqlPatches.elapsed_time(start) record = ::Rack::MiniProfiler.record_sql(args[0], elapsed_time) result.instance_variable_set("@miniprofiler_sql_id", record) if result result end
Also aliased as: exec_without_profiling, query
exec_prepared(*args,&blk)
click to toggle source
# File lib/patches/db/pg.rb, line 61 def exec_prepared(*args,&blk) return exec_prepared_without_profiling(*args,&blk) unless SqlPatches.should_measure? start = Time.now result = exec_prepared_without_profiling(*args,&blk) elapsed_time = SqlPatches.elapsed_time(start) mapped = args[0] mapped = @prepare_map[mapped] || args[0] if @prepare_map record = ::Rack::MiniProfiler.record_sql(mapped, elapsed_time) result.instance_variable_set("@miniprofiler_sql_id", record) if result result end
Also aliased as: exec_prepared_without_profiling
prepare(*args,&blk)
click to toggle source
# File lib/patches/db/pg.rb, line 36 def prepare(*args,&blk) # we have no choice but to do this here, # if we do the check for profiling first, our cache may miss critical stuff @prepare_map ||= {} @prepare_map[args[0]] = args[1] # dont leak more than 10k ever @prepare_map = {} if @prepare_map.length > 1000 return prepare_without_profiling(*args,&blk) unless SqlPatches.should_measure? prepare_without_profiling(*args,&blk) end
Also aliased as: prepare_without_profiling
send_query_prepared(*args,&blk)
click to toggle source
# File lib/patches/db/pg.rb, line 75 def send_query_prepared(*args,&blk) return send_query_prepared_without_profiling(*args,&blk) unless SqlPatches.should_measure? start = Time.now result = send_query_prepared_without_profiling(*args,&blk) elapsed_time = SqlPatches.elapsed_time(start) mapped = args[0] mapped = @prepare_map[mapped] || args[0] if @prepare_map record = ::Rack::MiniProfiler.record_sql(mapped, elapsed_time) result.instance_variable_set("@miniprofiler_sql_id", record) if result result end
Also aliased as: send_query_prepared_without_profiling