ID:               31105
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dengode at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         SQLite related
 Operating System: Linux
 PHP Version:      4.3.9
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Unlike regular query execution function single_query returns a value
and not a resource. Since a valid resource can never be 0, doing "or
die()" is safe, this is not the case when the result can be 0 value.


Previous Comments:
------------------------------------------------------------------------

[2004-12-16 00:41:35] dengode at gmail dot com

Description:
------------
When using sqlite_single_query and the return value from the query is 0
(zero) it's handled as if the query failed.

The code will not output 0, but instead die with the following message:
"not an error"

The value of $result is set to 0, which is expected.

Reproduce code:
---------------
<?php
$db = sqlite_open("test.db");
sqlite_query($db, "CREATE TABLE Test ( number NUMERIC )");
sqlite_query($db, "INSERT INTO Test (number) VALUES (0)");

$result = @sqlite_single_query($db, "SELECT number FROM Test")
 or die(sqlite_error_string(sqlite_last_error($db)));

echo $result;
?>

Expected result:
----------------
A return value of 0 from the database being returned to $result without
an exception.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31105&edit=1

Reply via email to