Module: Mysql2::Client::RackDevInsight

Included in:
Mysql2::Client
Defined in:
lib/rack/dev_insight/patches/sql/mysql2.rb

Instance Method Summary collapse

Instance Method Details

#prepare(*args, &block) ⇒ Object



14
15
16
17
18
19
# File 'lib/rack/dev_insight/patches/sql/mysql2.rb', line 14

def prepare(*args, &block)
  sql = args[0]
  statement = super
  statement.instance_variable_set(:@_rack_dev_insight_sql, sql)
  statement
end

#query(*args, &block) ⇒ Object



7
8
9
10
11
12
# File 'lib/rack/dev_insight/patches/sql/mysql2.rb', line 7

def query(*args, &block)
  sql = args[0]
  Rack::DevInsight::SqlRecorder
    .new
    .record_sql(dialect: Rack::DevInsight::SqlDialects::MYSQL, statement: sql) { super }
end