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

Bug #8319 * is stripped from $what when performing simple querys
Submitted: 2006-07-29 09:35 UTC Modified: 2006-08-09 04:59 UTC
From: miker at laynemorgan dot com Assigned: quipo
Status: Closed Package: MDB_QueryTool (version 1.1.1)
PHP Version: 5.1.4 OS: Windows XP SP2
Roadmaps: (Not assigned)    

 [2006-07-29 09:35 UTC] miker at laynemorgan dot com (Mike Rosile)
Description: ------------ When following along with the MDB_QueryTool introduction and using the code samples, the methods "get" and "getAll" return false. ie. $db = new MDB_QueryTool($dsn, $options, 2); $db->reset(); $res = $db->getAll(); var_dump($res); // This will return bool(false) echo $db->getQueryString(); // Returns something like: SELECT FROM (table) Further inspection shows that the * is stripped during the function _buildSelect in MDB/QueryTool/Query.php line 1739, which currently reads: $selectAllFromTables = array_unique($res[1]); // make the table names unique, so we do it all just once for each table $res[1] contains an empty string. If we change $res[1] to $res[0], the first element of the array will contain a string with an *, as intended for a simple SELECT * FROM (table) query. Test script: --------------- Just follow the example script given in the MDB_QueryTool introdoction. Expected result: ---------------- I expect getAll() to return all rows in a table, without having to specify the fields manually with a setSelect() statement. Actual result: -------------- The method getQueryString will return the query string with the * stripped, between SELECT and FROM, leaving a string that looks like this: "SELECT FROM (table)" Additionally, methods get() or getAll() will return false.


 [2006-08-02 10:43 UTC] bbaumer at nymets dot com (Ben Baumer)
I ran into this same problem after upgrading MDB2 from version 2.1.0 to version 2.2.0. The problem did not exist with the previous version.
 [2006-08-02 10:46 UTC] miker at laynemorgan dot com
That's a good point, I just installed the latest version of MDB2 as well. I never really used MDB_QueryTool enough though to have noticed that it worked fine with earlier versions of MDB2.
 [2006-08-09 04:59 UTC] quipo (Lorenzo Alberton)
I think I found the culprit: it was the "idxname_format" option of MDB2, which is "%s_idx" by default, but the index has to be created by MDB2 to have that format. MDB_QueryTool now defaults to "%s". Please grab the CVS version and let me know if you still experience the issue.