Class: PG::Result

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

Overview

PG patches, keep in mind exec and async_exec have a exec{|r| } semantics that is yet to be implemented

Instance Method Summary collapse

Instance Method Details

#each(*args, &blk) ⇒ Object



13
14
15
16
17
18
# File 'lib/patches/db/pg.rb', line 13

def each(*args, &blk)
  return each_without_profiling(*args, &blk) unless @miniprofiler_sql_id
  mp_report_sql do
    each_without_profiling(*args, &blk)
  end
end

#each_without_profilingObject



3
# File 'lib/patches/db/pg.rb', line 3

alias_method :each_without_profiling, :each

#mp_report_sql(&block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/patches/db/pg.rb', line 20

def mp_report_sql(&block)
  start        = Time.now
  result       = yield
  elapsed_time = SqlPatches.elapsed_time(start)
  @miniprofiler_sql_id.report_reader_duration(elapsed_time)
  result
end

#values(*args, &blk) ⇒ Object



6
7
8
9
10
11
# File 'lib/patches/db/pg.rb', line 6

def values(*args, &blk)
  return values_without_profiling(*args, &blk) unless @miniprofiler_sql_id
  mp_report_sql do
    values_without_profiling(*args ,&blk)
  end
end

#values_without_profilingObject



4
# File 'lib/patches/db/pg.rb', line 4

alias_method :values_without_profiling, :values