From: victor-php at boivie dot com
Operating system: Not important
PHP version: 5.0.4
PHP Bug Type: SQLite related
Bug description: sqlite_free_result would be useful for some transaction
scenarios
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.
--
Edit bug report at http://bugs.php.net/?id=32724&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32724&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32724&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32724&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32724&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32724&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32724&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32724&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32724&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32724&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32724&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32724&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32724&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32724&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32724&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32724&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32724&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32724&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32724&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32724&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32724&r=mysqlcfg