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

Request #8878 Simplify autoExecute() behaviour to select some columns.
Submitted: 2006-10-06 23:16 UTC
From: simon at ruderich dot com Assigned: davidc
Status: Closed Package: MDB2 (version CVS)
PHP Version: Irrelevant OS: Mac OS X 10.4
Roadmaps: (Not assigned)    
Subscription  


 [2006-10-06 23:16 UTC] simon at ruderich dot com (Simon Ruderich)
Description: ------------ I tried to get autoExecute() from MDB2 Extended to return all columns, but I only got an error because of a wrong Query: "SELECT FROM". Now I looked up in CVS and noticed that this bug is already fixed. It would be nice if you make an official release to fix this bug which is quite a problem (for me). But there is still a problem if I want to select only some columns. It would be better to use autoExecute() this way: autoExecute( 'table', array( 'column_one', 'column_two', ... ), MDB2_AUTOQUERY_SELECT, 'where condition', null, true, MDB2_PREPARE_RESULT ) So you only have to specify the columns and not their types which is not necessary with SELECT or UPDATE queries either. Another possibility would be to allow the use of the last parameter of autoExecute () $result_types as flat array of column names without the type as value. I added a patch for my first idea. It can be run on the CVS version 1.54 of MDB2/ Extended.php. This patch would also not interfere with the "old" use of autoExecute() with SELECTs where the last parameter is used. I hope you could add this feature to MDB2 Extended. Thanks for your great work with MDB2, Simon Test script: --------------- --- Extended.php (CVS 1.54) 2006-10-07 00:36:33.000000000 +0200 +++ Extended.php (my patch) 2006-10-07 01:06:05.000000000 +0200 @@ -135,6 +135,8 @@ if ($mode == MDB2_AUTOQUERY_SELECT) { if (is_array($result_types)) { $keys = array_keys($result_types); + } elseif (!empty( $fields_values)) { + $keys = $fields_values; } else { $keys = array(); }

Comments

 [2006-10-07 00:33 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-10-09 01:08 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!