Esempio n. 1
0
 /**
 	Used together with StartTrans() to end a transaction. Monitors connection
 	for sql errors, and will commit or rollback as appropriate.
 	
 	@autoComplete if true, monitor sql errors and commit and rollback as appropriate, 
 	and if set to false force rollback even if no SQL error detected.
 	@returns true on commit, false on rollback.
 */
 function CompleteTrans($autoComplete = true)
 {
     if ($this->transOff > 1) {
         $this->transOff -= 1;
         return true;
     }
     $this->raiseErrorFn = $this->_oldRaiseFn;
     $this->transOff = 0;
     if ($this->_transOK && $autoComplete) {
         if (!$this->CommitTrans()) {
             $this->_transOK = false;
             if ($this->debug) {
                 ADOConnection::outp("Smart Commit failed");
             }
         } else {
             if ($this->debug) {
                 ADOConnection::outp("Smart Commit occurred");
             }
         }
     } else {
         $this->_transOK = false;
         $this->RollbackTrans();
         if ($this->debug) {
             ADOCOnnection::outp("Smart Rollback occurred");
         }
     }
     return $this->_transOK;
 }
Esempio n. 2
0
 function CompleteTrans($autoComplete = true)
 {
     if ($this->transOff > 1) {
         $this->transOff -= 1;
         return true;
     }
     $this->transOff = 0;
     if ($this->transaction_status && $autoComplete) {
         if (!$this->CommitTrans()) {
             $this->transaction_status = false;
             if ($this->debug) {
                 ADOConnection::outp("Smart Commit failed");
             }
         } else {
             if ($this->debug) {
                 ADOConnection::outp("Smart Commit occurred");
             }
         }
     } else {
         $this->RollbackTrans();
         if ($this->debug) {
             ADOCOnnection::outp("Smart Rollback occurred");
         }
     }
     return $this->transaction_status;
 }