예제 #1
0
 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
예제 #2
0
 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())
예제 #3
0
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
예제 #4
0
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
예제 #5
0
 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
예제 #6
0
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
예제 #7
0
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
예제 #8
0
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
예제 #9
0
파일: DataBase.py 프로젝트: edgarJ91/tytus
 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