Class: Maatkit::QueryAdvisor
- Inherits:
-
Object
- Object
- Maatkit::QueryAdvisor
- Defined in:
- lib/maatkit-ruby/mk-query-advisor.rb
Overview
Analyze queries and advise on possible problems.
Maatkit::QueryAdvisor.new( array, str, array)
Instance Attribute Summary collapse
-
#ask_pass ⇒ Object
FALSE.
-
#charset ⇒ Object
(No # value).
-
#config ⇒ Object
/etc/maatkit/maatkit.conf,/etc/maatkit/mk_query_advisor.conf,/home/joel/.maatkit.conf,/home/joel/.mk_query_advisor.conf.
-
#continue_on_error ⇒ Object
TRUE.
-
#daemonize ⇒ Object
FALSE.
-
#defaults_file ⇒ Object
(No # value).
-
#help ⇒ Object
TRUE.
-
#host ⇒ Object
(No # value).
-
#ignore_rules ⇒ Object
(No # value).
-
#password ⇒ Object
(No # value).
-
#path_to_mk_query_advisor ⇒ Object
Sets the executable path, otherwise the environment path will be used.
-
#pid ⇒ Object
(No # value).
-
#port ⇒ Object
(No # value).
-
#print_all ⇒ Object
FALSE.
-
#query ⇒ Object
(No # value).
-
#report_format ⇒ Object
compact.
-
#review ⇒ Object
(No # value).
-
#sample ⇒ Object
1.
-
#set_vars ⇒ Object
wait_timeout=10000.
-
#socket ⇒ Object
(No # value).
-
#type ⇒ Object
slowlog.
-
#user ⇒ Object
(No # value).
-
#verbose ⇒ Object
1.
-
#version ⇒ Object
FALSE.
-
#where ⇒ Object
(No # value).
Instance Method Summary collapse
-
#initialize ⇒ QueryAdvisor
constructor
Returns a new QueryAdvisor Object.
-
#start(options = nil) ⇒ Object
Execute the command.
Constructor Details
#initialize ⇒ QueryAdvisor
Returns a new QueryAdvisor Object
48 49 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 48 def initialize() end |
Instance Attribute Details
#ask_pass ⇒ Object
FALSE
15 16 17 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 15 def ask_pass @ask_pass end |
#charset ⇒ Object
(No # value)
16 17 18 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 16 def charset @charset end |
#config ⇒ Object
/etc/maatkit/maatkit.conf,/etc/maatkit/mk_query_advisor.conf,/home/joel/.maatkit.conf,/home/joel/.mk_query_advisor.conf
17 18 19 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 17 def config @config end |
#continue_on_error ⇒ Object
TRUE
18 19 20 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 18 def continue_on_error @continue_on_error end |
#daemonize ⇒ Object
FALSE
19 20 21 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 19 def daemonize @daemonize end |
#defaults_file ⇒ Object
(No # value)
20 21 22 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 20 def defaults_file @defaults_file end |
#help ⇒ Object
TRUE
21 22 23 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 21 def help @help end |
#host ⇒ Object
(No # value)
22 23 24 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 22 def host @host end |
#ignore_rules ⇒ Object
(No # value)
23 24 25 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 23 def ignore_rules @ignore_rules end |
#password ⇒ Object
(No # value)
24 25 26 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 24 def password @password end |
#path_to_mk_query_advisor ⇒ Object
Sets the executable path, otherwise the environment path will be used.
43 44 45 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 43 def path_to_mk_query_advisor @path_to_mk_query_advisor end |
#pid ⇒ Object
(No # value)
25 26 27 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 25 def pid @pid end |
#port ⇒ Object
(No # value)
26 27 28 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 26 def port @port end |
#print_all ⇒ Object
FALSE
27 28 29 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 27 def print_all @print_all end |
#query ⇒ Object
(No # value)
28 29 30 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 28 def query @query end |
#report_format ⇒ Object
compact
29 30 31 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 29 def report_format @report_format end |
#review ⇒ Object
(No # value)
30 31 32 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 30 def review @review end |
#sample ⇒ Object
1
31 32 33 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 31 def sample @sample end |
#set_vars ⇒ Object
wait_timeout=10000
32 33 34 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 32 def set_vars @set_vars end |
#socket ⇒ Object
(No # value)
33 34 35 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 33 def socket @socket end |
#type ⇒ Object
slowlog
34 35 36 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 34 def type @type end |
#user ⇒ Object
(No # value)
35 36 37 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 35 def user @user end |
#verbose ⇒ Object
1
36 37 38 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 36 def verbose @verbose end |
#version ⇒ Object
FALSE
37 38 39 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 37 def version @version end |
#where ⇒ Object
(No # value)
38 39 40 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 38 def where @where end |
Instance Method Details
#start(options = nil) ⇒ Object
Execute the command
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/maatkit-ruby/mk-query-advisor.rb', line 54 def start( = nil) tmp = Tempfile.new('tmp') command = option_string() + .to_s + " 2> " + tmp.path success = system(command) if success begin while (line = tmp.readline) line.chomp selected_string = line end rescue EOFError tmp.close end return selected_string else tmp.close! return success end end |