Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45682 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80310 invoked from network); 7 Oct 2009 07:06:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2009 07:06:38 -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:65069] helo=mail.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/14-58030-CFD3CCA4 for ; Wed, 07 Oct 2009 03:06:38 -0400 Received: (qmail 58050 invoked from network); 7 Oct 2009 09:06:34 +0200 Received: from unknown (HELO ?192.168.1.201?) (matteo@beccati.com@88.149.176.119) by mail.beccati.com with SMTP; 7 Oct 2009 07:06:34 -0000 Message-ID: <4ACC3DDE.8020905@beccati.com> Date: Wed, 07 Oct 2009 09:06:06 +0200 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Christopher Jones CC: Lukas Kahwe Smith , Samuel ROZE , PHP Internals 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> <1254894205.7418.32.camel@samuel-laptop> <4ACC2B8F.2040302@oracle.com> <4ACC2E8F.8040903@beccati.com> <4ACC2F62.4050601@oracle.com> <4ACC30A3.8030205@beccati.com> <4ACC32E1.6070909@oracle.com> In-Reply-To: <4ACC32E1.6070909@oracle.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice From: php@beccati.com (Matteo Beccati) Christopher Jones wrote: > Lukas Kahwe Smith wrote: >> >> On 07.10.2009, at 08:09, Matteo Beccati wrote: >> >>> Christopher Jones ha scritto: >>>> >>>> Could you use the new PG specific attribute to enable them >>>> but make them output/handled by the existing error/exception >>>> interface? >>> >>> That's what I originally thought. But there can be multiple notices >>> triggered by a single query and they shouldn't make the query fail (i.e. >>> throwing an exception would be awkward for a successful query). >> >> >> MySQL has similar notices. Like when stuff gets truncated etc. >> I also think that using the current "error modes" is probably not >> ideal. Or rather these arent exception worthy, and they should >> obviously not return false either. > > Is there a common interface that would suit both MySQL & Postgres usage? From the user perspective I'd say yes. We can surely make generic attributes and methods to deal with warnings/notices/dbms_output. From what I could see, things get a bit more complicate on the code side: PgSQL: 1. Set a notice processor callback 2. Clear the notice buffer before a query 3. Asynchronously buffer notices inside the callback 4. Set a no-op processor callback MySQL: 1. Call mysql_warning_count() after a succesful query 2. if the result is non-zero, execute "SHOW WARNINGS" and fetch the results Oracle: 1. Enable output buffering 2. Fetch the buffer after a successful query 3. Clear the buffer 4. Disable output buffering Adding generic hooks/functions will also require a PDO API version bump. Cheers -- Matteo Beccati