cvs: pear /MDB2 MDB2.php
| From: | Lukas Smith | Date: | Wed, 21 Jun 2006 10:13:11 +0000 |
| Subject: | cvs: pear /MDB2 MDB2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-40849@lists.php.net to get a copy of this message | ||
lsmith Wed Jun 21 10:13:11 2006 UTC
Modified files:
/pear/MDB2 MDB2.php
Log:
- phpdoc fixes
- added ability to force a transaction to rollback in compleNestedTransaction()
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2.php?r1=1.223&r2=1.224&diff_format=u
Index: pear/MDB2/MDB2.php
diff -u pear/MDB2/MDB2.php:1.223 pear/MDB2/MDB2.php:1.224
--- pear/MDB2/MDB2.php:1.223 Wed Jun 21 10:02:25 2006
+++ pear/MDB2/MDB2.php Wed Jun 21 10:13:10 2006
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2.php,v 1.223 2006/06/21 10:02:25 lsmith Exp $
+// $Id: MDB2.php,v 1.224 2006/06/21 10:13:10 lsmith Exp $
//
/**
@@ -1959,11 +1959,13 @@
* Finish a nested transaction by rolling back if an error occured or
* commiting otherwise.
*
+ * @param bool if the transaction should be rolled back regardless
+ * even if no error was set within the nested transaction
* @return mixed MDB2_OK on success, a MDB2 error on failure
*
* @access public
*/
- function completeNestedTransaction()
+ function completeNestedTransaction($force_rollback = false)
{
if ($this->nested_transaction_counter > 1) {
$this->nested_transaction_counter-= 1;
@@ -1976,7 +1978,8 @@
return MDB2_OK;
}
- if ($this->has_transaction_error) {
+ if ($force_rollback || $this->has_transaction_error) {
+ $this->has_transaction_error = false;
return $this->rollback();
}
return $this->commit();
@@ -1988,8 +1991,9 @@
/**
* Force setting nested transaction to failed.
*
- * @param mixed value to return in getNestededTransactionError()
- * @return bool MDB2_OK
+ * @param mixed value to return in getNestededTransactionError()
+ * @param bool if the transaction should be rolled back immediatly
+ * @return bool MDB2_OK
*
* @access public
*/