UNPKG

@abaplint/core

Version:
31 lines 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectLoop = void 0; const combi_1 = require("../combi"); const _1 = require("."); const sql_order_by_1 = require("./sql_order_by"); const sql_having_1 = require("./sql_having"); const sql_into_structure_1 = require("./sql_into_structure"); const sql_hints_1 = require("./sql_hints"); const sql_field_list_loop_1 = require("./sql_field_list_loop"); const sql_up_to_1 = require("./sql_up_to"); const version_1 = require("../../../version"); const sql_fields_loop_1 = require("./sql_fields_loop"); // note: SELECT loops are matched before single statement SELECTs class SelectLoop extends combi_1.Expression { getRunnable() { const where = (0, combi_1.seq)("WHERE", _1.SQLCond); const bypass = "BYPASSING BUFFER"; const pack = (0, combi_1.seq)("PACKAGE SIZE", _1.SQLSource); const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom))); const packTab = (0, combi_1.seq)(pack, _1.SQLIntoTable); const into = (0, combi_1.altPrio)(sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList); const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure, _1.SQLIntoList, packTab)); const strict = (0, combi_1.seq)(_1.SQLFrom, (0, combi_1.ver)(version_1.Version.v750, sql_fields_loop_1.SQLFieldsLoop), (0, combi_1.optPrio)(_1.SQLForAllEntries), (0, combi_1.optPrio)((0, combi_1.seq)(where, (0, combi_1.optPrio)(sql_order_by_1.SQLOrderBy), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo)))); const aggr = (0, combi_1.seq)((0, combi_1.plusPrio)(_1.SQLAggregation), into, (0, combi_1.optPrio)(sql_up_to_1.SQLUpTo), _1.SQLFrom, (0, combi_1.optPrio)(_1.SQLClient), (0, combi_1.optPrio)(where), _1.SQLGroupBy); const ret = (0, combi_1.seq)("SELECT", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)("DISTINCT"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict, aggr), (0, combi_1.optPrio)(sql_hints_1.SQLHints)); return ret; } } exports.SelectLoop = SelectLoop; //# sourceMappingURL=select_loop.js.map