From: Mark A. Hershberger Date: Mon, 31 Jan 2011 21:04:40 +0000 (+0000) Subject: fix Bug#26274: Database layer should allow arrays for ORDER BY, GROUP BY X-Git-Tag: 1.31.0-rc.0~32279 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=10aa275e6b1eac38934581acd9eb6a0f25e2f310;p=lhc%2Fweb%2Fwiklou.git fix Bug#26274: Database layer should allow arrays for ORDER BY, GROUP BY --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 1a046397ca..5adf5dac5e 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -950,7 +950,10 @@ abstract class DatabaseBase implements DatabaseType { } if ( isset( $options['GROUP BY'] ) ) { - $preLimitTail .= " GROUP BY {$options['GROUP BY']}"; + $gb = is_array( $options['GROUP BY'] ) + ? implode( ',', $options['GROUP BY'] ) + : $options['GROUP BY']; + $preLimitTail .= " GROUP BY {$gb}"; } if ( isset( $options['HAVING'] ) ) { @@ -958,7 +961,10 @@ abstract class DatabaseBase implements DatabaseType { } if ( isset( $options['ORDER BY'] ) ) { - $preLimitTail .= " ORDER BY {$options['ORDER BY']}"; + $ob = is_array( $options['ORDER BY'] ) + ? implode( ',', $options['ORDER BY'] ) + : $options['ORDER BY']; + $preLimitTail .= " ORDER BY {$ob}"; } // if (isset($options['LIMIT'])) {