Пример #1
0
def extractTable(database: str, table: str) -> list:
    try:
        retorno = []
        db = __buscarLlaveBaseDato(database)
        modoDB = db[0]
        if db is not None:
            tablas = db[2]
            if tablas:
                if tablas.get(table) is not None:
                    modoDB = tablas[table]

            if modoDB == "avl":
                retorno = avl.extractTable(database, table)
            elif modoDB == "b":
                retorno = b.extractTable(database, table)
            elif modoDB == "bplus":
                retorno = bPlus.extractTable(database, table)
            elif modoDB == "dict":
                retorno = dic.extractTable(database, table)
            elif modoDB == "isam":
                retorno = isam.extractTable(database, table)
            elif modoDB == "json":
                retorno = json.extractTable(database, table)
            elif modoDB == "hash":
                retorno = hash.extractTable(database, table)
            return retorno
        else:
            return None

    except Exception:
        return None
Пример #2
0
def extractTable(database, table):
    if searchInMode(database) != None:
        currentMode = searchInMode(database)
        if currentMode == 'avl':
            # avlList.append(tableNew)
            return avl.extractTable(database, table)
        elif currentMode == 'b':
            # bList.append(tableNew)
            return b.extractTable(database, table)
        elif currentMode == 'bplus':
            # bplusList.append(tableNew)
            return bplus.extractTable(database, table)
        elif currentMode == 'dict':
            # dictList.append(tableNew)
            return DM.extractTable(database, table)
        elif currentMode == 'isam':
            # isamList.append(tableNew)
            return isam.extractTable(database, table)
        elif currentMode == 'json':
            # jsonList.append(tableNew)
            return j.extractTable(database, table)
        elif currentMode == 'hash':
            # hashList.append(tableNew)
            return Hash.extractTable(database, table)
    else:
        return 2
Пример #3
0
def extractTable(database, table):
    dbs = databases.find_all(database)
    if dbs == []:
        return None
    if databases.find_table(database, table) == None:
        return None
    result = []
    for db in dbs:
        tb = db.tables.search(table)
        if tb != None:
            if db.mode == "avl":
                result = avlMode.extractTable(database, table)
            elif db.mode == "b":
                result = BMode.extractTable(database, table)
            elif db.mode == "bplus":
                result = BPlusMode.extractTable(database, table)
            elif db.mode == "dict":
                result = DictMode.extractTable(database, table)
            elif db.mode == "isam":
                result = ISAMMode.extractTable(database, table)
            elif db.mode == "json":
                result = jsonMode.extractTable(database, table)
            elif db.mode == "hash":
                result = HashMode.extractTable(database, table)
            else:
                continue
    return result
Пример #4
0
def extractTable(database: str, table: str) -> list:
    """Shows the content of a table in a database

        Parameters:\n
            database (str): name of the database
            table (str): name of the table

        Returns:\n
            list: successful operation
            None: non-existent database, non-existent table, an error ocurred
    """

    bd = _database(database)

    if bd:

        tb = _table(database, table)

        if tb:

            mode = tb["modo"]

            val = -1

            if mode == "avl":
                val = avl.extractTable(database, table)

            elif mode == "b":
                val = b.extractTable(database, table)

            elif mode == "bplus":
                val = bplus.extractTable(database, table)

            elif mode == "hash":
                val = hash.extractTable(database, table)

            elif mode == "isam":
                val = isam.extractTable(database, table)

            elif mode == "json":
                val = json.extractTable(database, table)

            elif mode == "dict":
                val = dict.extractTable(database, table)

            return val

        else:
            return 3

    else:
        return 2
Пример #5
0
def get_Data(database: str, table: str, mode: str):
    if mode.lower().strip() == "avl":
        return avl.extractTable(database, table)
    elif mode.lower().strip() == "b":
        return b.extractTable(database, table)
    elif mode.lower().strip() == "bPlus".lower():
        return bPlus.extractTable(database, table)
    elif mode.lower().strip() == "dict":
        return diccionario.extractTable(database, table)
    elif mode.lower().strip() == "isam":
        return isam.extractTable(database, table)
    elif mode.lower().strip() == "hash":
        return hash.extractTable(database, table)
    elif mode.lower().strip() == "json":
        return json.extractTable(database, table)
Пример #6
0
def __extraerContenidoTabla(tabla: str, modoDB: str, database: str) -> list:
    retorno = None
    if modoDB == "avl":
        retorno = avl.extractTable(database, tabla)
    elif modoDB == "b":
        retorno = b.extractTable(database, tabla)
    elif modoDB == "bplus":
        retorno = bPlus.extractTable(database, tabla)
    elif modoDB == "dict":
        retorno = dic.extractTable(database, tabla)
    elif modoDB == "isam":
        retorno = isam.extractTable(database, tabla)
    elif modoDB == "json":
        retorno = json.extractTable(database, tabla)
    elif modoDB == "hash":
        retorno = hash.extractTable(database, tabla)
    return retorno