Beispiel #1
0
                                                      db2_label='db2'))
            parts = grp.groups()
            matched_size = len(parts[0])
            if not parts[1]:
                parts = (parts[0], parts[0])
            else:
                # add 1 for the separator ':'
                matched_size += 1
                matched_size += len(parts[1])
            # Verify if the size of the databases matched by the REGEX is equal
            # to the initial specified string. In general, this identifies the
            # missing use of backticks.
            if matched_size != len(db):
                parser.error(PARSE_ERR_DB_PAIR_EXT.format(db_pair=db,
                                                          db1_label='db1',
                                                          db2_label='db2',
                                                          db1_value=parts[0],
                                                          db2_value=parts[1]))

            # Remove backtick quotes (handled later)
            db1 = remove_backtick_quoting(parts[0], server1_sql_mode) \
                if is_quoted_with_backticks(parts[0], server1_sql_mode) \
                else parts[0]
            db2 = remove_backtick_quoting(parts[1], server1_sql_mode) \
                if is_quoted_with_backticks(parts[1], server1_sql_mode) \
                else parts[1]

            try:
                res = database_compare(server1_values, server2_values,
                                       db1, db2, options)
                if not opt.quiet:
Beispiel #2
0
                                                  db2_label='new_db'))
        db_entry = grp.groups()
        orig_db, new_db = db_entry

        # Verify if the size of the databases matched by the REGEX is equal to
        # the initial specified string. In general, this identifies the missing
        # use of backticks.
        matched_size = len(orig_db)
        if new_db:
            # add 1 for the separator ':'
            matched_size += 1
            matched_size += len(new_db)
        if matched_size != len(db):
            parser.error(PARSE_ERR_DB_PAIR_EXT.format(db_pair=db,
                                                      db1_label='orig_db',
                                                      db2_label='new_db',
                                                      db1_value=orig_db,
                                                      db2_value=new_db))

        # Remove backtick quotes (handled later)
        orig_db = remove_backtick_quoting(orig_db, src_sql_mode) \
            if is_quoted_with_backticks(orig_db, src_sql_mode) else orig_db
        new_db = remove_backtick_quoting(new_db, dest_sql_mode) \
            if new_db and is_quoted_with_backticks(new_db, dest_sql_mode) \
            else new_db
        db_entry = (orig_db, new_db)
        db_list.append(db_entry)

    # Check databases for blob fields set to NOT NULL
    if servers and dbcopy.check_blobs_not_null(servers[0], db_list):
        sys.exit(1)
                                              db2_label='db2'))
    parts = grp.groups()
    matched_size = len(parts[0])
    if not parts[1]:
        parts = (parts[0], parts[0])
    else:
        # add 1 for the separator ':'
        matched_size = matched_size + 1
        matched_size = matched_size + len(parts[1])
    # Verify if the size of the databases matched by the REGEX is equal to the
    # initial specified string. In general, this identifies the missing use
    # of backticks.
    if matched_size != len(db):
        parser.error(PARSE_ERR_DB_PAIR_EXT.format(db_pair=db,
                                                  db1_label='db1',
                                                  db2_label='db2',
                                                  db1_value=parts[0],
                                                  db2_value=parts[1]))

    # Remove backtick quotes (handled later)
    db1 = remove_backtick_quoting(parts[0]) \
                if is_quoted_with_backticks(parts[0]) else parts[0]
    db2 = remove_backtick_quoting(parts[1]) \
                if is_quoted_with_backticks(parts[1]) else parts[1]

    try:
        res = database_compare(server1_values, server2_values,
                               db1, db2, options)
        print
    except UtilError:
        _, e, _ = sys.exc_info()
                                              db2_label='new_db'))
    db_entry = grp.groups()
    orig_db, new_db = db_entry

    # Verify if the size of the databases matched by the REGEX is equal to the
    # initial specified string. In general, this identifies the missing use
    # of backticks.
    matched_size = len(orig_db)
    if new_db:
        # add 1 for the separator ':'
        matched_size = matched_size + 1
        matched_size = matched_size + len(new_db)
    if matched_size != len(db):
        parser.error(PARSE_ERR_DB_PAIR_EXT.format(db_pair=db,
                                                  db1_label='orig_db',
                                                  db2_label='new_db',
                                                  db1_value=orig_db,
                                                  db2_value=new_db))

    # Remove backtick quotes (handled later)
    orig_db = remove_backtick_quoting(orig_db) \
                if is_quoted_with_backticks(orig_db) else orig_db
    new_db = remove_backtick_quoting(new_db) \
                if new_db and is_quoted_with_backticks(new_db) else new_db
    db_entry = (orig_db, new_db)
    db_list.append(db_entry)

try:
    # record start time
    if opt.verbosity >= 3:
        start_test = time.time()
            parser.error(PARSE_ERR_DB_PAIR.format(db_pair=db, db1_label="orig_db", db2_label="new_db"))
        db_entry = grp.groups()
        orig_db, new_db = db_entry

        # Verify if the size of the databases matched by the REGEX is equal to
        # the initial specified string. In general, this identifies the missing
        # use of backticks.
        matched_size = len(orig_db)
        if new_db:
            # add 1 for the separator ':'
            matched_size += 1
            matched_size += len(new_db)
        if matched_size != len(db):
            parser.error(
                PARSE_ERR_DB_PAIR_EXT.format(
                    db_pair=db, db1_label="orig_db", db2_label="new_db", db1_value=orig_db, db2_value=new_db
                )
            )

        # Remove backtick quotes (handled later)
        orig_db = remove_backtick_quoting(orig_db) if is_quoted_with_backticks(orig_db) else orig_db
        new_db = remove_backtick_quoting(new_db) if new_db and is_quoted_with_backticks(new_db) else new_db
        db_entry = (orig_db, new_db)
        db_list.append(db_entry)

    try:
        # Record start time.
        if opt.verbosity >= 3:
            start_copy_time = time.time()

        # Copy databases concurrently for non posix systems (windows).