PEAR is archived and read-only

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

Home » Database » DB » Bug #4467

mysql transactions don't work properly

Details

Submitted2005-05-29 15:21 UTC
Fromjlintervo at suomi24 dot fi
StatusDuplicate
PackageDB
PHP Version5.0.4
OSWindows NT4
Roadmaps(Not assigned)

Comments

[2005-05-29 15:21 UTC] jlintervo at suomi24 dot fi

Description:
------------
I have had trouble getting transaction work with mysql + php/pearDB.

i located the problem in DB:isManip($query), which returns false for reasonable sql queries.

I suppose there is something with the regexp syntax.

Reproduce code:
---------------
SCRIPT 1:
---------
$db->autoCommit(false);

$sql="SELECT * FROM sess WHERE id='1' LOCK IN SHARE MODE;";
$db->$query($sql);

sleep(10);
$db->commit();

SCRIPT 2:
---------
$sql="UPDATE sess SET id=2 WHERE id=1;";
$db->query($sql);

Expected result:
----------------
when running simultaneously, script 1 started first, script 2 query should wait for script 1 to commit. this doesn't happen. it seems that pear-storage-driver for mysql doesn't send the 'SET AUTOCOMMIT=0' and 'BEGIN' when autoCommit is called.

[2005-05-29 22:00 UTC] jlintervo at suomi24 dot fi

changed the package field to DB