Class: Mycmd::SettingsCommands

Inherits:
Thor
  • Object
show all
Defined in:
lib/mycmd/cli/settings_commands.rb

Constant Summary collapse

GLOBAL_BUFFERS =
[
  :innodb_buffer_pool_size,
  :innodb_log_buffer_size,
  :innodb_additional_mem_pool_size,
  :key_buffer_size,
  :query_cache_size
].freeze
THREAD_BUFFERS =
[
  :sort_buffer_size,
  :read_buffer_size,
  :read_rnd_buffer_size,
  :join_buffer_size,
  :tmp_table_size,
  :max_heap_table_size,
  :net_buffer_length,
  :max_allowed_packet,
  :thread_stack
].freeze

Instance Method Summary collapse

Instance Method Details

#memoriesObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/mycmd/cli/settings_commands.rb', line 35

def memories
  variables = Configuration.get_variables
  global, gtotal = create_result_variables(GLOBAL_BUFFERS, variables)
  thread, ttotal = create_result_variables(THREAD_BUFFERS, variables)
  expected = expected_memory_used(gtotal, variables)
  Printer.print_title("GLOBAL BUFFERS")
  Printer.new(global).print
  Printer.print_title("THREAD BUFFERS", true)
  Printer.new(thread).print
  Printer.print_title("EXPECTED MEMORY USED", true)
  Printer.new(expected).print
end

#search(keyword) ⇒ Object



28
29
30
31
32
# File 'lib/mycmd/cli/settings_commands.rb', line 28

def search(keyword)
  client = Configuration.connect
  printer = Printer.new(client.query("SHOW GLOBAL VARIABLES LIKE '%#{keyword}%'"))
  printer.print
end