PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #4672

Commit always returning true

Details

Submitted2005-06-24 07:36 UTC
Fromrofranco at c17 dot net
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.11
OSLinux
Roadmaps(Not assigned)

Comments

[2005-06-24 07:36 UTC] rofranco at c17 dot net

Description:
------------
We are using the "DEFERRABLE" and "INITIALY DEFERRED" options in our PostgreSQL database, and found that sometimes there can be an error during COMMIT.

Therefore, we've made 2 small changes to DataObject.php to be able to handle the return value of the commit function.

I'm copying the patch file in case you consider it worth including in DataObject.php

Reproduce code:
---------------
--- DataObject.php 2005-06-24 09:20:03.139954064 +0200
+++ DataObject.php2 2005-06-24 09:25:12.923859752 +0200
@@ -2209,11 +2209,11 @@
return true;
}
if (strtoupper($string) == 'COMMIT') {
- $DB->commit();
+ $res = $DB->commit();
if ($_DB_driver == 'DB') {
$DB->autoCommit(true);
}
- return true;
+ return $res;
}

if (strtoupper($string) == 'ROLLBACK') {

Expected result:
----------------
Returning this value, we are able to determine if the transaction was successfull or not, and act accordingly.