| @@ 1196-1201 (lines=6) @@ | ||
| 1193 | */ |
|
| 1194 | public function makeGroupByWithHaving( $options ) { |
|
| 1195 | $sql = ''; |
|
| 1196 | if ( isset( $options['GROUP BY'] ) ) { |
|
| 1197 | $gb = is_array( $options['GROUP BY'] ) |
|
| 1198 | ? implode( ',', $options['GROUP BY'] ) |
|
| 1199 | : $options['GROUP BY']; |
|
| 1200 | $sql .= ' GROUP BY ' . $gb; |
|
| 1201 | } |
|
| 1202 | if ( isset( $options['HAVING'] ) ) { |
|
| 1203 | $having = is_array( $options['HAVING'] ) |
|
| 1204 | ? $this->makeList( $options['HAVING'], LIST_AND ) |
|
| @@ 1202-1207 (lines=6) @@ | ||
| 1199 | : $options['GROUP BY']; |
|
| 1200 | $sql .= ' GROUP BY ' . $gb; |
|
| 1201 | } |
|
| 1202 | if ( isset( $options['HAVING'] ) ) { |
|
| 1203 | $having = is_array( $options['HAVING'] ) |
|
| 1204 | ? $this->makeList( $options['HAVING'], LIST_AND ) |
|
| 1205 | : $options['HAVING']; |
|
| 1206 | $sql .= ' HAVING ' . $having; |
|
| 1207 | } |
|
| 1208 | ||
| 1209 | return $sql; |
|
| 1210 | } |
|
| @@ 1221-1227 (lines=7) @@ | ||
| 1218 | * @since 1.21 |
|
| 1219 | */ |
|
| 1220 | public function makeOrderBy( $options ) { |
|
| 1221 | if ( isset( $options['ORDER BY'] ) ) { |
|
| 1222 | $ob = is_array( $options['ORDER BY'] ) |
|
| 1223 | ? implode( ',', $options['ORDER BY'] ) |
|
| 1224 | : $options['ORDER BY']; |
|
| 1225 | ||
| 1226 | return ' ORDER BY ' . $ob; |
|
| 1227 | } |
|
| 1228 | ||
| 1229 | return ''; |
|
| 1230 | } |
|