@abaplint/runtime 2.5.40 → 2.5.42
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.
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.lines = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
function lines(input) {
|
|
6
|
+
if (input.val instanceof types_1.FieldSymbol
|
|
7
|
+
&& input.val.getPointer() === undefined) {
|
|
8
|
+
throw new Error("GETWA_NOT_ASSIGNED");
|
|
9
|
+
}
|
|
6
10
|
return new types_1.Integer().set(input.val.array().length);
|
|
7
11
|
}
|
|
8
12
|
exports.lines = lines;
|
|
@@ -85,6 +85,9 @@ export declare class Statements {
|
|
|
85
85
|
translate: typeof translate;
|
|
86
86
|
private readonly context;
|
|
87
87
|
constructor(context: Context);
|
|
88
|
+
private _trace;
|
|
89
|
+
private _traceAsync;
|
|
90
|
+
_setTrace(): void;
|
|
88
91
|
deleteDatabase(table: string | ICharacter, options: IDeleteDatabaseOptions): Promise<void>;
|
|
89
92
|
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number | undefined>;
|
|
90
93
|
message(options: IMessageOptions): Promise<void>;
|
|
@@ -45,6 +45,7 @@ const translate_1 = require("./translate");
|
|
|
45
45
|
const update_database_1 = require("./update_database");
|
|
46
46
|
const write_1 = require("./write");
|
|
47
47
|
const call_function_1 = require("./call_function");
|
|
48
|
+
const types_1 = require("util/types");
|
|
48
49
|
// this is a class, as statements like SELECT needs access to the database object instance
|
|
49
50
|
// and WRITE will access the Console
|
|
50
51
|
class Statements {
|
|
@@ -87,6 +88,41 @@ class Statements {
|
|
|
87
88
|
this.translate = translate_1.translate;
|
|
88
89
|
this.context = context;
|
|
89
90
|
}
|
|
91
|
+
_trace(func, name) {
|
|
92
|
+
const exec = (...options) => {
|
|
93
|
+
const start = Date.now();
|
|
94
|
+
const result = func.bind(this)(...options);
|
|
95
|
+
const end = Date.now();
|
|
96
|
+
console.log(`STATEMENT: ${name}, ${end - start} ms`);
|
|
97
|
+
return result;
|
|
98
|
+
};
|
|
99
|
+
return exec;
|
|
100
|
+
}
|
|
101
|
+
_traceAsync(func, name) {
|
|
102
|
+
const exec = async (...options) => {
|
|
103
|
+
const start = Date.now();
|
|
104
|
+
const result = await func.bind(this)(...options);
|
|
105
|
+
const end = Date.now();
|
|
106
|
+
console.log(`STATEMENT: ${name}, ${end - start} ms`);
|
|
107
|
+
return result;
|
|
108
|
+
};
|
|
109
|
+
return exec;
|
|
110
|
+
}
|
|
111
|
+
_setTrace() {
|
|
112
|
+
const candidates = [...Object.keys(this), ...Object.getOwnPropertyNames(Statements.prototype)];
|
|
113
|
+
for (const c of candidates) {
|
|
114
|
+
if (c === "context" || c === "constructor" || c.startsWith("_") || c === "loop") {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const func = this[c];
|
|
118
|
+
if ((0, types_1.isAsyncFunction)(func)) {
|
|
119
|
+
this[c] = this._traceAsync(func, c);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this[c] = this._trace(func, c);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
90
126
|
async deleteDatabase(table, options) {
|
|
91
127
|
return new delete_database_1.DeleteDatabase(this.context).deleteDatabase(table, options);
|
|
92
128
|
}
|