Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Request #4119 Extended debuging information on perpared queries (oci8 and other?)
Submitted: 2005-04-11 16:53 UTC
From: ogmueller Assigned: lsmith
Status: Closed Package: MDB2
PHP Version: 4.3.9 OS: Win2k
Roadmaps: (Not assigned)    
Subscription  


 [2005-04-11 16:53 UTC] ogmueller
Description: ------------ Debuging output is quite good on "normal" queries, but it does not help a lot on prepared queries, because the values are not displayed. Is it possible to add an output for executed queries as well. Something like the following could be added to the _doQuery function in oci8.php: if( $prepared_query ) { $this->debug( 'ExecuteQuery: '.$query ); } this would enable a developer to see what was really send to the DB. Reproduce code: --------------- just execute any update or insert query with executeQuery and active debug output Expected result: ---------------- PrepareQuery: INSERT INTO my_table (CUSTOMER_ID,TITLE) VALUES (?,?) Actual result: -------------- PrepareQuery: INSERT INTO my_table (CUSTOMER_ID,TITLE) VALUES (?,?) ExecuteQuery: INSERT INTO my_table (CUSTOMER_ID,TITLE) VALUES (1,'any company')

Comments

 [2006-03-11 10:39 UTC] lsmith
MDB is deprecated, new features should go into MDB2.
 [2006-04-18 08:36 UTC] pear at mowd dot nl (Charlie)
mmm.. not really activities here... Nervertheless, I was wondering if you found a solution to this. I have the same request. I want to output all executed queries at the end of my script. Thnx!
 [2006-04-18 10:58 UTC] ogmueller
as I mentioned in the beginning, I have just added the following lines to the MDB/oci8.php (approx. at line 432) if (!MDB::isError($success)) { if( $prepared_query ) { $this->debug( 'ExecuteQuery: '.$query ); } if (($statement = @OCIParse($this->connection, $query))) { if you do this, you can use the standard debug function in order to get an output of all queries.
 [2006-04-18 17:35 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. This will not work in MDB2 as here we support native prepared statements in most drivers and therefore there is simply no query with all parameters. However I have added a call to debug() in every execute() call. For databases that do not support native prepared statements it will use query() and this will call debug() with the full query with values inlined. For database that do support native prepared statements it will call the debug() method twice. Once with the query containing the placeholders and once with the array of placeholder values.