class DBShell::Client::MySQL

Constants

EXECUTABLE_NAME

Public Class Methods

build_command(db_info) click to toggle source
# File lib/dbshell/client/mysql.rb, line 11
def self.build_command(db_info)
  args = [EXECUTABLE_NAME]

  host = db_info['host']
  port = db_info['port']
  db_name = db_info['database']
  user = db_info['username']
  password = db_info['password']

  args.push("--user=#{user}") if user
  args.push("--password=#{password}") if password
  args.push("--host=#{host}") if host
  args.push("--port=#{port}") if port
  args.push(db_name)
end
runshell(db_info) click to toggle source
# File lib/dbshell/client/mysql.rb, line 6
def self.runshell(db_info)
  args = self.build_command(db_info)
  exec(*args)
end