@abaplint/transpiler 2.5.78 → 2.6.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/db/index.js
CHANGED
|
@@ -47,7 +47,7 @@ class DatabaseSetup {
|
|
|
47
47
|
if (raw === undefined) {
|
|
48
48
|
return "";
|
|
49
49
|
}
|
|
50
|
-
return `INSERT INTO reposrc ('PROGNAME', 'DATA') VALUES ('${name}', '${this.escape(raw)}');`;
|
|
50
|
+
return `INSERT INTO reposrc ('PROGNAME', 'DATA') VALUES ('${name.padEnd(40, " ")}', '${this.escape(raw)}');`;
|
|
51
51
|
}
|
|
52
52
|
insertT000() {
|
|
53
53
|
const tabl = this.reg.getObject("TABL", "T000");
|
|
@@ -65,12 +65,13 @@ class DatabaseSetup {
|
|
|
65
65
|
}
|
|
66
66
|
insertT100(msag) {
|
|
67
67
|
// ignore if T100 is unknown
|
|
68
|
-
|
|
68
|
+
const obj = this.reg.getObject("TABL", "T100");
|
|
69
|
+
if (obj === undefined) {
|
|
69
70
|
return "";
|
|
70
71
|
}
|
|
71
72
|
let ret = "";
|
|
72
73
|
for (const m of msag.getMessages()) {
|
|
73
|
-
ret += `INSERT INTO t100 ('SPRSL', 'ARBGB', 'MSGNR', 'TEXT') VALUES ('E', '${msag.getName()}', '${m.getNumber()}', '${this.escape(m.getMessage())}')
|
|
74
|
+
ret += `INSERT INTO t100 ('SPRSL', 'ARBGB', 'MSGNR', 'TEXT') VALUES ('E', '${msag.getName().padEnd(20, " ")}', '${m.getNumber()}', '${this.escape(m.getMessage().padEnd(73, " "))}');\n`;
|
|
74
75
|
}
|
|
75
76
|
return ret;
|
|
76
77
|
}
|
|
@@ -77,7 +77,7 @@ class SQLiteDatabaseSchema {
|
|
|
77
77
|
}
|
|
78
78
|
toType(type, fieldname, errorInfo) {
|
|
79
79
|
if (type instanceof abaplint.BasicTypes.CharacterType) {
|
|
80
|
-
return `NCHAR(${type.getLength()})`;
|
|
80
|
+
return `NCHAR(${type.getLength()}) COLLATE RTRIM`;
|
|
81
81
|
}
|
|
82
82
|
else if (type instanceof abaplint.BasicTypes.TimeType) {
|
|
83
83
|
return `NCHAR(6)`;
|
|
@@ -90,7 +90,7 @@ class SQLiteDatabaseSchema {
|
|
|
90
90
|
return `NCHAR(${type.getLength()})`;
|
|
91
91
|
}
|
|
92
92
|
else if (type instanceof abaplint.BasicTypes.StringType) {
|
|
93
|
-
return `TEXT`;
|
|
93
|
+
return `TEXT COLLATE RTRIM`;
|
|
94
94
|
}
|
|
95
95
|
else if (type instanceof abaplint.BasicTypes.XStringType) {
|
|
96
96
|
// it will be fine, the runtime representation of xstring is also text
|
|
@@ -24,7 +24,7 @@ class ConstantTranspiler {
|
|
|
24
24
|
if (str) {
|
|
25
25
|
let res = str.getFirstToken().getStr();
|
|
26
26
|
if (res.startsWith("'") && this.addGet === false) {
|
|
27
|
-
const code =
|
|
27
|
+
const code = this.character(res);
|
|
28
28
|
return new chunk_1.Chunk().append(code, node, traversal);
|
|
29
29
|
}
|
|
30
30
|
else if (res.startsWith("`") && this.addGet === false) {
|
|
@@ -52,7 +52,7 @@ class ConstantTranspiler {
|
|
|
52
52
|
chunk.appendString(",");
|
|
53
53
|
}
|
|
54
54
|
if (res.startsWith("'") && this.addGet === false) {
|
|
55
|
-
const code =
|
|
55
|
+
const code = this.character(res);
|
|
56
56
|
chunk.append(code, node, traversal);
|
|
57
57
|
}
|
|
58
58
|
else if (res.startsWith("`") && this.addGet === false) {
|
|
@@ -65,6 +65,16 @@ class ConstantTranspiler {
|
|
|
65
65
|
}
|
|
66
66
|
return new chunk_1.Chunk(`todo, Constant`);
|
|
67
67
|
}
|
|
68
|
+
character(res) {
|
|
69
|
+
const foo = res.replace(/''/g, "'");
|
|
70
|
+
let length = foo.length - 2;
|
|
71
|
+
if (length <= 0) {
|
|
72
|
+
// note: Characters cannot have length = zero, 1 is minimum
|
|
73
|
+
length = 1;
|
|
74
|
+
}
|
|
75
|
+
const code = "new abap.types.Character(" + length + ").set(" + this.escape(res) + ")";
|
|
76
|
+
return code;
|
|
77
|
+
}
|
|
68
78
|
escape(str) {
|
|
69
79
|
str = str.replace(/\\/g, "\\\\");
|
|
70
80
|
if (str.startsWith("'")) {
|