Class: DB2Fog::MysqlAdaptor

Inherits:
Object
  • Object
show all
Defined in:
lib/db2fog.rb

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ MysqlAdaptor

Returns a new instance of MysqlAdaptor.



95
96
97
# File 'lib/db2fog.rb', line 95

def initialize(credentials)
  @credentials = credentials
end

Instance Method Details

#dumpObject



99
100
101
102
103
104
105
106
107
# File 'lib/db2fog.rb', line 99

def dump
  dump_file = Tempfile.new("dump")

  cmd = "mysqldump --quick --single-transaction --create-options #{mysql_options}"
  cmd += " | gzip -9 > #{dump_file.path}"
  run(cmd)

  dump_file.path
end

#restore(path) ⇒ Object



109
110
111
# File 'lib/db2fog.rb', line 109

def restore(path)
  run "gunzip -c #{path} | mysql #{mysql_options}"
end