MDB2: Nested Transactions
| From: | Jennifer Fink | Date: | Tue, 02 Sep 2008 20:44:29 +0000 |
| Subject: | MDB2: Nested Transactions | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-29229@lists.php.net to get a copy of this message | ||
Good Afternoon.
I'm using PHP 5.2.4, MySQL 5.0.45, Apache 2.2.6 on Windows XP SP2. I'm
having problems getting a nested transaction to commit.
The basic flow is:
a. Begin a nested transaction (nest #1)
$xDbTxn->beginNestedTransaction() returns 1;//is this the savepoint value?
2. Grab data and update the database.
a. If update fails, begin a second nested transaction (nest #2).
$yDbTxn->beginNestedTransaction() returns 1;//is this the savepoint value?
i.
Insert some data into other tables via exec().
1. If insert fails, rollback the transaction (nest #2).
2. If insert succeeds, commit the transaction (nest #2).
b. If update succeeds, grab more data and repeat step 2.
3. If all updates succeed, commit the updates.
4. If any updates fail, rollback the updates.
The updates successfully commit if there were no errors and rollback if
there are. It is the inserted data that does not commit. When I step
through, everything looks as I understand it should, but my db tables remain
empty. BTW, the auto increment field does increase.
Any and all help is greatly appreciated.
Thanks.
Jennifer