Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-12 Thread Johannes Schlüter
Hi, On Wed, 2009-10-07 at 15:55 +0200, Lukas Kahwe Smith wrote: yeah .. its certainly a valid question. we have stuff like lastInsertId(), which depending on the driver either gets the current value of a sequence or the last id generated for the connection. so going by that example

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Matteo Beccati
Hi, Well, i've show the patch this morning... It's great ! The allocation of the HashTable when use setAttribute might not be really a good job but other, in my mind, is ! Yeah, I'm not very happy about it either. It was just a proof of concept after all ;) Cheers -- Matteo Beccati --

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Matteo Beccati
Hi Christopher, What are notices? Do they relate anything in other Databases? I.e. can a generic interface be implemented instead of a postgres specific one? I'm not sure. Notices are non-error messages that can be triggered during a query for informative purposes. For example CREATE TABLE

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Matteo Beccati
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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Samuel ROZE
Ok, it is possible with Oracle.. Do you think that if it is for only both of PDO's supported databases is a reason to make that generaly ? For other drivers it must just burdening PDO. It's what I think... Le mardi 06 octobre 2009 à 23:08 -0700, Christopher Jones a écrit : Samuel ROZE wrote:

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Christopher Jones
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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread 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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Lukas Kahwe Smith
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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Matteo Beccati
Pierre Joye ha scritto: 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. Yes. That's exactly why I added a new method, although driver specific.

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Pierre Joye
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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Samuel ROZE
Le mercredi 07 octobre 2009 à 09:06 +0200, Matteo Beccati a écrit : 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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Pierre Joye
On Wed, Oct 7, 2009 at 1:27 PM, Samuel ROZE samuel.r...@aliceadsl.fr wrote: Le mercredi 07 octobre 2009 à 09:06 +0200, Matteo Beccati a écrit : 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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Samuel ROZE
Le mercredi 07 octobre 2009 à 13:30 +0200, Pierre Joye a écrit : [...] This is a bit complicated and very different ! Actually, each database works as it want and it may be better to use different functions for each driver. That defeats the whole purpose of PDO. The meaning of each

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Samuel ROZE
Le mercredi 07 octobre 2009 à 07:57 +0200, Samuel ROZE a écrit : Well, i've show the patch this morning... It's great ! The allocation of the HashTable when use setAttribute might not be really a good job but other, in my mind, is ! See you afternoon for PHP 5.2 path. :-) Well, I've done a

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Lukas Kahwe Smith
On 07.10.2009, at 15:49, Matteo Beccati wrote: Pierre Joye ha scritto: On Wed, Oct 7, 2009 at 1:27 PM, Samuel ROZE samuel.r...@aliceadsl.fr wrote: This is a bit complicated and very different ! Actually, each database works as it want and it may be better to use different functions for

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Samuel ROZE
Le mercredi 07 octobre 2009 à 15:47 +0200, Pierre Joye a écrit : The idea is good and matches my thoughts on this topic. Some comments: - no driver specific API, so getNotices instaed of getdriverNotices It was discuss, it need hours to implement this method to all drivers... - common

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Pierre Joye
hi, On Wed, Oct 7, 2009 at 3:49 PM, Matteo Beccati p...@beccati.com wrote: By all means, I like the idea of a unified message API, but do we really need the syntactic sugar (and development effort)? MySQL and Oracle drivers can already access them with a standard PDO::query() call. Only

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Matteo Beccati
Samuel ROZE ha scritto: Le mercredi 07 octobre 2009 à 15:47 +0200, Pierre Joye a écrit : 5.2 is also only for security fixes. Can you try to produce a patch against 5.3 and trunk please? There's the patch of Matteo Beccati at this address for PHP 5.3:

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Samuel ROZE
Actually, PDO want to abstract the communication between the Database and PHP. In the communication there are the connection and the querying of tables which raise errors and notices (for many Databases drivers). So, in my mind, it will be a great job to standardise recuperation of

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Pierre Joye
hi, The idea is good and matches my thoughts on this topic. Some comments: - no driver specific API, so getNotices instaed of getdriverNotices - common attribute name as well and maybe a better naming ATTR_LOG_NOTICES? 5.2 is also only for security fixes. Can you try to produce a patch against

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Matteo Beccati
Pierre Joye ha scritto: On Wed, Oct 7, 2009 at 1:27 PM, Samuel ROZE samuel.r...@aliceadsl.fr wrote: This is a bit complicated and very different ! Actually, each database works as it want and it may be better to use different functions for each driver. That defeats the whole purpose of PDO.

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-07 Thread Lester Caine
( Having stripped 6 people from the reply list ... ) Matteo Beccati wrote: Pierre Joye ha scritto: 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.

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-06 Thread Matteo Beccati
Samuel ROZE ha scritto: To use PostgreSQL's Notices with PDO, i'm modifying the source for trying to store into errmsg (which I can get with PDO::errorInfo) the notice. I might find some time to look at it shortly. Not sure using errmsg is appropriate though, as notices are usually returning

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-06 Thread Samuel ROZE
Hi, I might find some time to look at it shortly. Not sure using errmsg is appropriate though, as notices are usually returning additional information, not error messages. I think i'll have to make a noticemsg var, but I don't know how implement a new noticeInfo (or somethink like

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-06 Thread Samuel ROZE
Hi, I might find some time to look at it shortly. Not sure using errmsg is appropriate though, as notices are usually returning additional information, not error messages. I think i'll have to make a noticemsg var, but I don't know how implement a new noticeInfo (or somethink like that)

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-06 Thread 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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-06 Thread 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

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-06 Thread Samuel ROZE
Well, i've show the patch this morning... It's great ! The allocation of the HashTable when use setAttribute might not be really a good job but other, in my mind, is ! See you afternoon for PHP 5.2 path. :-) Samuel. Le mercredi 07 octobre 2009 à 00:31 +0200, Matteo Beccati a écrit : Hi,

Re: [PHP-DEV] PDO PgSQL: _pdo_pgsql_notice

2009-10-05 Thread Samuel ROZE
To use PostgreSQL's Notices with PDO, i'm modifying the source for trying to store into errmsg (which I can get with PDO::errorInfo) the notice. The _pdo_pgsql_notice function is called everytime that there's an notice. The notice message is in the message var. This what i had tried: