Module: Mysql2::Client::GeneralLog

Included in:
Mysql2::Client
Defined in:
lib/mysql2/client/general_log.rb,
lib/mysql2/client/general_log/version.rb

Defined Under Namespace

Classes: Log

Constant Summary collapse

VERSION =
"0.2.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#general_logObject

Returns the value of attribute general_log.



15
16
17
# File 'lib/mysql2/client/general_log.rb', line 15

def general_log
  @general_log
end

Instance Method Details

#initialize(opts = {}) ⇒ Object



17
18
19
20
# File 'lib/mysql2/client/general_log.rb', line 17

def initialize(opts = {})
  @general_log = []
  super
end

#query(sql, options = {}) ⇒ Object

dependent on Mysql2::Client#query



23
24
25
26
27
28
29
30
# File 'lib/mysql2/client/general_log.rb', line 23

def query(sql, options={})
  ret = nil
  time = Benchmark.realtime do
    ret = super
  end
  @general_log << Log.new(sql, caller_locations, time)
  ret
end