UNPKG

@abaplint/core

Version:
26 lines 2.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SQLCompare = void 0; const combi_1 = require("../combi"); const _1 = require("."); const version_1 = require("../../../version"); const tokens_1 = require("../../1_lexer/tokens"); class SQLCompare extends combi_1.Expression { getRunnable() { const subSelect = (0, combi_1.seq)("(", _1.Select, ")"); const subSelectDouble = (0, combi_1.seq)("(", "(", _1.Select, ")", ")"); const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource); const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource))); const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL"))); const source = new _1.SQLSource(); const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), (0, combi_1.altPrio)(subSelect, subSelectDouble)); const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)), version_1.Version.OpenABAP); const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW)); const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)), version_1.Version.OpenABAP); const rett = (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLFunction, _1.ConstantString, (0, combi_1.seq)((0, combi_1.altPrio)(_1.SQLPath, _1.SQLFieldName), (0, combi_1.optPrio)(arith)), at), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(_1.SQLIn, like, between)), nul)); const exists = (0, combi_1.seq)("EXISTS", subSelect); return (0, combi_1.altPrio)(exists, _1.Dynamic, rett); } } exports.SQLCompare = SQLCompare; //# sourceMappingURL=sql_compare.js.map