note 54143 added to function.pdo-query
| From: | schmeic-php at lovo dot org | Date: | Fri, 24 Jun 2005 17:56:42 +0000 |
| Subject: | note 54143 added to function.pdo-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90912@lists.php.net to get a copy of this message | ||
Note that if you are using the sqlite3 driver, you need to fetch all data before sqlite3 will unlock
the db. sqlite3 allows multiple readers, but writes require an exclusive lock. Consider the
following code:
<?php
$pdo = new PDO("sqlite:/path/dbfile");
$query = "select * from some_table";
$pdo_statement1 = $pdo->query($query);
$query = "update some_table set some_field = some_value";
$pdo_statement2 = $pdo->query($query);
?>
The second query will fail and if you check out the driver specific error message, you will see
that the db is locked.
So before you can do the update, you'll need to fetch all the data. If you put this code
between the two queries, the update will work.
<?php
$all_select_data = $pdo_statement1->fetchAll();
?>
----
Manual Page -- http://www.php.net/manual/en/function.pdo-query.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54143
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54143&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54143&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54143&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54143&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54143&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54143&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54143&report=yes
Search -- http://master.php.net/manage/user-notes.php