Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45675 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67173 invoked from network); 7 Oct 2009 05:43:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2009 05:43:23 -0000 Authentication-Results: pb1.pair.com header.from=samuel.roze@aliceadsl.fr; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=samuel.roze@aliceadsl.fr; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain aliceadsl.fr from 212.27.42.3 cause and error) X-PHP-List-Original-Sender: samuel.roze@aliceadsl.fr X-Host-Fingerprint: 212.27.42.3 smtp3-g21.free.fr Linux 2.6 Received: from [212.27.42.3] ([212.27.42.3:56618] helo=smtp3-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/61-58030-77A2CCA4 for ; Wed, 07 Oct 2009 01:43:21 -0400 Received: from smtp3-g21.free.fr (localhost [127.0.0.1]) by smtp3-g21.free.fr (Postfix) with ESMTP id 73E798180D3; Wed, 7 Oct 2009 07:43:13 +0200 (CEST) Received: from [192.168.0.10] (lns-bzn-46-82-253-200-55.adsl.proxad.net [82.253.200.55]) by smtp3-g21.free.fr (Postfix) with ESMTP id 5D4558180E3; Wed, 7 Oct 2009 07:43:11 +0200 (CEST) To: Matteo Beccati Cc: internals@lists.php.net In-Reply-To: <4ACBC540.4090308@beccati.com> References: <1254806557.19561.3.camel@samuel-laptop> <1254807735.19561.5.camel@samuel-laptop> <4ACAF18B.5080803@beccati.com> <1254846564.876.1.camel@samuel-laptop> <4ACBC540.4090308@beccati.com> Content-Type: text/plain; charset="UTF-8" Date: Wed, 07 Oct 2009 07:43:25 +0200 Message-ID: <1254894205.7418.32.camel@samuel-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice From: samuel.roze@aliceadsl.fr (Samuel ROZE) Thanks all lot for your work ! It is be what I want ! I'll view it this evening and I probably will transform it for PHP 5.2 (which is my version) and put it here. At tonight ! :-) Samuel. Le mercredi 07 octobre 2009 à 00:31 +0200, Matteo Beccati a écrit : > Hi, > > >> Please allow some time for me to check how they are currently dealt with > >> in the pgsql extension and to see how they can be implemented in the > >> PDO driver. > > > > Actually, the PosgreSQL driver for PDO don't report > > notices.. The content of "_pdo_pgsql_notice" is commented ! > > > > Thanks a lot for the time you passed/you'll pass ! > > Here's a proof of concept patch you can apply to the PHP_5_3 branch: > > http://www.beccati.com/misc/php/pdo_pgsql_notices_php5_3.patch > > I still need to clean it up a bit and discuss it with the team, but > here's how it currently works: > > $db = new PDO(...); > $db->setAttribute(PDO::PGSQL_ATTR_ENABLE_NOTICES, true); > > $db->exec($query); // works with $db->query() too > $aNotices = $db->pgsqlGetNotices(); > > And you will get an array of the notices raised by the last query. > > To sum up: > * Notices are disabled by default, minimising the overhead > * Unlike the pgsql extension which returns the most recent one, multiple > notices can be fetched > * A new query will reset the stored notices > * Available on the base class because exec() doesn't return a PDOStatement > > Hope this helps > > > Cheers > -- > Matteo Beccati >