PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #1834

autocommit with functions in pgsql

Details

Submitted2004-07-09 20:33 UTC
Frommike at ftl dot com
Assigneddanielc
StatusWont fix
PackageDB
PHP Version4.3.7
OSSun and Linux
Roadmaps(Not assigned)

Comments

[2004-07-09 20:33 UTC] mike at ftl dot com

Description:
------------
After beating my head against a wall for awhile trying to figure out why my queries were being commited when autocommit was set to false, I started digging in to pgsql.php and DB.php.

We have some functions defined that we access like so :

SELECT * from store_user('$user_id','$fname','$lname',NULL)

Well, if you look at pgsql.php, you'll see :

if (!$this->autocommit && $ismanip) {

Not knowing what ismanip was, I started searching. There is a function called isManip() which looks to see if the $query is a "INSERT, CREATE, REPLACE, UPDATE, etc".

Since FUNCTIONS can have side effects, this is broken.

I'd suggest the removal of the "&& $ismanip" in pgsql.php.

Let me know if I'm way out in left field here.

- Mike

[2004-07-13 16:50 UTC] mike at ftl dot com

Can you explain why? This is broke.

You said there are 2 options to get around this. I see ZERO.

You say turn on auto-commit. Even with auto-commit turned on, your suggestion will fail because of the following.

if (!$this->autocommit && $ismanip) {

my only solution is to change the line to

if (!$this->autocommit) {

Like I stated earlier, you can have "SELECT" functions that do inserts.

- Mike