mysql2_query_filter-plugin-casual_log 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 360aaad00af7a02c546d883c269d3e3545178cab
|
4
|
+
data.tar.gz: 559226e0b54acd79e02bf04cc3c9b7353ae96cc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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*
|
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.
|
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.}
|