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, SQLPath} from ".";
import {Version} from "../../../version";
import {WAt, WParenLeftW, WParenRightW} from "../../1_lexer/tokens";
import {Expression, ver, seq, tok, optPrio, opt, altPrio, starPrio, plusPrio} 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,
SQLPath,
SQLFieldName,
Constant);
const sub = seq(altPrio("+", "-", "*", "/", "&&"), optPrio(tok(WParenLeftW)), field, optPrio(tok(WParenRightW)));
const sourc = altPrio(SQLCase, SQLAggregation, SQLFunction, SQLFieldName, SQLSource, Constant);
const val = altPrio(SQLCond, Constant, abap);
const when = seq("WHEN", val, "THEN", sourc, starPrio(sub));
const els = seq("ELSE", sourc);
return ver(Version.v740sp05, seq("CASE", opt(altPrio(SQLFieldName, abap)), plusPrio(when), optPrio(els), "END"));
}
} |