def createTable(self, tableName, numberColumns): salida = self.Buscar(tableName) if salida[0]: return 3 else: try: if re.search(table_name_pattern, tableName): self.list_table.append(tableName) temp = Tabla.Tabla(tableName, numberColumns) serealizar.commit(temp, tableName, self.main_path) return 0 else: return 1 except: return 1
def alterTable(self, tableOld, tableNew): salida = self.Buscar(tableOld) if salida[0]: try: temp = serealizar.rollback(tableOld, self.main_path) comprobar = self.Buscar(tableNew) if comprobar[0] == False: if re.search(table_name_pattern, tableOld) and re.search( table_name_pattern, tableNew): os.remove(self.main_path + "\\" + tableOld + ".bin") self.list_table[salida[1]] = tableNew temp.alterTable(tableNew) serealizar.commit(temp, tableNew, self.main_path) return 0 else: return 1 else: return 4 except: return 1 else: return 3
def Guardar(self): serealizar.commit(self.tabla_actual, self.tabla_actual.nombre, self.main_path)