Re: [PHP-DEV] Patch: Use notices in PDO
Samuel ROZE wrote: It's a good idea. - PDO::NOTICES_FETCH - PDO::NOTICES_ENABLED - PDO::NOTICES_NONE - PDO::NOTICES_DISABLED That's better ? That works. I see that you are from the Oracle team. Can you explain me how oracle works to raise notices like PostgreSQL ? Or can you build a proof of concept to get notices from Oracle ? I'm equating your NOTICES to Oracle's DBMS_OUTPUT. See Getting Output with DBMS_OUTPUT on p 181 of: http://www.oracle.com/technology/tech/php/underground-php-oracle-manual.html Something similar could be coded in the PDO driver. The amount of text output could be quite large, depending on the user's coding style. Is your design extensible enough to allow for streaming/chunking if the interface needs to be enhanced? PL/SQL also has compile time warnings and errors that are handled differently, see PL/SQL Success With Information Warnings on p167. Chris Thanks. Samuel. Le jeudi 08 octobre 2009 à 15:22 -0700, Christopher Jones a écrit : Samuel ROZE wrote: Hi, I've make a patch which insert notices concepts to PDO. It create: - PDO::noticeInfo() - to be like errorInfo - PDO::ATTR_LOG_NOTICES, the name of the PDO parameter - PDO::NOTICES_FETCH - fetch notices I initially took FETCH to mean it was related to a query; this wouldn't always be the case. What about calling it NOTICES_ENABLE? Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch: Use notices in PDO
Christopher Jones ha scritto: Samuel ROZE wrote: It's a good idea. - PDO::NOTICES_FETCH - PDO::NOTICES_ENABLED - PDO::NOTICES_NONE - PDO::NOTICES_DISABLED That's better ? That works. I see that you are from the Oracle team. Can you explain me how oracle works to raise notices like PostgreSQL ? Or can you build a proof of concept to get notices from Oracle ? I'm equating your NOTICES to Oracle's DBMS_OUTPUT. See Getting Output with DBMS_OUTPUT on p 181 of: http://www.oracle.com/technology/tech/php/underground-php-oracle-manual.html Something similar could be coded in the PDO driver. The amount of text output could be quite large, depending on the user's coding style. Is your design extensible enough to allow for streaming/chunking if the interface needs to be enhanced? How about: PDO::NOTICES_DISABLED PDO::NOTICES_ARRAY to allow space for different formats (e.g. PDO::NOTICES_RESULTSET)? PL/SQL also has compile time warnings and errors that are handled differently, see PL/SQL Success With Information Warnings on p167. However, having read the above chapter, it seems to me that error code 24344 with its warnings is more similar to MySQL warnings and PgSQL notices. Which one should be automatically handled by PDO? I'd vote for this one, leaving DBMS_OUTPUT still available by manually sending the queries highligthed in your book. Cheers -- Matteo Beccati -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch: Use notices in PDO
Well, if I understood, DBMS_OUTPUT returns user's notices or warning, but no errors ? In the standart way, in console, how the notices are printed ? Is DBMS_OUTPUT used both by Pl/SQL function and Oracle functions? Thanks. Samuel. 2009/10/9 Christopher Jones christopher.jo...@oracle.com: Samuel ROZE wrote: It's a good idea. - PDO::NOTICES_FETCH - PDO::NOTICES_ENABLED - PDO::NOTICES_NONE - PDO::NOTICES_DISABLED That's better ? That works. I see that you are from the Oracle team. Can you explain me how oracle works to raise notices like PostgreSQL ? Or can you build a proof of concept to get notices from Oracle ? I'm equating your NOTICES to Oracle's DBMS_OUTPUT. See Getting Output with DBMS_OUTPUT on p 181 of: http://www.oracle.com/technology/tech/php/underground-php-oracle-manual.html Something similar could be coded in the PDO driver. The amount of text output could be quite large, depending on the user's coding style. Is your design extensible enough to allow for streaming/chunking if the interface needs to be enhanced? PL/SQL also has compile time warnings and errors that are handled differently, see PL/SQL Success With Information Warnings on p167. Chris Thanks. Samuel. Le jeudi 08 octobre 2009 à 15:22 -0700, Christopher Jones a écrit : Samuel ROZE wrote: Hi, I've make a patch which insert notices concepts to PDO. It create: - PDO::noticeInfo() - to be like errorInfo - PDO::ATTR_LOG_NOTICES, the name of the PDO parameter - PDO::NOTICES_FETCH - fetch notices I initially took FETCH to mean it was related to a query; this wouldn't always be the case. What about calling it NOTICES_ENABLE? Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Patch: Use notices in PDO
PDO::NOTICES_DISABLED PDO::NOTICES_ARRAY to allow space for different formats (e.g. PDO::NOTICES_RESULTSET)? I not but what is the real interest of returning another type of data. And, what can be the other type ? It can have one notice as having many. PL/SQL also has compile time warnings and errors that are handled differently, see PL/SQL Success With Information Warnings on p167. However, having read the above chapter, it seems to me that error code 24344 with its warnings is more similar to MySQL warnings and PgSQL notices. Which one should be automatically handled by PDO? I'd vote for this one, leaving DBMS_OUTPUT still available by manually sending the queries highligthed in your book. For your mind, PDO's Oracle driver have to catch the error #24344 to put it into notices and leave the user request Oracle database to have DBMS_OUTPUT's notices ? I disagree because DBMS_OUTPUT must be used in Pl/SQL functions, which must raise notices which are needed by the user... Cheers -- Matteo Beccati -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Configuration in the php.ini file
Hi, I wanted to change a parameter in my PDO class, with the fourth PDO::_construct arg. But, I've many projects, which uses PDO, with one new PDO per project. The problem is that I have to change the source of every projects... Why isn't there an PDO section in the php.ini file ? For instance: pdo.is_persistent = 1 pdo.fetch_notices = 1 ...and more ! There isn't because nobody developed that or because it is contradicted ? Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Configuration in the php.ini file
hi, The general consensus is to do not add new ini settings unless it is absolutely necessary. It is not the case for your example as it is cleary an application configuration problem (user land configuration). Cheers, -- Pierre On Fri, Oct 9, 2009 at 3:21 PM, Samuel ROZE samuel.r...@gmail.com wrote: Hi, I wanted to change a parameter in my PDO class, with the fourth PDO::_construct arg. But, I've many projects, which uses PDO, with one new PDO per project. The problem is that I have to change the source of every projects... Why isn't there an PDO section in the php.ini file ? For instance: pdo.is_persistent = 1 pdo.fetch_notices = 1 ...and more ! There isn't because nobody developed that or because it is contradicted ? Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- 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
Re: [PHP-DEV] Configuration in the php.ini file
It isn't. :-) Thanks. 2009/10/9 Pierre Joye pierre@gmail.com: hi, The general consensus is to do not add new ini settings unless it is absolutely necessary. It is not the case for your example as it is cleary an application configuration problem (user land configuration). Cheers, -- Pierre On Fri, Oct 9, 2009 at 3:21 PM, Samuel ROZE samuel.r...@gmail.com wrote: Hi, I wanted to change a parameter in my PDO class, with the fourth PDO::_construct arg. But, I've many projects, which uses PDO, with one new PDO per project. The problem is that I have to change the source of every projects... Why isn't there an PDO section in the php.ini file ? For instance: pdo.is_persistent = 1 pdo.fetch_notices = 1 ...and more ! There isn't because nobody developed that or because it is contradicted ? Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- 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
Re: [PHP-DEV] Configuration in the php.ini file
Hi There isn't because nobody developed that or because it is contradicted ? here we extends the PDO class to configure it like we want. For example : class ourPDO { public function __construct( $dsn, $user = NULL, $password = NULL, $options = NULL ) { $defaultOptions = array( PDO::ATTR_ERRMODE = PDO::ERRMODE_WARNING, PDO::ATTR_TIMEOUT = 5, PDO::ATTR_CASE = PDO::CASE_NATURAL, PDO::ATTR_DEFAULT_FETCH_MODE = PDO::FETCH_ASSOC, ); if( is_array($options) ) $defaultOptions = $options + $defaultOptions; parent::__construct($dsn, $user, $password, $defaultOptions); } } and in code, we use $db = new ourPDO( ... ); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Configuration in the php.ini file
And I still have to modifiy my source. ;-) In fact I'm using a personnaly Database class using PDO for add execution times and array/string transformations. Actually, I just wanted to know why there isn't any pdo propreties in the php.ini file. Pierre replied. Thanks ! Samuel. 2009/10/9 Olivier B. php-dev.l...@daevel.net: Hi There isn't because nobody developed that or because it is contradicted ? here we extends the PDO class to configure it like we want. For example : class ourPDO { public function __construct( $dsn, $user = NULL, $password = NULL, $options = NULL ) { $defaultOptions = array( PDO::ATTR_ERRMODE = PDO::ERRMODE_WARNING, PDO::ATTR_TIMEOUT = 5, PDO::ATTR_CASE = PDO::CASE_NATURAL, PDO::ATTR_DEFAULT_FETCH_MODE = PDO::FETCH_ASSOC, ); if( is_array($options) ) $defaultOptions = $options + $defaultOptions; parent::__construct($dsn, $user, $password, $defaultOptions); } } and in code, we use $db = new ourPDO( ... ); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Patch: Use notices in PDO
Just a little question: - How I can propose my patch to be merged to PHP ? Rather suggest.. :-) Le jeudi 08 octobre 2009 à 23:51 +0200, Samuel ROZE a écrit : Hi, I've make a patch which insert notices concepts to PDO. It create: - PDO::noticeInfo() - to be like errorInfo - PDO::ATTR_LOG_NOTICES, the name of the PDO parameter - PDO::NOTICES_FETCH - fetch notices - PDO::NOTICES_NONE - don't fetch notices The notices HashTable is emptied at each queries. There is a patch to implements this function into PDO: http://www.d-sites.com/wp-content/uploads/2009/10/php-5_3-pdo-notices-managment.patch And one other to implements notices recuperation for PostgreSQL: http://www.d-sites.com/wp-content/uploads/2009/10/php-5_3-pdo-pgsql-notices-managment.patch It can be done for Oracle, i'm sure. Thanks for feedbacks. Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Patch: Use notices in PDO
Hi, First thanks to have updated the patch according to our last feedback :) About applying it, we should wait a bit more until we get more feedbacks (say until the middle of next week). Then see how we can do it for the other drivers at the same time. Cheers, -- Pierre On Fri, Oct 9, 2009 at 10:31 PM, Samuel ROZE samuel.r...@gmail.com wrote: Just a little question: - How I can propose my patch to be merged to PHP ? Rather suggest.. :-) Le jeudi 08 octobre 2009 à 23:51 +0200, Samuel ROZE a écrit : Hi, I've make a patch which insert notices concepts to PDO. It create: - PDO::noticeInfo() - to be like errorInfo - PDO::ATTR_LOG_NOTICES, the name of the PDO parameter - PDO::NOTICES_FETCH - fetch notices - PDO::NOTICES_NONE - don't fetch notices The notices HashTable is emptied at each queries. There is a patch to implements this function into PDO: http://www.d-sites.com/wp-content/uploads/2009/10/php-5_3-pdo-notices-managment.patch And one other to implements notices recuperation for PostgreSQL: http://www.d-sites.com/wp-content/uploads/2009/10/php-5_3-pdo-pgsql-notices-managment.patch It can be done for Oracle, i'm sure. Thanks for feedbacks. Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- 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
Re: [PHP-DEV] Re: Patch: Use notices in PDO
Le vendredi 09 octobre 2009 à 23:05 +0200, Pierre Joye a écrit : About applying it, we should wait a bit more until we get more feedbacks (say until the middle of next week). Oh yeah of course ! It was just a question to know how it happened. ;-) Then see how we can do it for the other drivers at the same time. I'm looking for Oracle. Is somebody know how we can do for MySQL (and how raise notices with it) ? Cheers, -- Pierre On Fri, Oct 9, 2009 at 10:31 PM, Samuel ROZE samuel.r...@gmail.com wrote: Just a little question: - How I can propose my patch to be merged to PHP ? Rather suggest.. :-) Le jeudi 08 octobre 2009 à 23:51 +0200, Samuel ROZE a écrit : Hi, I've make a patch which insert notices concepts to PDO. It create: - PDO::noticeInfo() - to be like errorInfo - PDO::ATTR_LOG_NOTICES, the name of the PDO parameter - PDO::NOTICES_FETCH - fetch notices - PDO::NOTICES_NONE - don't fetch notices The notices HashTable is emptied at each queries. There is a patch to implements this function into PDO: http://www.d-sites.com/wp-content/uploads/2009/10/php-5_3-pdo-notices-managment.patch And one other to implements notices recuperation for PostgreSQL: http://www.d-sites.com/wp-content/uploads/2009/10/php-5_3-pdo-pgsql-notices-managment.patch It can be done for Oracle, i'm sure. Thanks for feedbacks. Samuel. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php