Beispiel #1
0
def checksumTable(database, table: str, mode: str):
    object_mode, index = get_metadata_db(database)
    if object_mode:
        mode_db = object_mode.get_mode()
        struct = get_struct(mode_db)
        if mode.lower().strip() == "sha256" or mode.lower().strip() == "md5":
            data = ""
            if table in struct.showTables(database):
                if mode_db != "b":
                    data = table
                else:
                    data = struct.extractTable(database, table)
            else:
                return None
            return checksum_table(1 if mode.lower().strip() == "sha256" else 2, database, mode_db, data)
        else:
            return None

    else:
        return None
Beispiel #2
0
def checksumTable(database, table: str, mode: str):
    object_mode, index = get_object_mode(database)
    if object_mode:
        mode_db = object_mode.get_mode()
        if mode.lower().strip() == "sha256":
            data = ""
            if mode_db.lower().strip() == "avl":
                if table.strip() in avl.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "b":
                if table.strip() in b.showTables(database):
                    data = b.extractTable(database, table)
                else:
                    return None
            elif mode_db.lower().strip() == "bPlus".lower():
                if table.strip() in bPlus.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "dict":
                if table.strip() in diccionario.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "hash":
                if table.strip() in hash.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "isam":
                if table.strip() in isam.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "json":
                if table.strip() in json.showTables(database):
                    data = table
                else:
                    return None
            return checksum_table(1, database, mode_db, data)
        elif mode.lower().strip() == "md5":
            data = ""
            if mode_db.lower().strip() == "avl":
                if table.strip() in avl.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "b":
                if table.strip() in b.showTables(database):
                    data = b.extractTable(database, table)
                else:
                    return None
            elif mode_db.lower().strip() == "bPlus".lower():
                if table.strip() in bPlus.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "dict":
                if table.strip() in diccionario.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "hash":
                if table.strip() in hash.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "isam":
                if table.strip() in isam.showTables(database):
                    data = table
                else:
                    return None
            elif mode_db.lower().strip() == "json":
                if table.strip() in json.showTables(database):
                    data = table
                else:
                    return None
            return checksum_table(2, database, mode_db, data)
        else:
            return None
    else:
        return None