public final function rollback($fname = __METHOD__, $flush = '') { if ($flush === self::FLUSHING_INTERNAL || $flush === self::FLUSHING_ALL_PEERS) { if (!$this->mTrxLevel) { return; // nothing to do } } else { if (!$this->mTrxLevel) { $this->queryLogger->error("{$fname}: No transaction to rollback, something got out of sync."); return; // nothing to do } elseif ($this->getFlag(self::DBO_TRX)) { throw new DBUnexpectedError($this, "{$fname}: Expected mass rollback of all peer databases (DBO_TRX set)."); } } // Avoid fatals if close() was called $this->assertOpen(); $this->doRollback($fname); $this->mTrxAtomicLevels = []; if ($this->mTrxDoneWrites) { $this->trxProfiler->transactionWritingOut($this->mServer, $this->mDBname, $this->mTrxShortId); } $this->mTrxIdleCallbacks = []; // clear $this->mTrxPreCommitCallbacks = []; // clear $this->runOnTransactionIdleCallbacks(self::TRIGGER_ROLLBACK); $this->runTransactionListenerCallbacks(self::TRIGGER_ROLLBACK); }
/** * Mark a DB as no longer in a transaction * * This will check if locks are possibly held for longer than * needed and log any affected transactions to a special DB log. * Note that there can be multiple connections to a single DB. * * @param string $server DB server * @param string $db DB name * @param string $id Resource ID string of connection */ public function transactionWritingOut($server, $db, $id = '') { $this->trxProfiler->transactionWritingOut($server, $db, $id); }