|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-16 00:23 UTC] wez@php.net
[2005-04-16 09:10 UTC] victor-php at boivie dot com
[2005-04-17 14:54 UTC] sniper@php.net
[2005-04-18 01:11 UTC] wez@php.net
[2005-04-18 07:19 UTC] victor-php at boivie dot com
[2005-04-19 05:23 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 04:00:01 2025 UTC |
Description: ------------ This is a function FEATURE REQUEST and not a real bug. But it's SQLite related so I put it there instead. When you start a transaction and want to do a SELECT and then an UPDATE (for example), the results from the SELECT-query must be finished before you are allowed to UPDATE (due to the table locking) This means that you must step through all rows of the resultset (until the sqlite_fetch_xxx returns false). In some cases, it would be good to prematurely finish a SELECT-resultset to be able to do an UPDATE without having to loop through all remaining rows. Thus, a sqlite_free_result() function would be useful. Reproduce code: --------------- $db = sqlite_open("test.db"); sqlite_exec($db, "BEGIN TRANSACTION"); $res = sqlite_unbuffered_query($db, "SELECT * FROM temp"); $row = sqlite_fetch_array($res); sqlite_exec($db, "UPDATE temp SET value=10 WHERE id=1"); sqlite_exec($db, "END TRANSACTION"); sqlite_close($db); Expected result: ---------------- Well, I expect it to fail. With a sqlite_free_result($res) after the sqlite_fetch_array-statement I would expect it to work. A workaround is, (after you have retrieved your important results from the SELECT), to do a while (sqlite_fetch_array($res)); ... to step through the remaining rows. Actual result: -------------- Well, it fails as I expected.