Sha256: 8f258e4fa7af8a0fe981e694d12e4b5d871861fdba7fc1901078fbf3a35220af
Contents?: true
Size: 1.11 KB
Versions: 28
Compression:
Stored size: 1.11 KB
Contents
require 'flydata/command/sync' require 'flydata/source_mysql/command/mysql_command_base' # Command class must be in module Flydata::Command module Flydata module Command class Mysqldump < Sync include MysqlCommandBase def generate_command(dbconf, args) dbconf.delete('tables') dbconf[:custom_option_end] = build_custom_option_end(args) dbconf[:command] = 'mysqldump' FlydataCore::Mysql::CommandGenerator::generate_mysql_cmd(dbconf) end # Workaround to build --where options correctly # # [Background] # Arguments including single/double quotations don't work because those quotations # are removed from the system. # # User's command: # flydata mysqldump table_a --where "id = 1001" # ARGV: # ["table_a", "--where", "id", "=", "1001"] # def build_custom_option_end(args) ret = [] while v = args.shift ret << v if v == '--where' ret << %Q|"#{args.join(' ')}"| break end end ret.join(' ') end end end end
Version data entries
28 entries across 28 versions & 1 rubygems