def verifyPk(self, database, table, columns): registros = self.dicDB[database][table][0].registros() tmp = bt.arbolB(self.grade) for i in registros: pk = "" for j in columns: pk += str(i[j]) + "_" pk = pk[:-1] tmp.insertar([pk, i]) return self.searchRepeat(tmp.Keys())
def updateTree(self, database, table): registros = self.dicDB[database][table][0].registros() tmp = bt.arbolB(self.grade) for i in registros: pk = "" for j in self.dicDB[database][table][2]: pk += str(i[j]) + "_" pk = pk[:-1] tmp.insertar([pk, i]) self.dicDB[database][table][0] = tmp
def alterDropPK(database: str, table: str) -> int: try: b.dicDB[database][table][0] = serializar.rollback(database + "-" + table + "-B") except: pass r = b.alterDropPK(database, table) try: b.dicDB[database][table][0] = bt.arbolB(b.grade) serializar.commit(b, "BDD") except: pass return r
def alterAddColumn(database: str, table: str, default: any) -> int: try: b.dicDB[database][table][0] = serializar.rollback(database + "-" + table + "-B") except: pass r = b.alterAddColumn(database, table, default) try: b.dicDB[database][table][0] = bt.arbolB(b.grade) serializar.commit(b, "BDD") except: pass return r
def truncate(self, database, table): try: if self.searchDB(database): if self.searchTB(database, table): try: self.dicDB[database][table][0] = bt.arbolB(self.grade) return 0 except: return 1 return 3 return 2 except: return 1
def delete(database: str, table: str, columns: list) -> int: try: b.dicDB[database][table][0] = serializar.rollback(database + "-" + table + "-B") except: pass r = b.delete(database, table, columns) try: serializar.commit(b.dicDB[database][table][0], database + "-" + table + "-B") b.dicDB[database][table][0] = bt.arbolB(b.grade) serializar.commit(b, "BDD") except: pass return r
def loadCSV(file: str, database: str, table: str) -> list: try: b.dicDB[database][table][0] = serializar.rollback(database + "-" + table + "-B") except: pass r = b.loadCSV(file, database, table) try: serializar.commit(b.dicDB[database][table][0], database + "-" + table + "-B") b.dicDB[database][table][0] = bt.arbolB(b.grade) serializar.commit(b, "BDD") except: pass return r
def insert(database: str, table: str, register: list) -> int: try: b.dicDB[database][table][0] = serializar.rollback(database + "-" + table + "-B") except: pass r = b.insert(database, table, register) try: serializar.commit(b.dicDB[database][table][0], database + "-" + table + "-B") b.dicDB[database][table][0] = bt.arbolB(b.grade) serializar.commit(b, "BDD") except: pass return r
def createTable(self, database, table, numberColumns): if self.identify(database) and self.identify(table): if self.searchDB(database): if self.searchTB(database, table): return 3 else: if self.identify(table): try: self.dicDB.get(database)[table] = [ bt.arbolB(self.grade), int(numberColumns), None ] return 0 except: return 1 return 1 return 2 return 1