ID: 32724 Updated by: [EMAIL PROTECTED] Reported By: victor-php at boivie dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: Not important PHP Version: 5.0.4 New Comment:
This is actually one of my pet hates in PHP. I won't be implementing it. Previous Comments: ------------------------------------------------------------------------ [2005-04-17 14:54:14] [EMAIL PROTECTED] moving to the right category.. ------------------------------------------------------------------------ [2005-04-16 09:10:20] victor-php at boivie dot com That actually produces correct results. So setting a resource to null frees the resource? http://se2.php.net/manual/en/language.types.resource.php mentions that "Due to the reference-counting system ... it is automatically detected when a resource is no longer referred to .. all resources that were in use for this resource are made free by the garbage collector. For this reason, it is rarely ever necessary to free the memory manually by using some free_result function." So it is actually noted in the manual. However, for symmetry in the PHP language, I still think it's a good idea to have a sqlite_free_result that does exactly this, as there is for many other databases (every other?). It would be more intuitive anyway - what do you think? Thanks for your help! ------------------------------------------------------------------------ [2005-04-16 00:23:56] [EMAIL PROTECTED] $res = null; not good enough? ------------------------------------------------------------------------ [2005-04-15 21:11:52] victor-php at boivie dot com 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 this bug report at http://bugs.php.net/?id=32724&edit=1