ID: 28264 Updated by: [EMAIL PROTECTED] Reported By: csaba at alum dot mit dot edu -Status: Open +Status: Closed -Bug Type: Documentation problem +Bug Type: SQLite related Operating System: Win 2K Pro PHP Version: 5CVS-2004-05-03 (dev) New Comment:
It's already documented: sqlite_query: "SQLite will execute multiple queries ... However, this works only when the result of the function is not used - if it is used, only the first SQL statement would be executed." Changing back the state to "Closed SQLite". Previous Comments: ------------------------------------------------------------------------ [2005-04-05 01:49:36] csaba at alum dot mit dot edu It's unclear to me from the earlier comments that fixed means there is another function which mostly does what this one is documented as supposed to be doing (and today's earlier rejoinder is the the first mention of sqlite_exec). Nevertheless, I had tested with sqlite_exec before submitting the report earlier today, and yes, it does do multiple queries. To me, fixed includes the documentation agreeing with observed behaviour. As I noted in the original report, the documentation for sqlite_query says that SQLite will execute multiple queries. If the code isn't going to change, perhaps the documentation should. Therefore, I have reclassified the Category as 'Documentation problem'. ------------------------------------------------------------------------ [2005-04-05 01:19:18] [EMAIL PROTECTED] It was fixed: You need to use sqlite_exec() instead of sqlite_query() (took about 2 minutes for me to figure out and I don't use SQLite at all..) ------------------------------------------------------------------------ [2005-04-04 22:00:25] csaba at alum dot mit dot edu This is still behaving in the same way as originally described (just tested on PHP 5.0.4-dev 11-Mar-2005). Here is slightly nicer code to show the problem: <?php $db = sqlite_open(':memory:', 0666, $sqliteerror); $tbl = "delme"; $multiQuery = "CREATE TABLE $tbl " . "(foo INTEGER PRIMARY KEY, bar TEXT);" . "INSERT INTO $tbl VALUES (null, 'Hi Mom');"; $dbRes = sqlite_query ($db, $multiQuery); $creationTest = "PRAGMA table_info('$tbl');"; $insertTest = "SELECT * FROM $tbl;"; $acT = sqlite_array_query ($db, $creationTest, SQLITE_ASSOC); print "<br><br>Table was created:<br>"; var_dump ($acT); $aiT = sqlite_array_query ($db, $insertTest, SQLITE_ASSOC); print "<br><br>"; if ($aiT) {print "with rows:<br>"; var_dump ($aiT); } else print "but nothing was inserted"; ?> Csaba ------------------------------------------------------------------------ [2004-07-10 15:14:35] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. "Fixed" in CVS. http://cvs.php.net/diff.php/pecl/sqlite/sqlite.c?r1=1.62.2.21&r2=1.62.2.22&ty=u ------------------------------------------------------------------------ [2004-05-27 00:15:40] saleh at sfsj dot net I also want to add that even if you try to use transactions to execute multiple queries.. I tried to use BEGIN; and BEGIN TRANSACTION; but both of them will not work and nothing will happen.. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/28264 -- Edit this bug report at http://bugs.php.net/?id=28264&edit=1