class DB2Fog::MysqlAdaptor

Public Instance Methods

dump_command(dump_file) click to toggle source
    # File lib/db2fog.rb
110 def dump_command(dump_file)
111   cmd = "mysqldump --quick --single-transaction --create-options #{mysql_options}"
112   cmd += " | gzip -9 > #{dump_file.path}"
113 end
restore(path) click to toggle source
    # File lib/db2fog.rb
115 def restore(path)
116   run "gunzip -c #{path} | mysql #{mysql_options}"
117 end

Private Instance Methods

mysql_options() click to toggle source
    # File lib/db2fog.rb
121 def mysql_options
122   cmd = ''
123   cmd += " -u #{@credentials[:username]} " unless @credentials[:username].nil?
124   cmd += " -p'#{@credentials[:password]}'" unless @credentials[:password].nil?
125   cmd += " -h '#{@credentials[:host]}'"    unless @credentials[:host].nil?
126   cmd += " --default-character-set=#{@credentials[:encoding]}" unless @credentials[:encoding].nil?
127   cmd += " #{@credentials[:database]}"
128 end