Class: Mysql2::Result

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

Overview

The best kind of instrumentation is in the actual db provider, however we don’t want to double instrument

Instance Method Summary collapse

Instance Method Details

#each(*args, &blk) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/patches/db/mysql2.rb', line 5

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

  start        = Time.now
  result       = each_without_profiling(*args,&blk)
  elapsed_time = SqlPatches.elapsed_time(start)

  @miniprofiler_sql_id.report_reader_duration(elapsed_time)
  result
end

#each_without_profilingObject



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

alias_method :each_without_profiling, :each