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 26 27 28 29 30 | 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 1x 1x 1x 1x 1x | import {SimpleFieldChain2, SQLAggregation, SQLFunction, SQLPathForColumn} from ".";
import {Release} from "../../../version";
import {WAt, WParenLeftW, WParenRightW} from "../../1_lexer/tokens";
import {Expression, ver, seq, tok, optPrio, opt, altPrio, starPrio, plusPrio, AlsoIn} from "../combi";
import {IStatementRunnable} from "../statement_runnable";
import {Constant} from "./constant";
import {SQLCond} from "./sql_cond";
import {SQLFieldName} from "./sql_field_name";
import {SQLSource} from "./sql_source";
export class SQLCase extends Expression {
public getRunnable(): IStatementRunnable {
const abap = seq(tok(WAt), SimpleFieldChain2);
const field = altPrio(SQLAggregation,
SQLCase,
SQLFunction,
SQLPathForColumn,
SQLFieldName,
Constant);
const sub = seq(altPrio("+", "-", "*", "/", "&&"), optPrio(tok(WParenLeftW)), field, optPrio(tok(WParenRightW)));
const source = altPrio(SQLCase, SQLAggregation, SQLFunction, SQLFieldName, SQLSource, Constant);
const parenSource = seq(tok(WParenLeftW), source, tok(WParenRightW));
const val = altPrio(SQLCond, Constant, abap);
const when = seq("WHEN", val, "THEN", altPrio(parenSource, seq(optPrio("-"), source)), starPrio(sub));
const else_ = seq("ELSE", altPrio(parenSource, seq(optPrio("-"), source)));
return ver(Release.v740sp05, seq("CASE", opt(altPrio(SQLFieldName, abap)), plusPrio(when), optPrio(else_), "END"), {also: AlsoIn.OpenABAP});
}
} |