def delete(database: str, table: str, columns: list) -> int: try: retorno = 1 db = __buscarLlaveBaseDato(database) if db is not None: modoDB = db[0] if modoDB == "avl": retorno = avl.delete(database, table, columns) elif modoDB == "b": retorno = b.delete(database, table, columns) elif modoDB == "bplus": retorno = bPlus.delete(database, table, columns) elif modoDB == "dict": retorno = dic.delete(database, table, columns) elif modoDB == "isam": retorno = isam.delete(database, table, columns) elif modoDB == "json": retorno = json.delete(database, table, columns) elif modoDB == "hash": retorno = hash.delete(database, table, columns) return retorno else: return 2 except Exception: return 1
def delete(database, table, columns): if searchInMode(database) != None: currentMode = searchInMode(database) if currentMode == 'avl': # avlList.append(tableNew) return avl.delete(database, table, columns) elif currentMode == 'b': # bList.append(tableNew) return b.delete(database, table, columns) elif currentMode == 'bplus': # bplusList.append(tableNew) return bplus.delete(database, table, columns) elif currentMode == 'dict': # dictList.append(tableNew) return DM.delete(database, table, columns) elif currentMode == 'isam': # isamList.append(tableNew) return isam.delete(database, table, columns) elif currentMode == 'json': # jsonList.append(tableNew) return j.delete(database, table, columns) elif currentMode == 'hash': # hashList.append(tableNew) return Hash.delete(database, table, columns) else: return 2
def delete(database: str, table: str, columns: list): 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.delete(database, table, columns) elif db.mode == "b": result = BMode.delete(database, table, columns) elif db.mode == "bplus": result = BPlusMode.delete(database, table, columns) elif db.mode == "dict": result = DictMode.delete(database, table, columns) elif db.mode == "isam": result = ISAMMode.delete(database, table, columns) elif db.mode == "json": result = jsonMode.delete(database, table, columns) elif db.mode == "hash": result = HashMode.delete(database, table, columns) return result
def delete(database: str, table: str, columns: list) -> int: """Deletes a register into 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 0: successful operation 1: an error ocurred 2: non-existent database 3: non-existent table 4: non-existent PK """ bd = _database(database) if bd: tb = _table(database, table) if tb: mode = tb["modo"] val = -1 if mode == "avl": val = avl.delete(database, table, columns) elif mode == "b": val = b.delete(database, table, columns) elif mode == "bplus": val = bplus.delete(database, table, columns) elif mode == "hash": val = hash.delete(database, table, columns) elif mode == "isam": val = isam.delete(database, table, columns) elif mode == "json": val = json.delete(database, table, columns) elif mode == "dict": val = dict.delete(database, table, columns) return val else: return 3 else: return 2
def delete(database, name_table, columns): ModeDB, indexDB = exist_Alter(database) if ModeDB: mode = ModeDB.get_mode() if mode.lower().strip() == "avl": return avl.delete(database, name_table, columns) elif mode.lower().strip() == "b": return b.delete(database, name_table, columns) elif mode.lower().strip() == "bPlus".lower(): return bPlus.delete(database, name_table, columns) elif mode.lower().strip() == "dict": return diccionario.delete(database, name_table, columns) elif mode.lower().strip() == "hash": return hash.delete(database, name_table, columns) elif mode.lower().strip() == "isam": return isam.delete(database, name_table, columns) elif mode.lower().strip() == "json": return json.delete(database, name_table, columns)
def delete(database: str, table: str, columns: list): db = databases.search(database) if db == None: return 2 if db.mode == "avl": result = avlMode.delete(database, table, columns) elif db.mode == "b": result = BMode.delete(database, table, columns) elif db.mode == "bplus": result = BPlusMode.delete(database, table, columns) elif db.mode == "dict": result = DictMode.delete(database, table, columns) elif db.mode == "isam": result = ISAMMode.delete(database, table, columns) elif db.mode == "json": result = jsonMode.delete(database, table, columns) elif db.mode == "hash": result = HashMode.delete(database, table, columns) return result