hi,

On Wed, Oct 7, 2009 at 9:06 AM, Matteo Beccati <p...@beccati.com> 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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to