| @@ 1277-1282 (lines=6) @@ | ||
| 1274 | */ |
|
| 1275 | public function makeGroupByWithHaving( $options ) { |
|
| 1276 | $sql = ''; |
|
| 1277 | if ( isset( $options['GROUP BY'] ) ) { |
|
| 1278 | $gb = is_array( $options['GROUP BY'] ) |
|
| 1279 | ? implode( ',', $options['GROUP BY'] ) |
|
| 1280 | : $options['GROUP BY']; |
|
| 1281 | $sql .= ' GROUP BY ' . $gb; |
|
| 1282 | } |
|
| 1283 | if ( isset( $options['HAVING'] ) ) { |
|
| 1284 | $having = is_array( $options['HAVING'] ) |
|
| 1285 | ? $this->makeList( $options['HAVING'], LIST_AND ) |
|
| @@ 1283-1288 (lines=6) @@ | ||
| 1280 | : $options['GROUP BY']; |
|
| 1281 | $sql .= ' GROUP BY ' . $gb; |
|
| 1282 | } |
|
| 1283 | if ( isset( $options['HAVING'] ) ) { |
|
| 1284 | $having = is_array( $options['HAVING'] ) |
|
| 1285 | ? $this->makeList( $options['HAVING'], LIST_AND ) |
|
| 1286 | : $options['HAVING']; |
|
| 1287 | $sql .= ' HAVING ' . $having; |
|
| 1288 | } |
|
| 1289 | ||
| 1290 | return $sql; |
|
| 1291 | } |
|
| @@ 1302-1308 (lines=7) @@ | ||
| 1299 | * @since 1.21 |
|
| 1300 | */ |
|
| 1301 | public function makeOrderBy( $options ) { |
|
| 1302 | if ( isset( $options['ORDER BY'] ) ) { |
|
| 1303 | $ob = is_array( $options['ORDER BY'] ) |
|
| 1304 | ? implode( ',', $options['ORDER BY'] ) |
|
| 1305 | : $options['ORDER BY']; |
|
| 1306 | ||
| 1307 | return ' ORDER BY ' . $ob; |
|
| 1308 | } |
|
| 1309 | ||
| 1310 | return ''; |
|
| 1311 | } |
|