Class: PG::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/patches/sql_patches.rb

Instance Method Summary collapse

Instance Method Details

#async_exec(*args, &blk) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/patches/sql_patches.rb', line 107

def async_exec(*args,&blk)
  current = ::Rack::MiniProfiler.current
  return exec_without_profiling(*args,&blk) unless current

  start = Time.now
  result = exec_without_profiling(*args,&blk)
  elapsed_time = ((Time.now - start).to_f * 1000).round(1)
  result.instance_variable_set("@miniprofiler_sql_id", ::Rack::MiniProfiler.record_sql(args[0], elapsed_time))

  result
end

#async_exec_without_profilingObject



93
# File 'lib/patches/sql_patches.rb', line 93

alias_method :async_exec_without_profiling, :async_exec

#exec(*args, &blk) ⇒ Object Also known as: query



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/patches/sql_patches.rb', line 95

def exec(*args,&blk)
  current = ::Rack::MiniProfiler.current
  return exec_without_profiling(*args,&blk) unless current

  start = Time.now
  result = exec_without_profiling(*args,&blk)
  elapsed_time = ((Time.now - start).to_f * 1000).round(1)
  result.instance_variable_set("@miniprofiler_sql_id", ::Rack::MiniProfiler.record_sql(args[0], elapsed_time))

  result
end

#exec_without_profilingObject



92
# File 'lib/patches/sql_patches.rb', line 92

alias_method :exec_without_profiling, :exec