[Typo3-dev] Bug. Very simple to correct. If I'm correct :-)

Kasper Skårhøj kasper at typo3.com
Fri Apr 2 09:21:36 CEST 2004


Please check latest CVS.

order was reversed some versions ago.

- kasper


On Thu, 2004-04-01 at 18:51, Stig N. Jepsen wrote:
> Regarding
> the getWhere() function of
> class.tslib_content.php,v 1.9 2003/12/19 22:49:04
> 
> Now, I'm not sure if this is corrected in later versions of this class.
> 
> When will this bug be a problem?:
> If you want to use both the group by clause and the order by clause in the
> same select statement.
> 
> According to the MySQL manual about the SELECT syntax:
> http://www.mysql.com/doc/en/SELECT.html
> Here you can see in which order the different clauses should come.
> 
> I have found that in v 1.9 of this class the order is incorrect.
> 
> Wrong order:
>   // order By
>   if (trim($conf['orderBy'])) {
>    $query.=' ORDER BY '.trim($conf['orderBy']);
>   }
>   // group By
>   if (trim($conf['groupBy'])) {
>    $query.=' GROUP BY '.trim($conf['groupBy']);
>   }
> 
> Correct order:
>   // group By
>   if (trim($conf['groupBy'])) {
>    $query.=' GROUP BY '.trim($conf['groupBy']);
>   }
>   // order By
>   if (trim($conf['orderBy'])) {
>    $query.=' ORDER BY '.trim($conf['orderBy']);
>   }
> 
> That's all.
> 
> /Stig
> 
> 
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
-- 

Best regards

- kasper

---------------
"Zero MS-gravity" - finally migrated to Linux!






More information about the TYPO3-dev mailing list