[Phpmyadmin-devel] 2.10.0-dev: No column sorting possible
Marc Delisle
Marc.Delisle at cegepsherbrooke.qc.ca
Wed Aug 16 17:45:46 CEST 2006
Garvin Hicking a écrit :
> Hi!
>
>> "ORDER BY `table` . `colum` DESC"
>
> The additional space is making the string compare fail.
>
> This patch seems to fix it:
>
> http://nopaste.php-q.net/232872
>
> I don't know if that introduces side effects. I think the better fix would be to
> look why extra spaces have been introduced before and after the "."?
>
> Regards,
> Garvin
>
Try the "better fix":
Index: sqlparser.lib.php
===================================================================
RCS file: /cvsroot/phpmyadmin/phpMyAdmin/libraries/sqlparser.lib.php,v
retrieving revision 2.50
diff -c -r2.50 sqlparser.lib.php
*** sqlparser.lib.php 2 Aug 2006 11:36:12 -0000 2.50
--- sqlparser.lib.php 16 Aug 2006 15:44:50 -0000
***************
*** 1512,1518 ****
$group_by_clause .= $arr[$i]['data'] . $sep;
}
if ($in_order_by && $upper_data != 'ORDER' && $upper_data
!= 'BY') {
! $order_by_clause .= $arr[$i]['data'] . $sep;
}
if ($in_having && $upper_data != 'HAVING') {
$having_clause .= $arr[$i]['data'] . $sep;
--- 1512,1523 ----
$group_by_clause .= $arr[$i]['data'] . $sep;
}
if ($in_order_by && $upper_data != 'ORDER' && $upper_data
!= 'BY') {
! // add a space only before ASC or DESC
! // not around the dot between dbname and tablename
! if ($arr[$i]['type'] == 'alpha_reservedWord') {
! $order_by_clause .= $sep;
! }
! $order_by_clause .= $arr[$i]['data'];
}
if ($in_having && $upper_data != 'HAVING') {
$having_clause .= $arr[$i]['data'] . $sep;
More information about the Developers
mailing list