Ejemplo n.º 1
0
    def initInternal(self):
        self.currentSavePoint_ = None
        self.lastActiveCursor_ = None
        if self.stackSavePoints_ and not self.canSavePoint():
            self.stackSavePoints_ = FLSqlSavePoint()
            self.stackSavePoints_.setAutoDelete(True)

        if not self.queueSavePoints_ and not self.canSavePoint():
            self.queueSavePoints_ = FLSqlSavePoint()
            self.queueSavePoints_.setAutoDelete(True)
Ejemplo n.º 2
0
    def doTransaction(self, cur):
        #if not cur or not self.db_ or not aqApp or not qApp: #FIXME
        if not cur:
            return False

        if self.transaction_ == 0 and self.canTransaction():
            #aqApp.statusHelpMsg(FLUtil.translate("app", "Iniciando transacción")) #FIXME
            if self.db_.transaction():
                self.lastActiveCursor_ = cur
                #aqApp.emitTransactionBegin(cur) #FIXME
                if not self.canSavePoint():
                    if self.currentSavePoint_:
                        del self.currentSavePoint_
                        self.currentSavePoint_ = None

                    self.stackSavePoints_ = []
                    self.queueSavePoints_ = []

                ++self.transaction_
                cur.d.transactionsOpened_.append(self.transaction_)
                return True
            else:
                print(
                    "FLSqlDatabase::doTransaction : Fallo al intentar iniciar transacción"
                )
                return False

        else:
            #aqApp.statusHelpMsg(FLUtil.translate("app", Creando punto de salvaguarda %s..." % self.transaction_))
            if not self.canSavePoint():
                if self.transaction_ == 0:
                    if self.currentSavePoint_:
                        del self.currentSavePoint_
                        self.currentSavePoint_ = 0

                    self.stackSavePoints_ = []
                    self.queueSavePoints_ = []

                if self.currentSavePoint_:
                    self.stackSavePoints_.append(self.currentSavePoint_)
                self.currentSavePoint_ = FLSqlSavePoint(self.transaction_)
            else:
                self.savePoint(int(self.transaction_))
            ++self.transaction_
            cur.d.transactionsOpened_.append(self.transaction_)
            return True