[PATCH] sqlite: retrieve SQL syntax errors
| From: | Nuno Lopes | Date: | Fri, 02 Sep 2005 18:15:11 +0000 |
| Subject: | [PATCH] sqlite: retrieve SQL syntax errors | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-18656@lists.php.net to get a copy of this message | ||
Hi,
I've made a simple patch to allow a user to retrieve the SQL syntax error occured in either sqlite_exec(), sqlite_query() or sqlite_unbuffered_query().
Untill now this wasn't possible, because sqlite_last_error() doesn't handle SQL syntax errors. The patch adds an additional parameter to those 3 functions (OO and non-OO versions) to retrieve the error.
Patch: http://mega.ist.utl.pt/~ncpl/php_sqlite.txt
Example:
<?
$idx = sqlite_open(':memory:');
@sqlite_exec($idx, 'SELECT column', $error);
echo $error;
?>
I hope this can enter in PHP 5.1.0, as it is a fairly simple patch.
Nuno
P.S.: the patch also fixes a bug in the SQLiteDatabase constructor, where the $errorstr variable wasn't filled (because it wasn't beeing passed by reference).