except: parser.error("Source connection values invalid or cannot be parsed.") # Parse destination connection values try: dest_values = parse_connection(opt.destination) except: parser.error("Destination connection values invalid or cannot be parsed.") # Check to see if attempting to use --rpl on the same server if (opt.rpl_mode or opt.rpl_user) and source_values == dest_values: parser.error("You cannot use the --rpl option for copying on the " "same server.") # Check replication options check_rpl_options(parser, opt) # Build list of databases to copy db_list = [] for db in args: grp = re.match("(\w+)(?:\:(\w+))?", db) if not grp: parser.error("Cannot parse database list. Error on '%s'." % db) db_entry = grp.groups() db_list.append(db_entry) try: # record start time if opt.verbosity >= 3: start_test = time.time() dbcopy.copy_db(source_values, dest_values, db_list, options)
# Warn if quiet and verbosity are both specified check_verbosity(opt) try: skips = check_skip_options(opt.skip_objects) except UtilError, e: print "ERROR: %s" % e.errmsg exit(1) # Fail if no db arguments or all if len(args) == 0 and not opt.all: parser.error("You must specify at least one database to export or " "use the --all option to export all databases.") # Check replication options check_rpl_options(parser, opt) # Fail if we have arguments and all databases option listed. check_all(parser, opt, args, "databases") if opt.skip_blobs and not opt.export == "data": print "# WARNING: --skip-blobs option ignored for metadata export." if opt.file_per_tbl and opt.export in ("definitions", "both"): print "# WARNING: --file-per-table option ignored for metadata export." if "data" in skips and opt.export == "data": print "ERROR: You cannot use --export=data and --skip-data when exporting " \ "table data." exit(1)