Home » Database » MDB_QueryTool » Bug #8319
* is stripped from $what when performing simple querys
Details
| Submitted | 2006-07-29 14:35 UTC |
|---|---|
| From | miker at laynemorgan dot com |
| Assigned | quipo |
| Status | Closed |
| Package | MDB_QueryTool |
| PHP Version | 5.1.4 |
| OS | Windows XP SP2 |
| Roadmaps | (Not assigned) |
Comments
[2006-07-29 14:35 UTC] miker at laynemorgan dot com
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 15:43 UTC] bbaumer at nymets dot com
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 15: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.