Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18657 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60288 invoked by uid 1010); 2 Sep 2005 18:23:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60273 invoked from network); 2 Sep 2005 18:23:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2005 18:23:08 -0000 X-Host-Fingerprint: 70.85.46.36 unknown Received: from ([70.85.46.36:44555] helo=prohost.org) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 74/09-15098-A8898134 for ; Fri, 02 Sep 2005 14:23:07 -0400 Received: (qmail 3781 invoked from network); 2 Sep 2005 18:23:03 -0000 Received: from cpe000fb56099fd-cm000f9f7d6664.cpe.net.cable.rogers.com (HELO ?192.168.1.101?) (69.196.28.148) by prohost.org with SMTP; 2 Sep 2005 18:23:03 -0000 Message-ID: <43189886.4010500@prohost.org> Date: Fri, 02 Sep 2005 14:23:02 -0400 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nuno Lopes CC: PHPdev References: <010101c5afea$4227cd80$0100a8c0@pc07653> In-Reply-To: <010101c5afea$4227cd80$0100a8c0@pc07653> X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] sqlite: retrieve SQL syntax errors From: ilia@prohost.org (Ilia Alshanetsky) I've just tried to replicate the problem and it appears to work fine: $db = sqlite_open(":memory:"); sqlite_exec($db, "SELECT ***"); var_dump(sqlite_error_string(sqlite_last_error($db))); prints "SQL logic error or missing database" Ilia Nuno Lopes wrote: > 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).