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
def truncate(database: str, table: str) -> int: try: b.dicDB[database][table][0] = serializar.rollback(database + "-" + table + "-B") except: pass r = b.truncate(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 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 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 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