def truncate(database: str, table: str) -> int: try: retorno = 1 db = __buscarLlaveBaseDato(database) if db is not None: modoDB = db[0] if modoDB == "avl": retorno = avl.truncate(database, table) elif modoDB == "b": retorno = b.truncate(database, table) elif modoDB == "bplus": retorno = bPlus.truncate(database, table) elif modoDB == "dict": retorno = dic.truncate(database, table) elif modoDB == "isam": retorno = isam.truncate(database, table) elif modoDB == "json": retorno = json.truncate(database, table) elif modoDB == "hash": retorno = hash.truncate(database, table) return retorno else: return 2 except Exception: return 1
def truncate(database, table): if searchInMode(database) != None: currentMode = searchInMode(database) if currentMode == 'avl': # avlList.append(tableNew) return avl.truncate(database, table) elif currentMode == 'b': # bList.append(tableNew) return b.truncate(database, table) elif currentMode == 'bplus': # bplusList.append(tableNew) return bplus.truncate(database, table) elif currentMode == 'dict': # dictList.append(tableNew) return DM.truncate(database, table) elif currentMode == 'isam': # isamList.append(tableNew) return isam.truncate(database, table) elif currentMode == 'json': # jsonList.append(tableNew) return j.truncate(database, table) elif currentMode == 'hash': # hashList.append(tableNew) return Hash.truncate(database, table) else: return 2
def truncate(database, table): dbs = databases.find_all(database) if dbs == []: return 2 if databases.find_table(database, table) == None: return 3 result = 1 for db in dbs: if db.tables.search(table) == None: continue if db.mode == "avl": result = avlMode.truncate(database, table) elif db.mode == "b": result = BMode.truncate(database, table) elif db.mode == "bplus": result = BPlusMode.truncate(database, table) elif db.mode == "dict": result = DictMode.truncate(database, table) elif db.mode == "isam": result = ISAMMode.truncate(database, table) elif db.mode == "json": result = jsonMode.truncate(database, table) elif db.mode == "hash": result = HashMode.truncate(database, table) return result
def truncate(database: str, table: str) -> int: """Deletes the content of a table in a database Parameters:\n database (str): name of the database table (str): name of the table Returns:\n 0: successful operation 1: an error ocurred 2: non-existent database 3: non-existent table """ bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.truncate(database, table) elif mode == "b": val = b.truncate(database, table) elif mode == "bplus": val = bplus.truncate(database, table) elif mode == "hash": val = hash.truncate(database, table) elif mode == "isam": val = isam.truncate(database, table) elif mode == "json": val = json.truncate(database, table) elif mode == "dict": val = dict.truncate(database, table) return val else: return 3 else: return 2
def truncate(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.truncate(database, table) elif mode == "b": # Grupo 17 val = b_mode.truncate(database, table) elif mode == "bplus": # Grupo 18 val = bplus_mode.truncate(database, table) elif mode == "dict": # Auxiliar val = dict_mode.truncate(database, table) elif mode == "isam": # Grupo 14 val = isam_mode.truncate(database, table) elif mode == "json": # Ingeniero val = json_mode.truncate(database, table) elif mode == "hash": # Grupo 15 val = hash_mode.truncate(database, table) else: val = 3 return val
def truncate(database, name_table): ModeDB, indexDB = exist_Alter(database) if ModeDB: mode = ModeDB.get_mode() if mode.lower().strip() == "avl": return avl.truncate(database, name_table) elif mode.lower().strip() == "b": return b.truncate(database, name_table) elif mode.lower().strip() == "bPlus".lower(): return bPlus.truncate(database, name_table) elif mode.lower().strip() == "dict": return diccionario.truncate(database, name_table) elif mode.lower().strip() == "hash": return hash.truncate(database, name_table) elif mode.lower().strip() == "isam": return isam.truncate(database, name_table) elif mode.lower().strip() == "json": return json.truncate(database, name_table)
def truncate(database, table): db = databases.search(database) if db == None: return 2 if db.mode == "avl": result = avlMode.truncate(database, table) elif db.mode == "b": result = BMode.truncate(database, table) elif db.mode == "bplus": result = BPlusMode.truncate(database, table) elif db.mode == "dict": result = DictMode.truncate(database, table) elif db.mode == "isam": result = ISAMMode.truncate(database, table) elif db.mode == "json": result = jsonMode.truncate(database, table) elif db.mode == "hash": result = HashMode.truncate(database, table) return result