@abaplint/runtime 2.7.5 → 2.7.6
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/expand_in.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expandIN = void 0;
|
|
4
4
|
// note: must always return an expression, never return empty string
|
|
5
|
+
// https://www.sqlite.org/lang_select.html
|
|
5
6
|
function expandIN(fieldName, table) {
|
|
6
7
|
var _a, _b, _c;
|
|
7
8
|
let ret = "";
|
|
8
9
|
if (table.array().length === 0) {
|
|
9
|
-
|
|
10
|
+
// " NOT IN ()" does not work on postgres
|
|
11
|
+
ret = fieldName + " LIKE '%'";
|
|
10
12
|
}
|
|
11
13
|
else {
|
|
12
14
|
ret = fieldName + " IN (";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteDatabase = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
+
const insert_database_1 = require("./insert_database");
|
|
5
6
|
class DeleteDatabase {
|
|
6
7
|
constructor(context) {
|
|
7
8
|
this.context = context;
|
|
@@ -25,8 +26,7 @@ class DeleteDatabase {
|
|
|
25
26
|
let where = [];
|
|
26
27
|
const structure = options.from.get();
|
|
27
28
|
for (const k of Object.keys(structure)) {
|
|
28
|
-
|
|
29
|
-
const str = k + ' = "' + structure[k].get() + '"';
|
|
29
|
+
const str = k + " = " + (0, insert_database_1.toValue)(structure[k].get());
|
|
30
30
|
where.push(str);
|
|
31
31
|
}
|
|
32
32
|
where = where.join(" AND ");
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InsertDatabase = exports.toValue = void 0;
|
|
4
4
|
function toValue(value) {
|
|
5
5
|
if (typeof value === "string") {
|
|
6
|
-
|
|
6
|
+
// postgres requires ' for values
|
|
7
|
+
return "'" + value.replace(/'/g, "''") + "'";
|
|
8
|
+
// return '"' + value.replace(/"/g, "\"\"") + '"';
|
|
7
9
|
}
|
|
8
10
|
else {
|
|
9
11
|
return value;
|
|
@@ -43,7 +45,7 @@ class InsertDatabase {
|
|
|
43
45
|
values.push(toValue(value));
|
|
44
46
|
}
|
|
45
47
|
if (typeof table !== "string") {
|
|
46
|
-
table = table.get().trimEnd();
|
|
48
|
+
table = table.get().trimEnd().toLowerCase();
|
|
47
49
|
}
|
|
48
50
|
const { subrc, dbcnt } = await this.context.defaultDB().insert({ table, columns, values });
|
|
49
51
|
// @ts-ignore
|
|
@@ -34,7 +34,7 @@ class Structure {
|
|
|
34
34
|
this.set(input.getPointer());
|
|
35
35
|
}
|
|
36
36
|
else if (input instanceof table_1.Table) {
|
|
37
|
-
throw "Structure, input is a table";
|
|
37
|
+
throw new Error("Structure, input is a table");
|
|
38
38
|
}
|
|
39
39
|
else if (input instanceof Structure) {
|
|
40
40
|
const obj = input.get();
|