Beispiel #1
0
def obtenerAtributosTabla(database, table):
    mode = None
    for i in range(7):
        mode = obtenerBase(database, i)
        if mode == []:
            continue
        else:
            if mode == 0:
                mode = "avl"
            elif mode == 1:
                mode = "b"
            elif mode == 2:
                mode = "bplus"
            elif mode == 3:
                mode = "dict"
            elif mode == 4:
                mode = "isam"
            elif mode == 5:
                mode = "json"
            elif mode == 6:
                mode = "hash"
            break
    if mode == None:
        return 2
    if mode == "avl":
        # Grupo 16
        val = avl_mode.dropTable(database, table)
    elif mode == "b":
        # Grupo 17
        val = b_mode.dropTable(database, table)
    elif mode == "bplus":
        # Grupo 18
        val = bplus_mode.dropTable(database, table)
    elif mode == "dict":
        # Auxiliar
        val = dict_mode.dropTable(database, table)
    elif mode == "isam":
        # Grupo 14
        val = isam_mode.dropTable(database, table)
    elif mode == "json":
        # Ingeniero
        val = json_mode.dropTable(database, table)
    elif mode == "hash":
        # Grupo 15
        val = hash_mode.dropTable(database, table)
    else:
        val = 3
    return val
Beispiel #2
0
def dropTable(database, table):
    mode = None
    for i in range(7):
        mode = obtenerBase(database, i)
        if mode == []:
            continue
        else:
            if mode == 0:
                mode = "avl"
            elif mode == 1:
                mode = "b"
            elif mode == 2:
                mode = "bplus"
            elif mode == 3:
                mode = "dict"
            elif mode == 4:
                mode = "isam"
            elif mode == 5:
                mode = "json"
            elif mode == 6:
                mode = "hash"
            break
    if mode == None:
        return 2
    if mode == "avl":
        # Grupo 16
        val = avl_mode.dropTable(database, table)
    elif mode == "b":
        # Grupo 17
        val = b_mode.dropTable(database, table)
    elif mode == "bplus":
        # Grupo 18
        val = bplus_mode.dropTable(database, table)
    elif mode == "dict":
        # Auxiliar
        val = dict_mode.dropTable(database, table)
    elif mode == "isam":
        # Grupo 14
        val = isam_mode.dropTable(database, table)
    elif mode == "json":
        # Ingeniero
        val = json_mode.dropTable(database, table)
    elif mode == "hash":
        # Grupo 15
        val = hash_mode.dropTable(database, table)
    else:
        val = 3
    if val == 0:
        global Tablas
        try:
            # Leemos el archivo binario de los registros de bases de datos
            fichero_lectura = open("TB_register", "rb")
            Tablas = pickle.load(fichero_lectura)
            Tablas[database].pop(table)
            if len(Tablas[database]) == 0:
                Tablas.pop(database)
            # Actualizamos el archivo binario de los registros de bases de datos
            fichero_escritura = open("TB_register", "wb")
            pickle.dump(Tablas, fichero_escritura)
            fichero_escritura.close()
        except:
            Tablas[database].pop(table)
            if len(Tablas[database]) == 0:
                Tablas.pop(database)
            # Actualizamos el archivo binario de los registros de bases de datos
            fichero_escritura = open("TB_register", "wb")
            pickle.dump(Tablas, fichero_escritura)
            fichero_escritura.close()
    return val