Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45685 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9018 invoked from network); 7 Oct 2009 08:44:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2009 08:44:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.225 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.220.225 mail-fx0-f225.google.com Received: from [209.85.220.225] ([209.85.220.225:46922] helo=mail-fx0-f225.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/F7-58030-38E4CCA4 for ; Wed, 07 Oct 2009 04:17:08 -0400 Received: by fxm25 with SMTP id 25so4540799fxm.24 for ; Wed, 07 Oct 2009 01:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=GdTjwP/c0W4A4+U+NIHr32ba63HBCb9Vas6jvbicKbU=; b=pgDrLGdzg7wXcYrD6H6oZ57kNViycYFP+W4twapgJ3YnRwXUZzErvGl2zPd+vE1DQG Irck4WRpcDVQEwIZlCXt2jySFw9qbEdHz05T32U40SdnhETQ0fmFX7UWk7fKDtxgp0QD fnn4ZuKmZByODGWm4a3+YWu8g9sL+jny1umhM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=RRWxIl/5bIZbWx0MLd/TI2IudX2/qo8PcNDTkkwepXNx7KmuvAb2ggW6jQ93mPqhw4 Yx952rrlBw4/pmJyKg1Y31GsSsQJcOQGqkv8bq7HuC1pQDAteqYuMeDOReFeYSD3FyHP NLza9KCkRaKUazLKfFBxZgX5NyjJRONrvGTZ8= MIME-Version: 1.0 Received: by 10.204.143.151 with SMTP id v23mr5835506bku.169.1254903424556; Wed, 07 Oct 2009 01:17:04 -0700 (PDT) In-Reply-To: <4ACC3DDE.8020905@beccati.com> References: <1254806557.19561.3.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> <4ACC3DDE.8020905@beccati.com> Date: Wed, 7 Oct 2009 10:17:04 +0200 Message-ID: To: Matteo Beccati Cc: Christopher Jones , Lukas Kahwe Smith , Samuel ROZE , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice From: pierre.php@gmail.com (Pierre Joye) hi, On Wed, Oct 7, 2009 at 9:06 AM, Matteo Beccati wrote: > 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. Having them part of the PHP errors is counter intuitive and add extra work for little gain. Mysql being the most cleaner way to do it at this stage as it does not interfer with php code at all. Could we make it independent from php's errors (be notices or warnings)? For example to add a PDO statement method to fetch these messages after having executed or prepared a query, getMessages for example. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org