@abaplint/runtime 2.5.18 → 2.5.19
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Context } from "../context";
|
|
2
2
|
import { Structure, Table } from "../types";
|
|
3
3
|
import { ICharacter } from "../types/_character";
|
|
4
|
+
export declare function toValue(value: any): any;
|
|
4
5
|
export interface IInsertDatabaseOptions {
|
|
5
6
|
values?: Structure;
|
|
6
7
|
table?: Table;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InsertDatabase = void 0;
|
|
3
|
+
exports.InsertDatabase = exports.toValue = void 0;
|
|
4
|
+
function toValue(value) {
|
|
5
|
+
if (typeof value === "string") {
|
|
6
|
+
return '"' + value.replace(/"/g, "\"\"") + '"';
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.toValue = toValue;
|
|
4
13
|
class InsertDatabase {
|
|
5
14
|
constructor(context) {
|
|
6
15
|
this.context = context;
|
|
@@ -31,12 +40,7 @@ class InsertDatabase {
|
|
|
31
40
|
for (const k of Object.keys(structure)) {
|
|
32
41
|
columns.push(k);
|
|
33
42
|
const value = structure[k].get();
|
|
34
|
-
|
|
35
|
-
values.push('"' + value.replace(/"/g, "\"\"") + '"');
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
values.push(value);
|
|
39
|
-
}
|
|
43
|
+
values.push(toValue(value));
|
|
40
44
|
}
|
|
41
45
|
if (typeof table !== "string") {
|
|
42
46
|
table = table.get();
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateDatabase = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
+
const insert_database_1 = require("./insert_database");
|
|
5
6
|
class UpdateDatabase {
|
|
6
7
|
constructor(context) {
|
|
7
8
|
this.context = context;
|
|
@@ -23,8 +24,7 @@ class UpdateDatabase {
|
|
|
23
24
|
if (options.from) {
|
|
24
25
|
const structure = options.from.get();
|
|
25
26
|
for (const k of Object.keys(structure)) {
|
|
26
|
-
|
|
27
|
-
const str = k + ' = "' + structure[k].get() + '"';
|
|
27
|
+
const str = k + " = " + (0, insert_database_1.toValue)(structure[k].get());
|
|
28
28
|
if (keys.includes(k.toUpperCase())) {
|
|
29
29
|
where.push(str);
|
|
30
30
|
}
|