Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45674 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61020 invoked from network); 7 Oct 2009 04:13:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2009 04:13:34 -0000 Authentication-Results: pb1.pair.com header.from=php@beccati.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@beccati.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain beccati.com designates 213.92.90.60 as permitted sender) X-PHP-List-Original-Sender: php@beccati.com X-Host-Fingerprint: 213.92.90.60 ispeed-srv6.housing.tomato.it Received: from [213.92.90.60] ([213.92.90.60:62481] helo=mail.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/96-14359-C55CBCA4 for ; Tue, 06 Oct 2009 18:31:57 -0400 Received: (qmail 34008 invoked from network); 7 Oct 2009 00:31:53 +0200 Received: from unknown (HELO ?192.168.1.201?) (matteo@beccati.com@88.149.176.119) by mail.beccati.com with SMTP; 6 Oct 2009 22:31:53 -0000 Message-ID: <4ACBC540.4090308@beccati.com> Date: Wed, 07 Oct 2009 00:31:28 +0200 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Samuel ROZE CC: internals@lists.php.net References: <1254806557.19561.3.camel@samuel-laptop> <1254807735.19561.5.camel@samuel-laptop> <4ACAF18B.5080803@beccati.com> <1254846564.876.1.camel@samuel-laptop> In-Reply-To: <1254846564.876.1.camel@samuel-laptop> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice From: php@beccati.com (Matteo Beccati) 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