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: > > Notices are informations returned with your own function which was > > writed for. For instance, a function (trigger or simple) which have to > > insert, delete and update lines can use the RAISE NOTICE (in PostgreSQL) > > to send notices to the client. > > > > It can be "2 deleted lines, 0 updated lines and 11 inserted lines", what > > you want ! For me, it is important for stats. > > > > Others Databases don't support that (RAISE NOTICE) but I think there's > > an equivalent in Oracle but I don't know it. > > There's a way to "print" message from Oracle. See dbms_output in > http://www.oracle.com/technology/tech/php/underground-php-oracle-manual.html > These can be retrieved with existing OCI8 or PDO_OCI calls to stored > procedures using bind variables. > > What we want to avoid is someone trying to port apps to different > databases and having to rewrite more code than needed. Easier said > than done :) > > Chris > > > > > Samuel. > > > > Le mardi 06 octobre 2009 à 22:47 -0700, Christopher Jones a écrit : > >> What are notices? Do they relate anything in other Databases? > >> I.e. can a generic interface be implemented instead of a postgres > >> specific one? > >> > >> Chris > >> > >> Samuel ROZE wrote: > >>> 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 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 > >>>> > >>> > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php