Re: excec / query on Sqlite3

From: Date: Mon, 20 May 2013 17:35:30 +0000
Subject: Re: excec / query on Sqlite3
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-48749@lists.php.net to get a copy of this message
On 20/05/13 14:35, Gilles wrote:
Hello, I'm not sure if it's a bug :
No, it's not - it's PHP code :-)
$o_sqlite3=new SQLite3('test.sqlite'); $r=$o_sqlite3->exec(''); echo'<pre>';var_dump($r);echo'</pre>'; // bool(true) $r=$o_sqlite3->query(''); echo'<pre>';var_dump($r);echo'</pre>'; // bool(false) $r=$o_sqlite3->exec(false); echo'<pre>';var_dump($r);echo'</pre>'; // bool(true) $r=$o_sqlite3->query(false); echo'<pre>';var_dump($r);echo'</pre>'; // bool(false) Best, System Windows NT 5.1 build 2600 (Windows XP Professional Service Pack 3) i586 WIN XP SP3 PHP Version 5.4.13
SQLite3 module version     0.7
SQLite Library     3.7.7.1
Tried your code on a MacBook OS X 10.6 with PHP 5.3.15 - same result. What's your question: the difference in response between exec() and query(), or the fact that a non-SQL statement does yield some result - albeit a boolean ? If it's the first one, I think it is intentional: http://be.php.net/manual/en/sqlite3.exec.php says exec() is meant for result-less statements. So as long as something doesn't fail, it's OK. query() is supposed to return results - if it doesn't, something is wrong. But that is just my interpretation of the man page. Is there a problem beneath you're trying to solve ? Regards, Bert

« previous php.db (#48749) next »