Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import {Expression, seq, plus, alt, altPrio, ver, optPrio, AlsoIn} from "../combi";
import {Release} from "../../../version";
import {IStatementRunnable} from "../statement_runnable";
import {Dynamic} from "./dynamic";
import {SQLFieldName} from "./sql_field_name";
import {SQLField} from "./sql_field";
import {SQLGroupingSets} from "./sql_grouping_sets";
export class SQLGroupBy extends Expression {
public getRunnable(): IStatementRunnable {
const fieldName = alt(SQLFieldName, Dynamic);
const expr = ver(Release.v740sp02, SQLField, {also: AlsoIn.OpenABAP});
const newGroup = ver(Release.v740sp02,
seq("GROUP BY", expr, altPrio(plus(seq(",", expr)), optPrio(plus(fieldName)))),
{also: AlsoIn.OpenABAP});
const old = seq(plus(seq(fieldName, ",")), fieldName);
const oldGroup = seq("GROUP BY", altPrio(old, plus(fieldName)));
const groupingSetsGroup = ver(Release.v772, seq("GROUP BY", SQLGroupingSets));
return altPrio(groupingSetsGroup, newGroup, oldGroup);
}
} |