@abaplint/runtime 2.13.82 → 2.13.84
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/builtin/find_any_not_of.d.ts +11 -0
- package/build/src/builtin/find_any_not_of.js +43 -0
- package/build/src/builtin/find_any_of.d.ts +11 -0
- package/build/src/builtin/find_any_of.js +46 -0
- package/build/src/builtin/index.d.ts +2 -0
- package/build/src/builtin/index.js +2 -0
- package/build/src/db/db.d.ts +3 -0
- package/build/src/statements/assign.js +7 -0
- package/build/src/statements/commit.d.ts +8 -1
- package/build/src/statements/commit.js +17 -2
- package/build/src/statements/find.js +6 -1
- package/build/src/statements/index.d.ts +4 -4
- package/build/src/statements/index.js +6 -2
- package/build/src/statements/rollback.d.ts +6 -1
- package/build/src/statements/rollback.js +13 -2
- package/build/src/types/xstring.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Integer } from "../types";
|
|
2
|
+
import { ICharacter } from "../types/_character";
|
|
3
|
+
import { INumeric } from "../types/_numeric";
|
|
4
|
+
export interface IFindAnyNotOfInput {
|
|
5
|
+
val: ICharacter | string;
|
|
6
|
+
sub: ICharacter | string;
|
|
7
|
+
off?: INumeric | number;
|
|
8
|
+
len?: INumeric | number;
|
|
9
|
+
occ?: INumeric | number;
|
|
10
|
+
}
|
|
11
|
+
export declare function find_any_not_of(input: IFindAnyNotOfInput): Integer;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.find_any_not_of = find_any_not_of;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const throw_error_1 = require("../throw_error");
|
|
6
|
+
function find_any_not_of(input) {
|
|
7
|
+
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
8
|
+
const sub = typeof input.sub === "string" ? input.sub : input.sub.get();
|
|
9
|
+
const off = typeof input.off === "number" ? input.off : input.off?.get() || 0;
|
|
10
|
+
const len = typeof input.len === "number" ? input.len : input.len?.get();
|
|
11
|
+
let occ = typeof input.occ === "number" ? input.occ : input.occ?.get();
|
|
12
|
+
if (occ === 0) {
|
|
13
|
+
(0, throw_error_1.throwError)("CX_SY_STRG_PAR_VAL");
|
|
14
|
+
}
|
|
15
|
+
else if (occ === undefined) {
|
|
16
|
+
occ = 1;
|
|
17
|
+
}
|
|
18
|
+
if (off < 0 || off > val.length) {
|
|
19
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
20
|
+
}
|
|
21
|
+
if (len !== undefined && (len < 0 || off + len > val.length)) {
|
|
22
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
23
|
+
}
|
|
24
|
+
const end = len === undefined ? val.length : off + len;
|
|
25
|
+
const characters = new Set(sub.split(""));
|
|
26
|
+
let remaining = Math.abs(occ);
|
|
27
|
+
if (occ > 0) {
|
|
28
|
+
for (let i = off; i < end; i++) {
|
|
29
|
+
if (!characters.has(val.charAt(i)) && --remaining === 0) {
|
|
30
|
+
return new types_1.Integer().set(i);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
for (let i = end - 1; i >= off; i--) {
|
|
36
|
+
if (!characters.has(val.charAt(i)) && --remaining === 0) {
|
|
37
|
+
return new types_1.Integer().set(i);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return new types_1.Integer().set(-1);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=find_any_not_of.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Integer } from "../types";
|
|
2
|
+
import { ICharacter } from "../types/_character";
|
|
3
|
+
import { INumeric } from "../types/_numeric";
|
|
4
|
+
export interface IFindAnyOfInput {
|
|
5
|
+
val: ICharacter | string;
|
|
6
|
+
sub: ICharacter | string;
|
|
7
|
+
off?: INumeric | number;
|
|
8
|
+
len?: INumeric | number;
|
|
9
|
+
occ?: INumeric | number;
|
|
10
|
+
}
|
|
11
|
+
export declare function find_any_of(input: IFindAnyOfInput): Integer;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.find_any_of = find_any_of;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const throw_error_1 = require("../throw_error");
|
|
6
|
+
function find_any_of(input) {
|
|
7
|
+
const val = typeof input.val === "string" ? input.val : input.val.get();
|
|
8
|
+
const sub = typeof input.sub === "string" ? input.sub : input.sub.get();
|
|
9
|
+
const off = typeof input.off === "number" ? input.off : input.off?.get() || 0;
|
|
10
|
+
const len = typeof input.len === "number" ? input.len : input.len?.get();
|
|
11
|
+
let occ = typeof input.occ === "number" ? input.occ : input.occ?.get();
|
|
12
|
+
if (occ === 0) {
|
|
13
|
+
(0, throw_error_1.throwError)("CX_SY_STRG_PAR_VAL");
|
|
14
|
+
}
|
|
15
|
+
else if (occ === undefined) {
|
|
16
|
+
occ = 1;
|
|
17
|
+
}
|
|
18
|
+
if (off < 0 || off > val.length) {
|
|
19
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
20
|
+
}
|
|
21
|
+
if (len !== undefined && (len < 0 || off + len > val.length)) {
|
|
22
|
+
(0, throw_error_1.throwError)("CX_SY_RANGE_OUT_OF_BOUNDS");
|
|
23
|
+
}
|
|
24
|
+
if (sub === "") {
|
|
25
|
+
return new types_1.Integer().set(-1);
|
|
26
|
+
}
|
|
27
|
+
const end = len === undefined ? val.length : off + len;
|
|
28
|
+
const characters = new Set(sub.split(""));
|
|
29
|
+
let remaining = Math.abs(occ);
|
|
30
|
+
if (occ > 0) {
|
|
31
|
+
for (let i = off; i < end; i++) {
|
|
32
|
+
if (characters.has(val.charAt(i)) && --remaining === 0) {
|
|
33
|
+
return new types_1.Integer().set(i);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
for (let i = end - 1; i >= off; i--) {
|
|
39
|
+
if (characters.has(val.charAt(i)) && --remaining === 0) {
|
|
40
|
+
return new types_1.Integer().set(i);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return new types_1.Integer().set(-1);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=find_any_of.js.map
|
|
@@ -15,6 +15,8 @@ export * from "./count";
|
|
|
15
15
|
export * from "./escape";
|
|
16
16
|
export * from "./exp";
|
|
17
17
|
export * from "./find";
|
|
18
|
+
export * from "./find_any_not_of";
|
|
19
|
+
export * from "./find_any_of";
|
|
18
20
|
export * from "./floor";
|
|
19
21
|
export * from "./frac";
|
|
20
22
|
export * from "./from_mixed";
|
|
@@ -32,6 +32,8 @@ __exportStar(require("./count"), exports);
|
|
|
32
32
|
__exportStar(require("./escape"), exports);
|
|
33
33
|
__exportStar(require("./exp"), exports);
|
|
34
34
|
__exportStar(require("./find"), exports);
|
|
35
|
+
__exportStar(require("./find_any_not_of"), exports);
|
|
36
|
+
__exportStar(require("./find_any_of"), exports);
|
|
35
37
|
__exportStar(require("./floor"), exports);
|
|
36
38
|
__exportStar(require("./frac"), exports);
|
|
37
39
|
__exportStar(require("./from_mixed"), exports);
|
package/build/src/db/db.d.ts
CHANGED
|
@@ -42,8 +42,11 @@ export interface DatabaseClient {
|
|
|
42
42
|
disconnect(): Promise<void>;
|
|
43
43
|
/*** execute any native SQL command */
|
|
44
44
|
execute(sql: string | string[]): Promise<void>;
|
|
45
|
+
/*** no-op if a transaction is already open */
|
|
45
46
|
beginTransaction(): Promise<void>;
|
|
47
|
+
/*** no-op if no transaction is open */
|
|
46
48
|
commit(): Promise<void>;
|
|
49
|
+
/*** no-op if no transaction is open */
|
|
47
50
|
rollback(): Promise<void>;
|
|
48
51
|
delete(options: DeleteDatabaseOptions): Promise<{
|
|
49
52
|
subrc: number;
|
|
@@ -21,6 +21,13 @@ function assign(input) {
|
|
|
21
21
|
for (const s of split) {
|
|
22
22
|
const upperS = s.toUpperCase().trimEnd();
|
|
23
23
|
if (upperS === "*") {
|
|
24
|
+
if (!(input.dynamicSource instanceof types_1.DataReference)
|
|
25
|
+
&& !(input.dynamicSource instanceof types_1.FieldSymbol)) {
|
|
26
|
+
// an earlier segment resolved to nothing, or to something that has
|
|
27
|
+
// no address, so the name cannot be followed: sy-subrc 4
|
|
28
|
+
abap.builtin.sy.get().subrc.set(4);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
24
31
|
// @ts-ignore
|
|
25
32
|
input.dynamicSource = input.dynamicSource.dereference();
|
|
26
33
|
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
export interface ICommitOptions {
|
|
3
|
+
/** COMMIT CONNECTION, name of the database connection to commit */
|
|
4
|
+
connection?: string;
|
|
5
|
+
/** COMMIT WORK AND WAIT, note that updates are always executed synchronously */
|
|
6
|
+
wait?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function commit(context: Context, options?: ICommitOptions): Promise<void>;
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commit = commit;
|
|
4
|
-
function commit() {
|
|
5
|
-
|
|
4
|
+
async function commit(context, options) {
|
|
5
|
+
if (options?.connection !== undefined) {
|
|
6
|
+
const db = context.databaseConnections[options.connection];
|
|
7
|
+
if (db === undefined) {
|
|
8
|
+
throw new Error(`COMMIT CONNECTION, unknown connection "${options.connection}"`);
|
|
9
|
+
}
|
|
10
|
+
await db.commit();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// COMMIT WORK ends the current LUW, ie. all open database connections are committed
|
|
14
|
+
for (const name of Object.keys(context.databaseConnections)) {
|
|
15
|
+
await context.databaseConnections[name].commit();
|
|
16
|
+
}
|
|
17
|
+
// sy-subrc is only set when the WAIT addition is specified
|
|
18
|
+
if (options?.wait === true) {
|
|
19
|
+
abap.builtin.sy.get().subrc.set(0);
|
|
20
|
+
}
|
|
6
21
|
}
|
|
7
22
|
//# sourceMappingURL=commit.js.map
|
|
@@ -12,7 +12,12 @@ function find(input, options) {
|
|
|
12
12
|
let s = "";
|
|
13
13
|
if (options.find) {
|
|
14
14
|
s = options.find;
|
|
15
|
-
if (
|
|
15
|
+
if (s instanceof types_1.Character) {
|
|
16
|
+
// trailing blanks are ignored for fixed length character typed operands,
|
|
17
|
+
// note that text string operands keep them
|
|
18
|
+
s = s.getTrimEnd();
|
|
19
|
+
}
|
|
20
|
+
else if (typeof s !== "string") {
|
|
16
21
|
s = s.get();
|
|
17
22
|
}
|
|
18
23
|
if (s === "") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { append } from "./append";
|
|
2
2
|
import { assert } from "./assert";
|
|
3
3
|
import { assign } from "./assign";
|
|
4
|
-
import {
|
|
4
|
+
import { ICommitOptions } from "./commit";
|
|
5
5
|
import { concatenate } from "./concatenate";
|
|
6
6
|
import { condense } from "./condense";
|
|
7
7
|
import { convert } from "./convert";
|
|
@@ -33,7 +33,7 @@ import { modifyInternal } from "./modify_internal";
|
|
|
33
33
|
import { moveCorresponding } from "./move_corresponding";
|
|
34
34
|
import { readTable } from "./read_table";
|
|
35
35
|
import { replace } from "./replace";
|
|
36
|
-
import {
|
|
36
|
+
import { IRollbackOptions } from "./rollback";
|
|
37
37
|
import { setBit } from "./set_bit";
|
|
38
38
|
import { shift } from "./shift";
|
|
39
39
|
import { sort } from "./sort";
|
|
@@ -59,7 +59,6 @@ export declare class Statements {
|
|
|
59
59
|
assign: typeof assign;
|
|
60
60
|
cast: typeof cast;
|
|
61
61
|
collect: typeof collect;
|
|
62
|
-
commit: typeof commit;
|
|
63
62
|
concatenate: typeof concatenate;
|
|
64
63
|
condense: typeof condense;
|
|
65
64
|
convert: typeof convert;
|
|
@@ -81,7 +80,6 @@ export declare class Statements {
|
|
|
81
80
|
raiseEvent: typeof raiseEvent;
|
|
82
81
|
readTable: typeof readTable;
|
|
83
82
|
replace: typeof replace;
|
|
84
|
-
rollback: typeof rollback;
|
|
85
83
|
setBit: typeof setBit;
|
|
86
84
|
setHandler: typeof setHandler;
|
|
87
85
|
setLocale: typeof setLocale;
|
|
@@ -99,6 +97,8 @@ export declare class Statements {
|
|
|
99
97
|
openCursor(target: INumeric, select: string, options: IOpenCursorDatabaseOptions): Promise<void>;
|
|
100
98
|
fetchNextCursor(cursor: INumeric, target: any, packageSize?: INumeric): Promise<void>;
|
|
101
99
|
closeCursor(cursor: INumeric): Promise<void>;
|
|
100
|
+
commit(options?: ICommitOptions): Promise<void>;
|
|
101
|
+
rollback(options?: IRollbackOptions): Promise<void>;
|
|
102
102
|
deleteDatabase(table: string | ICharacter, options: IDeleteDatabaseOptions): Promise<void>;
|
|
103
103
|
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number | undefined>;
|
|
104
104
|
modifyDatabase(table: string | ICharacter, options: IModifyDatabaseOptions): Promise<void>;
|
|
@@ -62,7 +62,6 @@ class Statements {
|
|
|
62
62
|
assign = assign_1.assign;
|
|
63
63
|
cast = cast_1.cast;
|
|
64
64
|
collect = collect_1.collect;
|
|
65
|
-
commit = commit_1.commit;
|
|
66
65
|
concatenate = concatenate_1.concatenate;
|
|
67
66
|
condense = condense_1.condense;
|
|
68
67
|
convert = convert_1.convert;
|
|
@@ -84,7 +83,6 @@ class Statements {
|
|
|
84
83
|
raiseEvent = raise_event_1.raiseEvent;
|
|
85
84
|
readTable = read_table_1.readTable;
|
|
86
85
|
replace = replace_1.replace;
|
|
87
|
-
rollback = rollback_1.rollback;
|
|
88
86
|
setBit = set_bit_1.setBit;
|
|
89
87
|
setHandler = set_handler_1.setHandler;
|
|
90
88
|
setLocale = set_locale_1.setLocale;
|
|
@@ -113,6 +111,12 @@ class Statements {
|
|
|
113
111
|
async closeCursor(cursor) {
|
|
114
112
|
await (0, close_cursor_1.closeCursor)(this.context, cursor.get());
|
|
115
113
|
}
|
|
114
|
+
async commit(options) {
|
|
115
|
+
return (0, commit_1.commit)(this.context, options);
|
|
116
|
+
}
|
|
117
|
+
async rollback(options) {
|
|
118
|
+
return (0, rollback_1.rollback)(this.context, options);
|
|
119
|
+
}
|
|
116
120
|
async deleteDatabase(table, options) {
|
|
117
121
|
await (0, delete_database_1.deleteDatabase)(table, options, this.context);
|
|
118
122
|
}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
export interface IRollbackOptions {
|
|
3
|
+
/** ROLLBACK CONNECTION, name of the database connection to roll back */
|
|
4
|
+
connection?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function rollback(context: Context, options?: IRollbackOptions): Promise<void>;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rollback = rollback;
|
|
4
|
-
function rollback() {
|
|
5
|
-
|
|
4
|
+
async function rollback(context, options) {
|
|
5
|
+
if (options?.connection !== undefined) {
|
|
6
|
+
const db = context.databaseConnections[options.connection];
|
|
7
|
+
if (db === undefined) {
|
|
8
|
+
throw new Error(`ROLLBACK CONNECTION, unknown connection "${options.connection}"`);
|
|
9
|
+
}
|
|
10
|
+
await db.rollback();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// ROLLBACK WORK ends the current LUW, ie. all open database connections are rolled back
|
|
14
|
+
for (const name of Object.keys(context.databaseConnections)) {
|
|
15
|
+
await context.databaseConnections[name].rollback();
|
|
16
|
+
}
|
|
6
17
|
}
|
|
7
18
|
//# sourceMappingURL=rollback.js.map
|
|
@@ -23,7 +23,9 @@ class XString {
|
|
|
23
23
|
}
|
|
24
24
|
set(value) {
|
|
25
25
|
if (typeof value === "string") {
|
|
26
|
-
|
|
26
|
+
// the input is interpreted as hexadecimal digits, the conversion stops at
|
|
27
|
+
// the first character which is not an uppercase hex digit
|
|
28
|
+
this.value = /^[0-9A-F]*/.exec(value)?.[0] || "";
|
|
27
29
|
if (this.value.length % 2 === 1) {
|
|
28
30
|
this.value = this.value + "0";
|
|
29
31
|
}
|