예제 #1
0
def extractRow(database: str, table: str, columns: list) -> list:
    try:
        retorno = 1
        db = __buscarLlaveBaseDato(database)
        if db is not None:
            modoDB = db[0]
            if modoDB == "avl":
                retorno = avl.extractRow(database, table, columns)
            elif modoDB == "b":
                retorno = b.extractRow(database, table, columns)
            elif modoDB == "bplus":
                retorno = bPlus.extractRow(database, table, columns)
            elif modoDB == "dict":
                retorno = dic.extractRow(database, table, columns)
            elif modoDB == "isam":
                retorno = isam.extractRow(database, table, columns)
            elif modoDB == "json":
                retorno = json.extractRow(database, table, columns)
            elif modoDB == "hash":
                retorno = hash.extractRow(database, table, columns)
            return retorno
        else:
            return []

    except Exception:
        return []
예제 #2
0
파일: Bases.py 프로젝트: GleyP/Test
def extractRow(database, table, columns):
    if searchInMode(database) != None:
        currentMode = searchInMode(database)
        if currentMode == 'avl':
            # avlList.append(tableNew)
            return avl.extractRow(database, table, columns)
        elif currentMode == 'b':
            # bList.append(tableNew)
            return b.extractRow(database, table, columns)
        elif currentMode == 'bplus':
            # bplusList.append(tableNew)
            return bplus.extractRow(database, table, columns)
        elif currentMode == 'dict':
            # dictList.append(tableNew)
            return DM.extractRow(database, table, columns)
        elif currentMode == 'isam':
            # isamList.append(tableNew)
            return isam.extractRow(database, table, columns)
        elif currentMode == 'json':
            # jsonList.append(tableNew)
            return j.extractRow(database, table, columns)
        elif currentMode == 'hash':
            # hashList.append(tableNew)
            return Hash.extractRow(database, table, columns)
    else:
        return 2
예제 #3
0
def extractRow(database, table, columns):
    dbs = databases.find_all(database)
    if dbs == []:
        return []
    if databases.find_table(database, table) == None:
        return []
    result = []
    for db in dbs:
        if db.tables.search(table) == None:
            continue
        if db.mode == "avl":
            result = avlMode.extractRow(database, table, columns)
        elif db.mode == "b":
            result = BMode.extractRow(database, table, columns)
        elif db.mode == "bplus":
            result = BPlusMode.extractRow(database, table, columns)
        elif db.mode == "dict":
            result = DictMode.extractRow(database, table, columns)
        elif db.mode == "isam":
            result = ISAMMode.extractRow(database, table, columns)
        elif db.mode == "json":
            result = jsonMode.extractRow(database, table, columns)
        elif db.mode == "hash":
            result = HashMode.extractRow(database, table, columns)
    return result
예제 #4
0
def extractRow(database: str, table: str, columns: list) -> list:
    """Shows a register of a table in a database

        Parameters:\n
            database (str): name of the database
            table (str): name of the table
            columns (list): PK of target register

        Returns:\n
            list: succesful operation
            empty list: 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.extractRow(database, table, columns)

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

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

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

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

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

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

            return val

        else:
            return 3

    else:
        return 2
예제 #5
0
def extractRow(database, table, columns):
    db = databases.search(database)
    if db == None:
        return 2
    if db.mode == "avl":
        result = avlMode.extractRow(database, table, columns)
    elif db.mode == "b":
        result = BMode.extractRow(database, table, columns)
    elif db.mode == "bplus":
        result = BPlusMode.extractRow(database, table, columns)
    elif db.mode == "dict":
        result = DictMode.extractRow(database, table, columns)
    elif db.mode == "isam":
        result = ISAMMode.extractRow(database, table, columns)
    elif db.mode == "json":
        result = jsonMode.extractRow(database, table, columns)
    elif db.mode == "hash":
        result = HashMode.extractRow(database, table, columns)
    return result
예제 #6
0
파일: Manager.py 프로젝트: cesargp45/tytus
def extractRow(database, name_table, columns):
    ModeDB, indexDB = exist_Alter(database)
    if ModeDB:
        mode = ModeDB.get_mode()
        if mode.lower().strip() == "avl":
            return avl.extractRow(database, name_table, columns)
        elif mode.lower().strip() == "b":
            return b.extractRow(database, name_table, columns)
        elif mode.lower().strip() == "bPlus".lower():
            return bPlus.extractRow(database, name_table, columns)
        elif mode.lower().strip() == "dict":
            return diccionario.extractRow(database, name_table, columns)
        elif mode.lower().strip() == "hash":
            return hash.extractRow(database, name_table, columns)
        elif mode.lower().strip() == "isam":
            return isam.extractRow(database, name_table, columns)
        elif mode.lower().strip() == "json":
            return json.extractRow(database, name_table, columns)
    # return db.extractRow(database, name_table, columns) Revisar persona quien lo realizo
    return None