Beispiel #1
0
def extractTable(database: str, table: str) -> list:
    try:
        rows = []
        
        dbBuscada = __getDatabase(database)
        if dbBuscada is False:
            return None
        
        tbBuscada = __getTable(database, table)
        if tbBuscada is False:
            return None
        
        mode = tbBuscada["mode"]

        if mode == "avl":
            rows = avl.extractTable(database, table)
        elif mode == "b":
            rows = b.extractTable(database, table)
        elif mode == "bplus":
            rows = bplus.extractTable(database, table)
        elif mode == "hash":
            rows = ha.extractTable(database, table)
        elif mode == "isam":
            rows = isam.extractTable(database, table)
        elif mode == "json":
            rows = j.extractTable(database, table)
        elif mode == "dict":
            rows = d.extractTable(database, table)

        return rows
    except:
        return None
Beispiel #2
0
def extractTable(database, table):
    try:
        newTable = []

        database = str(database)
        table = str(table)
        dictionary = load('metadata')
        value_base = dictionary.get(database)
        if not value_base:
            return None
        mode = dictionary.get(database)[0]
        j = checkMode(mode)
        value_return = j.extractTable(database, table)
        
        # Decompress
        for tuple in value_return:
            newTuple = []
            for register in tuple:
                if iscompressed(register):
                    decompressed = zlib.decompress(register)
                    newTuple.append(decompressed)
                else:
                    newTuple.append(register)

            newTable.append(newTuple)
        
        return value_return
    except:
        return None
Beispiel #3
0
def extractTable(database, table):
    try:
        newTable = []

        database = str(database)
        table = str(table)
        dictionary = load('metadata')
        value_base = dictionary.get(database)
        if not value_base:
            return None
        mode = dictionary.get(database)[0]
        j = checkMode(mode)
        value_return = j.extractTable(database, table)
        
        return value_return
    except:
        return None
Beispiel #4
0
    def extractTable(self):

        estado = 1

        if self.modo == "avl":
            estado = avl.extractTable(self.database, self.table)
        elif self.modo == "b":
            estado = b.extractTable(self.database, self.table)
        elif self.modo == "bplus":
            estado = bplus.extractTable(self.database, self.table)
        elif self.modo == "hash":
            estado = ha.extractTable(self.database, self.table)
        elif self.modo == "isam":
            estado = isam.extractTable(self.database, self.table)
        elif self.modo == "json":
            estado = j.extractTable(self.database, self.table)
        elif self.modo == "dict":
            estado = d.extractTable(self.database, self.table)

        return estado