@abaplint/runtime 2.7.164 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/binary_search.js +2 -2
- package/build/src/builtin/abs.js +5 -0
- package/build/src/builtin/count_any_of.js +1 -1
- package/build/src/builtin/find.js +5 -6
- package/build/src/builtin/round.js +1 -1
- package/build/src/builtin/substring.js +2 -3
- package/build/src/builtin/substring_after.js +3 -3
- package/build/src/builtin/substring_before.js +2 -2
- package/build/src/builtin/trunc.js +5 -0
- package/build/src/expand_in.js +2 -3
- package/build/src/index.js +2 -2
- package/build/src/statements/assign.js +1 -2
- package/build/src/statements/cast.js +3 -4
- package/build/src/statements/convert.js +3 -4
- package/build/src/statements/create_data.js +6 -6
- package/build/src/statements/delete_internal.js +36 -56
- package/build/src/statements/describe.js +1 -2
- package/build/src/statements/find.js +10 -11
- package/build/src/statements/get_time.js +3 -3
- package/build/src/statements/index.js +1 -1
- package/build/src/statements/insert_internal.js +7 -9
- package/build/src/statements/loop.js +56 -83
- package/build/src/statements/message.js +5 -6
- package/build/src/statements/move_corresponding.js +1 -2
- package/build/src/statements/open_cursor.js +1 -1
- package/build/src/statements/read_table.js +20 -21
- package/build/src/statements/replace.js +1 -1
- package/build/src/statements/select.js +4 -5
- package/build/src/statements/set_bit.js +1 -1
- package/build/src/statements/shift.js +10 -10
- package/build/src/statements/sort.js +4 -5
- package/build/src/statements/write.js +7 -8
- package/build/src/template_formatting.js +2 -2
- package/build/src/types/abap_object.js +2 -2
- package/build/src/types/character.js +5 -8
- package/build/src/types/data_reference.js +8 -12
- package/build/src/types/date.js +5 -5
- package/build/src/types/field_symbol.js +7 -12
- package/build/src/types/float.js +1 -1
- package/build/src/types/hex.js +4 -4
- package/build/src/types/integer.js +1 -1
- package/build/src/types/integer8.js +1 -1
- package/build/src/types/numc.js +4 -4
- package/build/src/types/packed.js +3 -3
- package/build/src/types/string.js +3 -3
- package/build/src/types/structure.js +4 -4
- package/build/src/types/table.js +9 -13
- package/build/src/types/time.js +5 -5
- package/build/src/types/utc_long.js +1 -1
- package/build/src/types/xstring.js +3 -3
- package/package.json +2 -2
|
@@ -1,29 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
10
|
-
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
11
|
-
var i, p;
|
|
12
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
13
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
14
|
-
};
|
|
15
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
16
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
18
|
-
return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
19
|
-
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
20
|
-
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
21
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
22
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
23
|
-
function fulfill(value) { resume("next", value); }
|
|
24
|
-
function reject(value) { resume("throw", value); }
|
|
25
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
26
|
-
};
|
|
27
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
3
|
exports.loop = void 0;
|
|
29
4
|
const binary_search_1 = require("../binary_search");
|
|
@@ -48,70 +23,68 @@ function determineFromTo(array, topEquals, key) {
|
|
|
48
23
|
to: to,
|
|
49
24
|
};
|
|
50
25
|
}
|
|
51
|
-
function loop(table, options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
async function* loop(table, options) {
|
|
27
|
+
if (table === undefined) {
|
|
28
|
+
throw new Error("LOOP at undefined");
|
|
29
|
+
}
|
|
30
|
+
else if (table instanceof types_1.FieldSymbol) {
|
|
31
|
+
const pnt = table.getPointer();
|
|
32
|
+
if (pnt === undefined) {
|
|
33
|
+
throw new Error("GETWA_NOT_ASSIGNED");
|
|
55
34
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
35
|
+
yield* loop(pnt, options);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const length = table.getArrayLength();
|
|
39
|
+
if (length === 0) {
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
abap.builtin.sy.get().subrc.set(4);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let loopFrom = options?.from && options?.from.get() > 0 ? options.from.get() - 1 : 0;
|
|
45
|
+
let loopTo = options?.to && options.to.get() < length ? options.to.get() : length;
|
|
46
|
+
let array = [];
|
|
47
|
+
if (options?.usingKey && options.usingKey !== undefined && options.usingKey !== "primary_key") {
|
|
48
|
+
array = table.getSecondaryIndex(options.usingKey);
|
|
49
|
+
const { from, to } = determineFromTo(array, options.topEquals, table.getKeyByName(options.usingKey));
|
|
50
|
+
loopFrom = Math.max(loopFrom, from) - 1;
|
|
51
|
+
loopTo = Math.min(loopTo, to);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
array = table.array();
|
|
55
|
+
}
|
|
56
|
+
const loopController = table.startLoop(loopFrom, loopTo, array);
|
|
57
|
+
let entered = false;
|
|
58
|
+
try {
|
|
59
|
+
const isStructured = array[0] instanceof types_1.Structure;
|
|
60
|
+
while (loopController.index < loopController.loopTo) {
|
|
61
|
+
if (loopController.index > array.length) {
|
|
62
|
+
break;
|
|
60
63
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
abap.builtin.sy.get().subrc.set(4);
|
|
68
|
-
return yield __await(void 0);
|
|
69
|
-
}
|
|
70
|
-
let loopFrom = (options === null || options === void 0 ? void 0 : options.from) && (options === null || options === void 0 ? void 0 : options.from.get()) > 0 ? options.from.get() - 1 : 0;
|
|
71
|
-
let loopTo = (options === null || options === void 0 ? void 0 : options.to) && options.to.get() < length ? options.to.get() : length;
|
|
72
|
-
let array = [];
|
|
73
|
-
if ((options === null || options === void 0 ? void 0 : options.usingKey) && options.usingKey !== undefined && options.usingKey !== "primary_key") {
|
|
74
|
-
array = table.getSecondaryIndex(options.usingKey);
|
|
75
|
-
const { from, to } = determineFromTo(array, options.topEquals, table.getKeyByName(options.usingKey));
|
|
76
|
-
loopFrom = Math.max(loopFrom, from) - 1;
|
|
77
|
-
loopTo = Math.min(loopTo, to);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
array = table.array();
|
|
81
|
-
}
|
|
82
|
-
const loopController = table.startLoop(loopFrom, loopTo, array);
|
|
83
|
-
let entered = false;
|
|
84
|
-
try {
|
|
85
|
-
const isStructured = array[0] instanceof types_1.Structure;
|
|
86
|
-
while (loopController.index < loopController.loopTo) {
|
|
87
|
-
if (loopController.index > array.length) {
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
const current = array[loopController.index];
|
|
91
|
-
if (options === null || options === void 0 ? void 0 : options.where) {
|
|
92
|
-
const row = isStructured ? current.get() : { table_line: current };
|
|
93
|
-
if ((yield __await(options.where(row))) === false) {
|
|
94
|
-
loopController.index++;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
abap.builtin.sy.get().tabix.set(loopController.index + 1);
|
|
100
|
-
entered = true;
|
|
101
|
-
yield yield __await(current);
|
|
102
|
-
loopController.index++;
|
|
103
|
-
if ((options === null || options === void 0 ? void 0 : options.to) === undefined && (options === null || options === void 0 ? void 0 : options.usingKey) === undefined) {
|
|
104
|
-
// extra rows might have been inserted inside the loop
|
|
105
|
-
loopController.loopTo = array.length;
|
|
64
|
+
const current = array[loopController.index];
|
|
65
|
+
if (options?.where) {
|
|
66
|
+
const row = isStructured ? current.get() : { table_line: current };
|
|
67
|
+
if (await options.where(row) === false) {
|
|
68
|
+
loopController.index++;
|
|
69
|
+
continue;
|
|
106
70
|
}
|
|
107
71
|
}
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
table.unregisterLoop(loopController);
|
|
111
72
|
// @ts-ignore
|
|
112
|
-
abap.builtin.sy.get().
|
|
73
|
+
abap.builtin.sy.get().tabix.set(loopController.index + 1);
|
|
74
|
+
entered = true;
|
|
75
|
+
yield current;
|
|
76
|
+
loopController.index++;
|
|
77
|
+
if (options?.to === undefined && options?.usingKey === undefined) {
|
|
78
|
+
// extra rows might have been inserted inside the loop
|
|
79
|
+
loopController.loopTo = array.length;
|
|
80
|
+
}
|
|
113
81
|
}
|
|
114
|
-
}
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
table.unregisterLoop(loopController);
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
abap.builtin.sy.get().subrc.set(entered ? 0 : 4);
|
|
87
|
+
}
|
|
115
88
|
}
|
|
116
89
|
exports.loop = loop;
|
|
117
90
|
//# sourceMappingURL=loop.js.map
|
|
@@ -25,7 +25,6 @@ function replace(text, w) {
|
|
|
25
25
|
return text.trim();
|
|
26
26
|
}
|
|
27
27
|
async function findText(context, arbgb, msgnr, msgty) {
|
|
28
|
-
var _a;
|
|
29
28
|
let text = undefined;
|
|
30
29
|
if (arbgb && msgnr) {
|
|
31
30
|
try {
|
|
@@ -36,17 +35,17 @@ async function findText(context, arbgb, msgnr, msgty) {
|
|
|
36
35
|
text = result[0]["text"];
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
catch
|
|
38
|
+
catch {
|
|
40
39
|
// use fallback text
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
if (text === undefined) {
|
|
44
43
|
// @ts-ignore
|
|
45
|
-
text =
|
|
44
|
+
text = abap.MSAG[arbgb?.trimEnd().toUpperCase()]?.[msgnr];
|
|
46
45
|
}
|
|
47
46
|
if (text === undefined) {
|
|
48
47
|
// fallback
|
|
49
|
-
text = msgty + ":" +
|
|
48
|
+
text = msgty + ":" + arbgb?.trim() + ":" + msgnr + " &1 &2 &3 &4";
|
|
50
49
|
}
|
|
51
50
|
return text;
|
|
52
51
|
}
|
|
@@ -59,12 +58,12 @@ class MessageStatement {
|
|
|
59
58
|
if (arbgb !== undefined && typeof arbgb !== "string") {
|
|
60
59
|
arbgb = arbgb.get();
|
|
61
60
|
}
|
|
62
|
-
arbgb = arbgb
|
|
61
|
+
arbgb = arbgb?.toUpperCase();
|
|
63
62
|
let msgty = options.type;
|
|
64
63
|
if (msgty !== undefined && typeof msgty !== "string") {
|
|
65
64
|
msgty = msgty.get();
|
|
66
65
|
}
|
|
67
|
-
msgty = msgty
|
|
66
|
+
msgty = msgty?.toUpperCase();
|
|
68
67
|
// @ts-ignore
|
|
69
68
|
abap.builtin.sy.get().msgid.set(arbgb || "");
|
|
70
69
|
let msgnr = options.number;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.moveCorresponding = void 0;
|
|
4
4
|
function moveCorresponding(source, target) {
|
|
5
|
-
var _a;
|
|
6
5
|
for (const n in source.get()) {
|
|
7
|
-
|
|
6
|
+
target.get()[n]?.set(source.get()[n]);
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
exports.moveCorresponding = moveCorresponding;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.openCursor = void 0;
|
|
4
4
|
async function openCursor(context, select, options) {
|
|
5
5
|
let db = context.defaultDB();
|
|
6
|
-
if (options
|
|
6
|
+
if (options?.connection) {
|
|
7
7
|
db = context.databaseConnections[options.connection];
|
|
8
8
|
}
|
|
9
9
|
const callbacks = await db.openCursor({ select: select });
|
|
@@ -14,7 +14,7 @@ function searchWithKeyEarlyExit(arr, withKey, startIndex = 0, usesTableLine, fir
|
|
|
14
14
|
row = a.get();
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
row = isStructured ?
|
|
17
|
+
row = isStructured ? { table_line: a, ...a.get() } : { table_line: a };
|
|
18
18
|
}
|
|
19
19
|
if (withKey(row) === true) {
|
|
20
20
|
return {
|
|
@@ -49,7 +49,7 @@ function searchWithKey(arr, withKey, startIndex = 0, usesTableLine) {
|
|
|
49
49
|
row = a.get();
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
row = isStructured ?
|
|
52
|
+
row = isStructured ? { table_line: a, ...a.get() } : { table_line: a };
|
|
53
53
|
}
|
|
54
54
|
if (withKey(row) === true) {
|
|
55
55
|
return {
|
|
@@ -65,7 +65,6 @@ function searchWithKey(arr, withKey, startIndex = 0, usesTableLine) {
|
|
|
65
65
|
}
|
|
66
66
|
/////////////////
|
|
67
67
|
function readTable(table, options) {
|
|
68
|
-
var _a, _b, _c, _d, _e;
|
|
69
68
|
let found = undefined;
|
|
70
69
|
let foundIndex = 0;
|
|
71
70
|
let binarySubrc = undefined;
|
|
@@ -77,9 +76,9 @@ function readTable(table, options) {
|
|
|
77
76
|
return readTable(table.getPointer(), options);
|
|
78
77
|
}
|
|
79
78
|
// check if it is a primary index read specified with WITH KEY instead of WITH TABLE KEY
|
|
80
|
-
if (
|
|
81
|
-
&&
|
|
82
|
-
&& (
|
|
79
|
+
if (options?.withTableKey === undefined
|
|
80
|
+
&& options?.withKeySimple
|
|
81
|
+
&& (table.getOptions().primaryKey?.keyFields || []).length > 0) {
|
|
83
82
|
if (table instanceof types_1.HashedTable) {
|
|
84
83
|
// hashed tables requires all fields for fast lookup
|
|
85
84
|
const fields = new Set(table.getOptions().primaryKey.keyFields);
|
|
@@ -104,7 +103,7 @@ function readTable(table, options) {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
|
-
if (options
|
|
106
|
+
if (options?.index) {
|
|
108
107
|
if (table instanceof types_1.HashedTable) {
|
|
109
108
|
throw new Error("Hashed table, READ INDEX not possible");
|
|
110
109
|
}
|
|
@@ -129,21 +128,21 @@ function readTable(table, options) {
|
|
|
129
128
|
foundIndex = index;
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
else if (table instanceof types_1.HashedTable &&
|
|
131
|
+
else if (table instanceof types_1.HashedTable && options?.withTableKey === true && options.withKeySimple) {
|
|
133
132
|
const hash = table.buildHashFromSimple(options.withKeySimple);
|
|
134
133
|
found = table.read(hash);
|
|
135
134
|
foundIndex = 0;
|
|
136
135
|
}
|
|
137
|
-
else if (table instanceof types_1.HashedTable &&
|
|
136
|
+
else if (table instanceof types_1.HashedTable && options?.withKey) {
|
|
138
137
|
// this is slow..
|
|
139
|
-
const searchResult = searchWithKey(table.array(), options.withKey, 0, options
|
|
138
|
+
const searchResult = searchWithKey(table.array(), options.withKey, 0, options?.usesTableLine);
|
|
140
139
|
found = searchResult.found;
|
|
141
140
|
foundIndex = 0;
|
|
142
141
|
}
|
|
143
|
-
else if (
|
|
142
|
+
else if (options?.keyName && options.withKey && options.withKeySimple) {
|
|
144
143
|
const arr = table.getSecondaryIndex(options.keyName);
|
|
145
144
|
const keyInformation = table.getKeyByName(options.keyName);
|
|
146
|
-
const firstKeyName = keyInformation
|
|
145
|
+
const firstKeyName = keyInformation?.keyFields[0];
|
|
147
146
|
if (firstKeyName === undefined) {
|
|
148
147
|
throw new Error("readTable, first key name not found");
|
|
149
148
|
}
|
|
@@ -151,7 +150,7 @@ function readTable(table, options) {
|
|
|
151
150
|
const firstValue = options.withKeySimple[firstKeyName.toLowerCase()];
|
|
152
151
|
if (firstValue === undefined) {
|
|
153
152
|
// fallback
|
|
154
|
-
return readTable(table,
|
|
153
|
+
return readTable(table, { ...options, withKeySimple: undefined });
|
|
155
154
|
}
|
|
156
155
|
const startIndex = (0, binary_search_1.binarySearchFrom)(arr, 0, arr.length, firstKeyName.toLowerCase(), firstValue) - 1;
|
|
157
156
|
// console.dir("startindex: " + startIndex);
|
|
@@ -162,9 +161,9 @@ function readTable(table, options) {
|
|
|
162
161
|
foundIndex = searchResult.foundIndex;
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
|
-
else if ((
|
|
164
|
+
else if ((options?.binarySearch === true || options?.withTableKey === true)
|
|
166
165
|
&& options.withKeyValue
|
|
167
|
-
&& (
|
|
166
|
+
&& (options?.binarySearch === true || table.getOptions().primaryKey?.type !== types_1.TableAccessType.standard)
|
|
168
167
|
&& options.withKey) {
|
|
169
168
|
// note: it currently only uses the first key field for binary search, todo
|
|
170
169
|
const first = options.withKeyValue[0];
|
|
@@ -190,7 +189,7 @@ function readTable(table, options) {
|
|
|
190
189
|
row = last.get();
|
|
191
190
|
}
|
|
192
191
|
else {
|
|
193
|
-
row = isStructured ?
|
|
192
|
+
row = isStructured ? { table_line: last, ...last.get() } : { table_line: last };
|
|
194
193
|
}
|
|
195
194
|
if ((0, compare_1.ge)(first.value, first.key(row))) {
|
|
196
195
|
binarySubrc = 8;
|
|
@@ -198,20 +197,20 @@ function readTable(table, options) {
|
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
|
-
else if (options
|
|
200
|
+
else if (options?.withKey) {
|
|
202
201
|
const arr = table.array();
|
|
203
202
|
const searchResult = searchWithKey(arr, options.withKey, 0, options.usesTableLine);
|
|
204
203
|
found = searchResult.found;
|
|
205
204
|
foundIndex = searchResult.foundIndex;
|
|
206
205
|
}
|
|
207
|
-
else if (options
|
|
206
|
+
else if (options?.from) {
|
|
208
207
|
if (options.from instanceof types_1.FieldSymbol) {
|
|
209
208
|
options.from = options.from.getPointer();
|
|
210
209
|
}
|
|
211
210
|
if (table instanceof types_1.Table && options.from instanceof types_1.Structure) {
|
|
212
211
|
// todo: optimize if the primary key is sorted
|
|
213
212
|
const arr = table.array();
|
|
214
|
-
const keys =
|
|
213
|
+
const keys = table.getOptions()?.primaryKey?.keyFields;
|
|
215
214
|
const isStructured = arr[0] instanceof types_1.Structure;
|
|
216
215
|
if (keys !== undefined && isStructured === true) {
|
|
217
216
|
// console.dir(keys);
|
|
@@ -239,7 +238,7 @@ function readTable(table, options) {
|
|
|
239
238
|
if (found === undefined) {
|
|
240
239
|
foundIndex = 0;
|
|
241
240
|
}
|
|
242
|
-
if (found === undefined &&
|
|
241
|
+
if (found === undefined && table.getOptions().primaryKey?.type === types_1.TableAccessType.sorted) {
|
|
243
242
|
binarySubrc = 8;
|
|
244
243
|
}
|
|
245
244
|
}
|
|
@@ -250,7 +249,7 @@ function readTable(table, options) {
|
|
|
250
249
|
if (binarySubrc) {
|
|
251
250
|
subrc = binarySubrc;
|
|
252
251
|
}
|
|
253
|
-
else if ((
|
|
252
|
+
else if ((options?.binarySearch === true || options?.keyName !== undefined)
|
|
254
253
|
&& subrc === 4) {
|
|
255
254
|
subrc = 8;
|
|
256
255
|
}
|
|
@@ -7,7 +7,7 @@ const concatenate_1 = require("./concatenate");
|
|
|
7
7
|
function replace(input) {
|
|
8
8
|
if (input.target instanceof types_1.Table) {
|
|
9
9
|
for (const row of input.target.array()) {
|
|
10
|
-
replace(
|
|
10
|
+
replace({ ...input, target: row });
|
|
11
11
|
}
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
@@ -12,12 +12,12 @@ async function select(target, input, runtimeOptions, context) {
|
|
|
12
12
|
// @ts-ignore
|
|
13
13
|
target = target.getPointer();
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
15
|
+
if (runtimeOptions?.appending !== true) {
|
|
16
16
|
if (Array.isArray(target)) {
|
|
17
17
|
target.forEach(f => f.clear());
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
target
|
|
20
|
+
target?.clear();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (rows.length === 0) {
|
|
@@ -41,7 +41,6 @@ async function select(target, input, runtimeOptions, context) {
|
|
|
41
41
|
}
|
|
42
42
|
exports.select = select;
|
|
43
43
|
function rowsToTarget(target, rows) {
|
|
44
|
-
var _a, _b;
|
|
45
44
|
if (target instanceof types_1.Structure) {
|
|
46
45
|
const result = {};
|
|
47
46
|
for (const column in rows[0]) {
|
|
@@ -60,11 +59,11 @@ function rowsToTarget(target, rows) {
|
|
|
60
59
|
for (let columnName in row) {
|
|
61
60
|
columnName = columnName.toLowerCase();
|
|
62
61
|
if (row[columnName] === null) {
|
|
63
|
-
|
|
62
|
+
targetRow.get()[columnName]?.clear();
|
|
64
63
|
continue;
|
|
65
64
|
}
|
|
66
65
|
// @ts-ignore
|
|
67
|
-
|
|
66
|
+
targetRow.get()[columnName]?.set(row[columnName]);
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
else {
|
|
@@ -29,7 +29,7 @@ function setBit(number, hex, val) {
|
|
|
29
29
|
}
|
|
30
30
|
let bits = parseInt(byte, 16);
|
|
31
31
|
const bitMask = 1 << 8 - (number.get() - (byteNum - 1) * 8);
|
|
32
|
-
if (
|
|
32
|
+
if (val?.get() === 0 || val?.get() === "0") {
|
|
33
33
|
bits = bits &= ~bitMask;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
@@ -4,7 +4,7 @@ exports.shift = void 0;
|
|
|
4
4
|
const compare_1 = require("../compare");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
function shift(target, options) {
|
|
7
|
-
if (
|
|
7
|
+
if (options?.mode === "BYTE") {
|
|
8
8
|
shift_byte_mode(target, options);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
@@ -14,7 +14,7 @@ function shift(target, options) {
|
|
|
14
14
|
exports.shift = shift;
|
|
15
15
|
function shift_character_mode(target, options) {
|
|
16
16
|
let value = target.get();
|
|
17
|
-
if (options
|
|
17
|
+
if (options?.deletingLeading) {
|
|
18
18
|
let leading = options.deletingLeading;
|
|
19
19
|
if (typeof leading !== "string") {
|
|
20
20
|
leading = leading.get();
|
|
@@ -24,7 +24,7 @@ function shift_character_mode(target, options) {
|
|
|
24
24
|
value = value.substr(1);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
else if (options
|
|
27
|
+
else if (options?.deletingTrailing) {
|
|
28
28
|
let trailing = options.deletingTrailing;
|
|
29
29
|
if (typeof trailing !== "string") {
|
|
30
30
|
trailing = trailing.get();
|
|
@@ -35,7 +35,7 @@ function shift_character_mode(target, options) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
else if (options
|
|
38
|
+
else if (options?.places) {
|
|
39
39
|
const p = options.places.get();
|
|
40
40
|
if (options.circular) {
|
|
41
41
|
value = value.substr(p) + value.substr(0, p);
|
|
@@ -49,7 +49,7 @@ function shift_character_mode(target, options) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
else if (options
|
|
52
|
+
else if (options?.to) {
|
|
53
53
|
let to = "";
|
|
54
54
|
if (typeof options.to === "string") {
|
|
55
55
|
to = options.to;
|
|
@@ -62,7 +62,7 @@ function shift_character_mode(target, options) {
|
|
|
62
62
|
value = value.substr(index);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
else if (options
|
|
65
|
+
else if (options?.circular) {
|
|
66
66
|
if (options.direction === "RIGHT") {
|
|
67
67
|
value = value.substring(value.length - 1, value.length) + value.substring(0, value.length - 1);
|
|
68
68
|
}
|
|
@@ -82,7 +82,7 @@ function shift_character_mode(target, options) {
|
|
|
82
82
|
}
|
|
83
83
|
function shift_byte_mode(target, options) {
|
|
84
84
|
let value = target.get();
|
|
85
|
-
if (options
|
|
85
|
+
if (options?.deletingLeading) {
|
|
86
86
|
let leading = options.deletingLeading;
|
|
87
87
|
if (typeof leading !== "string") {
|
|
88
88
|
leading = leading.get();
|
|
@@ -92,7 +92,7 @@ function shift_byte_mode(target, options) {
|
|
|
92
92
|
value = value.substr(2);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
else if (options
|
|
95
|
+
else if (options?.places) {
|
|
96
96
|
const p = options.places.get() * 2;
|
|
97
97
|
if (options.circular) {
|
|
98
98
|
value = value.substr(p) + value.substr(0, p);
|
|
@@ -101,7 +101,7 @@ function shift_byte_mode(target, options) {
|
|
|
101
101
|
value = value.substr(p);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
else if (options
|
|
104
|
+
else if (options?.to) {
|
|
105
105
|
let to = "";
|
|
106
106
|
if (typeof options.to === "string") {
|
|
107
107
|
to = options.to;
|
|
@@ -114,7 +114,7 @@ function shift_byte_mode(target, options) {
|
|
|
114
114
|
value = value.substr(index);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
else if (options
|
|
117
|
+
else if (options?.circular) {
|
|
118
118
|
value = value.substr(2) + value.substr(0, 2);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
@@ -43,7 +43,6 @@ function compare(a, b, input) {
|
|
|
43
43
|
}
|
|
44
44
|
function sort(input, options) {
|
|
45
45
|
// console.dir(input);
|
|
46
|
-
var _a, _b;
|
|
47
46
|
if (input instanceof types_1.FieldSymbol) {
|
|
48
47
|
const pnt = input.getPointer();
|
|
49
48
|
if (pnt === undefined) {
|
|
@@ -52,15 +51,15 @@ function sort(input, options) {
|
|
|
52
51
|
sort(pnt, options);
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
|
-
else if (
|
|
54
|
+
else if (options?.skipSortedCheck !== true
|
|
56
55
|
&& input instanceof types_1.Table
|
|
57
|
-
&&
|
|
56
|
+
&& input.getOptions()?.primaryKey?.type === types_1.TableAccessType.sorted) {
|
|
58
57
|
throw new Error("SORT called on sorted table");
|
|
59
58
|
}
|
|
60
59
|
if (input instanceof types_1.HashedTable) {
|
|
61
60
|
throw new Error("Sort hashed table, ugh?");
|
|
62
61
|
}
|
|
63
|
-
if (options
|
|
62
|
+
if (options?.by) {
|
|
64
63
|
if (options.by.length === 0) {
|
|
65
64
|
throw "SortByLengthZero";
|
|
66
65
|
}
|
|
@@ -75,7 +74,7 @@ function sort(input, options) {
|
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
76
|
else {
|
|
78
|
-
const descending =
|
|
77
|
+
const descending = options?.descending === true;
|
|
79
78
|
input.sort((a, b) => {
|
|
80
79
|
if ((0, compare_1.eq)(a, b)) {
|
|
81
80
|
return 0;
|
|
@@ -8,13 +8,12 @@ class WriteStatement {
|
|
|
8
8
|
this.context = context;
|
|
9
9
|
}
|
|
10
10
|
write(source, options) {
|
|
11
|
-
var _a, _b;
|
|
12
11
|
let right = false;
|
|
13
|
-
if (
|
|
12
|
+
if (options?.skipLine === true) {
|
|
14
13
|
this.context.console.add("\n");
|
|
15
14
|
}
|
|
16
15
|
else {
|
|
17
|
-
if (
|
|
16
|
+
if (options?.newLine === true && this.context.console.isEmpty() === false) {
|
|
18
17
|
this.context.console.add("\n");
|
|
19
18
|
}
|
|
20
19
|
let result = "";
|
|
@@ -23,10 +22,10 @@ class WriteStatement {
|
|
|
23
22
|
}
|
|
24
23
|
else if (source instanceof types_1.Structure) {
|
|
25
24
|
const obj = source.getCharacter();
|
|
26
|
-
this.write(obj,
|
|
25
|
+
this.write(obj, { ...options });
|
|
27
26
|
}
|
|
28
27
|
else if (source instanceof types_1.Float) {
|
|
29
|
-
if (
|
|
28
|
+
if (options?.exponent?.get() === 0) {
|
|
30
29
|
const tens = source.getRaw().toFixed(0).length - 1;
|
|
31
30
|
if (options.noSign === true && source.getRaw() < 0) {
|
|
32
31
|
result = source.getRaw().toFixed(17 - tens).replace(".", ",");
|
|
@@ -43,7 +42,7 @@ class WriteStatement {
|
|
|
43
42
|
else if (source instanceof types_1.Packed) {
|
|
44
43
|
let num = source.get();
|
|
45
44
|
let decimals = source.getDecimals();
|
|
46
|
-
if (NO_DEICMAL_CURRENCIES.includes(
|
|
45
|
+
if (NO_DEICMAL_CURRENCIES.includes(options?.currency?.get().trimEnd() || "")) {
|
|
47
46
|
// todo, more work needed here,
|
|
48
47
|
num = num * 100;
|
|
49
48
|
decimals = 0;
|
|
@@ -54,10 +53,10 @@ class WriteStatement {
|
|
|
54
53
|
else {
|
|
55
54
|
result = source.get().toString();
|
|
56
55
|
}
|
|
57
|
-
if (
|
|
56
|
+
if (options?.noSign === true) {
|
|
58
57
|
result = result.replace("-", "");
|
|
59
58
|
}
|
|
60
|
-
if (options
|
|
59
|
+
if (options?.target) {
|
|
61
60
|
if (right === true) {
|
|
62
61
|
const len = options.target.get().length;
|
|
63
62
|
options.target.set(" ".repeat(len - result.length) + result);
|
|
@@ -30,7 +30,7 @@ function templateFormatting(source, options) {
|
|
|
30
30
|
}
|
|
31
31
|
else if (source instanceof types_1.Float) {
|
|
32
32
|
const raw = source.getRaw();
|
|
33
|
-
if (
|
|
33
|
+
if (options?.style === "scientific") {
|
|
34
34
|
text = raw.toExponential().toUpperCase();
|
|
35
35
|
text = text.replace(/([+-])(\d)$/, "$10$2");
|
|
36
36
|
}
|
|
@@ -42,7 +42,7 @@ function templateFormatting(source, options) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else if (source instanceof types_1.Packed) {
|
|
45
|
-
if (options
|
|
45
|
+
if (options?.decimals) {
|
|
46
46
|
text = source.get().toFixed(options.decimals);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
@@ -4,8 +4,8 @@ exports.ABAPObject = void 0;
|
|
|
4
4
|
const field_symbol_1 = require("./field_symbol");
|
|
5
5
|
class ABAPObject {
|
|
6
6
|
constructor(input) {
|
|
7
|
-
this.qualifiedName = input
|
|
8
|
-
this.RTTIName = input
|
|
7
|
+
this.qualifiedName = input?.qualifiedName;
|
|
8
|
+
this.RTTIName = input?.RTTIName;
|
|
9
9
|
this.clear();
|
|
10
10
|
}
|
|
11
11
|
get() {
|