| @@ 1237-1242 (lines=6) @@ | ||
| 1234 | */ |
|
| 1235 | public function makeGroupByWithHaving( $options ) { |
|
| 1236 | $sql = ''; |
|
| 1237 | if ( isset( $options['GROUP BY'] ) ) { |
|
| 1238 | $gb = is_array( $options['GROUP BY'] ) |
|
| 1239 | ? implode( ',', $options['GROUP BY'] ) |
|
| 1240 | : $options['GROUP BY']; |
|
| 1241 | $sql .= ' GROUP BY ' . $gb; |
|
| 1242 | } |
|
| 1243 | if ( isset( $options['HAVING'] ) ) { |
|
| 1244 | $having = is_array( $options['HAVING'] ) |
|
| 1245 | ? $this->makeList( $options['HAVING'], LIST_AND ) |
|
| @@ 1243-1248 (lines=6) @@ | ||
| 1240 | : $options['GROUP BY']; |
|
| 1241 | $sql .= ' GROUP BY ' . $gb; |
|
| 1242 | } |
|
| 1243 | if ( isset( $options['HAVING'] ) ) { |
|
| 1244 | $having = is_array( $options['HAVING'] ) |
|
| 1245 | ? $this->makeList( $options['HAVING'], LIST_AND ) |
|
| 1246 | : $options['HAVING']; |
|
| 1247 | $sql .= ' HAVING ' . $having; |
|
| 1248 | } |
|
| 1249 | ||
| 1250 | return $sql; |
|
| 1251 | } |
|
| @@ 1262-1268 (lines=7) @@ | ||
| 1259 | * @since 1.21 |
|
| 1260 | */ |
|
| 1261 | public function makeOrderBy( $options ) { |
|
| 1262 | if ( isset( $options['ORDER BY'] ) ) { |
|
| 1263 | $ob = is_array( $options['ORDER BY'] ) |
|
| 1264 | ? implode( ',', $options['ORDER BY'] ) |
|
| 1265 | : $options['ORDER BY']; |
|
| 1266 | ||
| 1267 | return ' ORDER BY ' . $ob; |
|
| 1268 | } |
|
| 1269 | ||
| 1270 | return ''; |
|
| 1271 | } |
|