mysql2_query_filter-plugin-casual_log 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e6cadd21416ab73e104023ef7080f38f9513928
4
- data.tar.gz: 33f27ab2020ace4d7ec88f0555db5ba8f28dc97b
3
+ metadata.gz: 360aaad00af7a02c546d883c269d3e3545178cab
4
+ data.tar.gz: 559226e0b54acd79e02bf04cc3c9b7353ae96cc0
5
5
  SHA512:
6
- metadata.gz: 616b65d944b815c9b03af9aab6c56e59b15993bae94e8f76b9bf86c12aed8c5e015732210c44b05389bb03f6ba1f0861962bfabd889db0b3eb6313029bd24327
7
- data.tar.gz: f27ae65d3483f39d11e43636e588d9c05e222e7865bf22dbe9eeb419a970fa0c23f4a2fbfc93a66f4601b893cb48765fa99daf685e8c02a22c40a5db1606ef9d
6
+ metadata.gz: e9441a2caaa0744184a362208eb0f047e1d37081c6a096adec6ff3cefa7bbd0edaeeb7f919ff90eb206df111e56fba7a225d32a73c0bc567325f336caa203913
7
+ data.tar.gz: 381b2c0a9c44d392feb8167461e1029ba56e59d461f42713d23914c8f7ee7155940e04a23debdddae840539e02156405f1e2ebccb86df2fb4056b2dc481e8395
@@ -32,11 +32,12 @@ module Mysql2QueryFilter::Plugin
32
32
  def initialize(options)
33
33
  super
34
34
  @out = @options.delete(:out) || $stderr
35
+ @matcher = @options.delete(:match) || proc {|sql, query_options| true }
35
36
  @client = Mysql2::Client.new(@options)
36
37
  end
37
38
 
38
- def filter(sql)
39
- if sql =~ /\A\s*select\b/i
39
+ def filter(sql, query_options)
40
+ if sql =~ /\A\s*SELECT\b/i and @matcher.call(sql, query_options)
40
41
  result = @client.query("EXPLAIN #{sql}").first
41
42
  badquery = colorize_explain(result)
42
43
  output_message(sql, result) if badquery
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'mysql2_query_filter-plugin-casual_log'
4
- spec.version = '0.0.2'
4
+ spec.version = '0.0.3'
5
5
  spec.authors = ['Genki Sugawara']
6
6
  spec.email = ['sgwr_dts@yahoo.co.jp']
7
7
  spec.summary = %q{Plug-in that colorize the bad query for Mysql2QueryFilter.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql2_query_filter-plugin-casual_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara