I prepared 2 files, "1.php" and "2.php".
"1.php" is like this.
<?php
$dbh = new PDO('sqlite:test1');
$dbh->beginTransaction();
print "aaa<br>";
sleep(55);
$dbh->commit();
print "bbb";
?>
and "2.php" is like this.
<?php
$dbh = new PDO('sqlite:test1');
$dbh->beginTransaction();
print "ccc<br>";
$dbh->commit();
print "ddd";
?>
and I excute "1.php". It starts a transaction and waits 55 seconds.
So when I immediately excute "2.php", my expectation is this:
- "1.php" is getting transaction and
- "1" holds a database lock
- "2" can not begin a transaction
- "2" can not get database lock so
- "2" have to wait 55 seconds
BUT, but the test went another way. When I excute "2",then
- "2" immediately returned it's result
- "2" did not wait
so I have to think that "1" could not get transaction, or could not get database lock.
Can anyone help?