UNPKG

@abaplint/core

Version:
28 lines 1.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Select = void 0; const combi_1 = require("../combi"); const _1 = require("."); const version_1 = require("../../../version"); const sql_group_by_1 = require("./sql_group_by"); const sql_into_structure_1 = require("./sql_into_structure"); const sql_up_to_1 = require("./sql_up_to"); class Select extends combi_1.Expression { getRunnable() { const into = (0, combi_1.altPrio)(_1.SQLIntoTable, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList); const where = (0, combi_1.seq)("WHERE", _1.SQLCond); const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)("OFFSET", _1.SQLSource)); const bypass = (0, combi_1.str)("BYPASSING BUFFER"); const fields = (0, combi_1.ver)(version_1.Version.v750, _1.SQLFields, version_1.Version.OpenABAP); // todo, HINTS cannot be anywhere, need an expression dedicated for strict sql const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset, _1.SQLClient, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection, _1.SQLHints); const permSingle = (0, combi_1.per)(_1.SQLFrom, (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList), where, _1.SQLClient, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection, _1.SQLHints); const fieldList = (0, combi_1.optPrio)(_1.SQLFieldList); const single = (0, combi_1.seq)("SINGLE", (0, combi_1.optPrio)("FOR UPDATE"), fieldList, permSingle); const other = (0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), fieldList, perm); const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)(single, other)); return ret; } } exports.Select = Select; //# sourceMappingURL=select.js.map