@abaplint/transpiler 2.7.17 → 2.7.18

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.
@@ -40,12 +40,15 @@ export * from "./source_field_symbol";
40
40
  export * from "./source_field";
41
41
  export * from "./source";
42
42
  export * from "./sql_cond";
43
+ export * from "./sql_field_and_value";
43
44
  export * from "./sql_field";
45
+ export * from "./sql_field_name";
46
+ export * from "./sql_arithmetic_operator";
44
47
  export * from "./sql_from_source";
45
48
  export * from "./sql_from";
49
+ export * from "./sql_into_structure";
46
50
  export * from "./sql_join";
47
51
  export * from "./sql_source_simple";
48
- export * from "./sql_into_structure";
49
52
  export * from "./sql_source";
50
53
  export * from "./sql_target";
51
54
  export * from "./string_template_source";
@@ -56,12 +56,15 @@ __exportStar(require("./source_field_symbol"), exports);
56
56
  __exportStar(require("./source_field"), exports);
57
57
  __exportStar(require("./source"), exports);
58
58
  __exportStar(require("./sql_cond"), exports);
59
+ __exportStar(require("./sql_field_and_value"), exports);
59
60
  __exportStar(require("./sql_field"), exports);
61
+ __exportStar(require("./sql_field_name"), exports);
62
+ __exportStar(require("./sql_arithmetic_operator"), exports);
60
63
  __exportStar(require("./sql_from_source"), exports);
61
64
  __exportStar(require("./sql_from"), exports);
65
+ __exportStar(require("./sql_into_structure"), exports);
62
66
  __exportStar(require("./sql_join"), exports);
63
67
  __exportStar(require("./sql_source_simple"), exports);
64
- __exportStar(require("./sql_into_structure"), exports);
65
68
  __exportStar(require("./sql_source"), exports);
66
69
  __exportStar(require("./sql_target"), exports);
67
70
  __exportStar(require("./string_template_source"), exports);
@@ -0,0 +1,7 @@
1
+ import { Nodes } from "@abaplint/core";
2
+ import { IExpressionTranspiler } from "./_expression_transpiler";
3
+ import { Traversal } from "../traversal";
4
+ import { Chunk } from "../chunk";
5
+ export declare class SQLArithmeticOperatorTranspiler implements IExpressionTranspiler {
6
+ transpile(node: Nodes.ExpressionNode, _traversal: Traversal): Chunk;
7
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLArithmeticOperatorTranspiler = void 0;
4
+ const chunk_1 = require("../chunk");
5
+ class SQLArithmeticOperatorTranspiler {
6
+ transpile(node, _traversal) {
7
+ const chunk = new chunk_1.Chunk();
8
+ const concat = node.concatTokens();
9
+ chunk.appendString(concat);
10
+ return chunk;
11
+ }
12
+ }
13
+ exports.SQLArithmeticOperatorTranspiler = SQLArithmeticOperatorTranspiler;
14
+ //# sourceMappingURL=sql_arithmetic_operator.js.map
@@ -0,0 +1,7 @@
1
+ import { Nodes } from "@abaplint/core";
2
+ import { IExpressionTranspiler } from "./_expression_transpiler";
3
+ import { Traversal } from "../traversal";
4
+ import { Chunk } from "../chunk";
5
+ export declare class SQLFieldAndValueTranspiler implements IExpressionTranspiler {
6
+ transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk;
7
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SQLFieldAndValueTranspiler = void 0;
4
+ const abaplint = require("@abaplint/core");
5
+ const chunk_1 = require("../chunk");
6
+ class SQLFieldAndValueTranspiler {
7
+ transpile(node, traversal) {
8
+ const chunk = new chunk_1.Chunk();
9
+ chunk.appendString("\"");
10
+ for (const n of node.getChildren()) {
11
+ const concat = n.concatTokens();
12
+ if (concat === "=") {
13
+ chunk.appendString(" = ");
14
+ }
15
+ else if (n.get() instanceof abaplint.Expressions.SQLSource) {
16
+ const source = traversal.traverse(n);
17
+ // todo: value conversion? abap vs db, traversal.isSQLConversion
18
+ // todo: integers?
19
+ chunk.appendString("'\" + " + source.getCode() + ".get() + \"'");
20
+ }
21
+ else {
22
+ chunk.appendString(traversal.traverse(n).getCode() + " ");
23
+ }
24
+ }
25
+ chunk.appendString("\"");
26
+ return chunk;
27
+ }
28
+ }
29
+ exports.SQLFieldAndValueTranspiler = SQLFieldAndValueTranspiler;
30
+ //# sourceMappingURL=sql_field_and_value.js.map
@@ -6,7 +6,6 @@ const chunk_1 = require("../chunk");
6
6
  const expressions_1 = require("../expressions");
7
7
  class UpdateDatabaseTranspiler {
8
8
  transpile(node, traversal) {
9
- var _a;
10
9
  const dbtab = node.findFirstExpression(abaplint.Expressions.DatabaseTable);
11
10
  if (dbtab === undefined) {
12
11
  throw new Error("internal error, UpdateDatabaseTranspiler");
@@ -22,9 +21,7 @@ class UpdateDatabaseTranspiler {
22
21
  if (sets.length > 0) {
23
22
  const s = [];
24
23
  for (const set of sets) {
25
- const name = (_a = set.findDirectExpression(abaplint.Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens();
26
- const source = traversal.traverse(set.findDirectExpression(abaplint.Expressions.SQLSource));
27
- s.push("\"\\\"" + name + "\\\" = '\" + " + source.getCode() + ".get() + \"'\"");
24
+ s.push(new expressions_1.SQLFieldAndValueTranspiler().transpile(set, traversal).getCode());
28
25
  }
29
26
  options.push(`"set": [${s.join(",")}]`);
30
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.7.17",
3
+ "version": "2.7.18",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",