Exemple #1
0
 /**
  * Commits the database changes done during a transaction that is in
  * progress or release a savepoint. This function may only be called when
  * auto-committing is disabled, otherwise it will fail.
  *
  * @return boolean FALSE if commit couldn't be performed, TRUE otherwise
  */
 public function commit()
 {
     if ($this->_transactionNestingLevel == 0) {
         throw ConnectionException::commitFailedNoActiveTransaction();
     }
     $this->connect();
     if ($this->_transactionNestingLevel == 1) {
         $this->_conn->commit();
     }
     --$this->_transactionNestingLevel;
     return true;
 }
Exemple #2
0
 /**
  * Commits the current transaction.
  *
  * @return void
  * @throws ConnectionException If the commit failed due to no active transaction or
  *                             because the transaction was marked for rollback only.
  */
 public function commit()
 {
     if ($this->_transactionNestingLevel == 0) {
         throw ConnectionException::commitFailedNoActiveTransaction();
     }
     if ($this->_isRollbackOnly) {
         throw ConnectionException::commitFailedRollbackOnly();
     }
     $this->connect();
     if ($this->_transactionNestingLevel == 1) {
         $this->_conn->commit();
     }
     --$this->_transactionNestingLevel;
 }