Class: Arproxy::Plugin::MysqlCasualLog
- Inherits:
-
Base
- Object
- Base
- Arproxy::Plugin::MysqlCasualLog
- Defined in:
- lib/arproxy/plugin/mysql_casual_log.rb
Constant Summary collapse
- REGEXPS =
{ 'select_type' => Regexp.union( /DEPENDENT\sUNION/, /DEPENDENT\sSUBQUERY/, /UNCACHEABLE\sUNION/, /UNCACHEABLE\sSUBQUERY/ ), 'type' => Regexp.union( /index/, /ALL/ ), 'possible_keys' => Regexp.union( /NULL/ ), 'key' => Regexp.union( /NULL/ ), 'Extra' => Regexp.union( /Using\sfilesort/, /Using\stemporary/ ) }
Instance Method Summary collapse
- #execute(sql, name = nil) ⇒ Object
-
#initialize(*args) ⇒ MysqlCasualLog
constructor
A new instance of MysqlCasualLog.
Constructor Details
#initialize(*args) ⇒ MysqlCasualLog
Returns a new instance of MysqlCasualLog.
32 33 34 35 36 |
# File 'lib/arproxy/plugin/mysql_casual_log.rb', line 32 def initialize(*args) @options = args.first || {} @out = @options[:out] || $stdout @raw_connection = @options[:raw_connection] || proc {|conn, sql| conn.raw_connection } end |
Instance Method Details
#execute(sql, name = nil) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/arproxy/plugin/mysql_casual_log.rb', line 38 def execute(sql, name=nil) if sql =~ /\ASELECT\b/i proxy(sql) end super(sql, name) end |