Home » Database » MDB_QueryTool » Bug #9130
setOrder doubles name of table
Details
| Submitted | 2006-10-22 03:16 UTC |
|---|---|
| From | mjjareo at gmail dot com |
| Assigned | quipo |
| Status | Closed |
| Package | MDB_QueryTool |
| PHP Version | Irrelevant |
| OS | All |
| Roadmaps | (Not assigned) |
Comments
[2006-10-22 03:16 UTC] mjjareo at gmail dot com
Description:
------------
If one of the columns of a table has the same name as the name of the table, then then _buildOrder returns "tablename.tablename.orderColumnName". This causes the query to fail.
A quick inspection of the code shows that this is occurring because preg_replace will prepend the table name twice.
This bug looks like it will occur in other places where the column name is being transformed to tablename.columnname.
Test script:
---------------
You need a table that has a column whose name is the same as the table name.
class QuestionDAO extends MDB_QueryTool
{
$table = "question";
public function do()
{
$this->setOrder("position");
}
}
Expected result:
----------------
the query should be....
select * from question order by question.position;
Actual result:
--------------
but is...
select * from question order by question.question.position;