r81272 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81271‎ | r81272 | r81273 >
Date:21:04, 31 January 2011
Author:mah
Status:ok (Comments)
Tags:
Comment:
fix Bug#26274: Database layer should allow arrays for ORDER BY, GROUP BY
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -950,7 +950,10 @@
951951 }
952952
953953 if ( isset( $options['GROUP BY'] ) ) {
954 - $preLimitTail .= " GROUP BY {$options['GROUP BY']}";
 954+ $gb = is_array( $options['GROUP BY'] )
 955+ ? implode( ',', $options['GROUP BY'] )
 956+ : $options['GROUP BY'];
 957+ $preLimitTail .= " GROUP BY {$gb}";
955958 }
956959
957960 if ( isset( $options['HAVING'] ) ) {
@@ -958,7 +961,10 @@
959962 }
960963
961964 if ( isset( $options['ORDER BY'] ) ) {
962 - $preLimitTail .= " ORDER BY {$options['ORDER BY']}";
 965+ $ob = is_array( $options['ORDER BY'] )
 966+ ? implode( ',', $options['ORDER BY'] )
 967+ : $options['ORDER BY'];
 968+ $preLimitTail .= " ORDER BY {$ob}";
963969 }
964970
965971 // if (isset($options['LIMIT'])) {

Comments

#Comment by Reedy (talk | contribs)   21:30, 31 January 2011
#Comment by Reedy (talk | contribs)   21:40, 31 January 2011

Oh, little heads up here hexmode, if you apply someones patch, even if it's a already credited developer, it's nice to note it being theres in the commit summary :)

#Comment by MarkAHershberger (talk | contribs)   21:42, 31 January 2011

Didn't mean to take credit: thought the bug credit was enough. Will change.

#Comment by Reedy (talk | contribs)   21:43, 31 January 2011

Not a big deal, I'm sure Chad won't loose much sleep over it! Heh

#Comment by 😂 (talk | contribs)   22:47, 31 January 2011

I didn't even remember the bug.

If I wanted to steal credit, I'd rewrite the commit to be owned by me ;-)

Status & tagging log