@abaplint/runtime 1.7.15 → 1.7.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.
@@ -14,4 +14,5 @@ export * from "./lt";
14
14
  export * from "./ne";
15
15
  export * from "./na";
16
16
  export * from "./ns";
17
+ export * from "./np";
17
18
  export { compareIn as in } from "./in";
@@ -27,6 +27,7 @@ __exportStar(require("./lt"), exports);
27
27
  __exportStar(require("./ne"), exports);
28
28
  __exportStar(require("./na"), exports);
29
29
  __exportStar(require("./ns"), exports);
30
+ __exportStar(require("./np"), exports);
30
31
  var in_1 = require("./in");
31
32
  Object.defineProperty(exports, "in", { enumerable: true, get: function () { return in_1.compareIn; } });
32
33
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import { ICharacter } from "../types/_character";
2
+ import { INumeric } from "../types/_numeric";
3
+ export declare function np(left: number | string | ICharacter | INumeric, right: string | ICharacter): boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.np = void 0;
4
+ const cp_1 = require("./cp");
5
+ function np(left, right) {
6
+ return !(0, cp_1.cp)(left, right);
7
+ }
8
+ exports.np = np;
9
+ //# sourceMappingURL=np.js.map
@@ -12,6 +12,7 @@ export declare class ABAP {
12
12
  FunctionModules: {};
13
13
  Classes: {};
14
14
  Interfaces: {};
15
+ DDIC: {};
15
16
  statements: Statements;
16
17
  types: typeof types;
17
18
  builtin: typeof builtin;
@@ -18,6 +18,7 @@ class ABAP {
18
18
  this.FunctionModules = {};
19
19
  this.Classes = {};
20
20
  this.Interfaces = {};
21
+ this.DDIC = {};
21
22
  this.types = types;
22
23
  this.builtin = builtin;
23
24
  this.operators = operators;
@@ -1,2 +1,6 @@
1
1
  import { DataReference } from "../types";
2
- export declare function createData(target: DataReference): void;
2
+ export interface ICreateDataOptions {
3
+ table?: boolean;
4
+ name?: string;
5
+ }
6
+ export declare function createData(target: DataReference, options?: ICreateDataOptions): void;
@@ -2,8 +2,28 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createData = void 0;
4
4
  const clone_1 = require("../clone");
5
- function createData(target) {
6
- target.assign((0, clone_1.clone)(target.getType()));
5
+ function createData(target, options) {
6
+ if ((options === null || options === void 0 ? void 0 : options.name) && (options === null || options === void 0 ? void 0 : options.table)) {
7
+ // @ts-ignore
8
+ if (abap.DDIC[options.name] === undefined) {
9
+ // todo, throw exception
10
+ return;
11
+ }
12
+ // @ts-ignore
13
+ target.assign(new abap.types.Table(abap.DDIC[options.name].type));
14
+ }
15
+ else if (options === null || options === void 0 ? void 0 : options.name) {
16
+ // @ts-ignore
17
+ if (abap.DDIC[options.name] === undefined) {
18
+ // todo, throw exception
19
+ return;
20
+ }
21
+ // @ts-ignore
22
+ target.assign((0, clone_1.clone)(abap.DDIC[options.name].type));
23
+ }
24
+ else {
25
+ target.assign((0, clone_1.clone)(target.getType()));
26
+ }
7
27
  }
8
28
  exports.createData = createData;
9
29
  //# sourceMappingURL=create_data.js.map
@@ -41,6 +41,9 @@ function describe(input) {
41
41
  else if (input.field instanceof types_1.XString) {
42
42
  input.type.set("y");
43
43
  }
44
+ else if (input.field instanceof types_1.DecFloat34) {
45
+ input.type.set("e");
46
+ }
44
47
  else if (input.field instanceof types_1.Structure) {
45
48
  input.type.set("u");
46
49
  }
@@ -1,2 +1,2 @@
1
- import { Structure, Table } from "../types";
2
- export declare function select(target: Structure | Table, select: string): void;
1
+ import { FieldSymbol, Structure, Table } from "../types";
2
+ export declare function select(target: Structure | Table | FieldSymbol, select: string): void;
@@ -4,23 +4,63 @@ exports.select = void 0;
4
4
  const clone_1 = require("../clone");
5
5
  const types_1 = require("../types");
6
6
  function select(target, select) {
7
- var _a;
8
- const res = this.db.exec(select);
9
- target.clear();
10
- if (target instanceof types_1.Structure && ((_a = res[0]) === null || _a === void 0 ? void 0 : _a.values[0])) {
11
- const columns = res[0].columns;
12
- const values = res[0].values[0];
13
- const result = {};
14
- for (const c of columns) {
15
- result[c] = (0, clone_1.clone)(target.get()[c]).set(values.shift());
16
- }
17
- target.set(new types_1.Structure(result));
7
+ var _a, _b, _c;
8
+ if (this.db === undefined) {
9
+ throw new Error("Runtime, database not initialized");
10
+ }
11
+ let res = undefined;
12
+ try {
13
+ res = this.db.exec(select);
14
+ }
15
+ catch (error) {
18
16
  // @ts-ignore
19
- abap.builtin.sy.get().subrc.set(0);
17
+ if (abap.Classes["CX_SY_DYNAMIC_OSQL_SEMANTICS"] !== undefined) {
18
+ // @ts-ignore
19
+ throw new abap.Classes["CX_SY_DYNAMIC_OSQL_SEMANTICS"]();
20
+ }
21
+ throw error;
20
22
  }
21
- else if (target instanceof types_1.Structure) {
23
+ if (target instanceof types_1.FieldSymbol) {
22
24
  // @ts-ignore
23
- abap.builtin.sy.get().subrc.set(4);
25
+ target = target.getPointer();
26
+ }
27
+ target.clear();
28
+ if (target instanceof types_1.Structure) {
29
+ if (((_a = res[0]) === null || _a === void 0 ? void 0 : _a.values[0]) === undefined) {
30
+ // @ts-ignore
31
+ abap.builtin.sy.get().subrc.set(4);
32
+ }
33
+ else {
34
+ const columns = res[0].columns;
35
+ const values = res[0].values[0];
36
+ const result = {};
37
+ for (const c of columns) {
38
+ result[c] = (0, clone_1.clone)(target.get()[c]).set(values.shift());
39
+ }
40
+ target.set(new types_1.Structure(result));
41
+ // @ts-ignore
42
+ abap.builtin.sy.get().subrc.set(0);
43
+ }
44
+ }
45
+ else if (target instanceof types_1.Table) {
46
+ if (((_b = res[0]) === null || _b === void 0 ? void 0 : _b.values[0]) === undefined) {
47
+ // @ts-ignore
48
+ abap.builtin.sy.get().subrc.set(4);
49
+ }
50
+ else {
51
+ for (const selectRow of res[0].values) {
52
+ const targetRow = (0, clone_1.clone)(target.getRowType());
53
+ const values = selectRow;
54
+ for (const c of res[0].columns) {
55
+ // @ts-ignore
56
+ (_c = targetRow.get()[c]) === null || _c === void 0 ? void 0 : _c.set(values.shift());
57
+ }
58
+ // @ts-ignore
59
+ abap.statements.insertInternal({ table: target, data: targetRow });
60
+ }
61
+ // @ts-ignore
62
+ abap.builtin.sy.get().subrc.set(0);
63
+ }
24
64
  }
25
65
  else {
26
66
  throw new Error("Runtime, SELECT todo");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "1.7.15",
3
+ "version": "1.7.19",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "@types/mocha": "^9.0.0",
36
36
  "@types/sql.js": "^1.4.3",
37
37
  "chai": "^4.3.4",
38
- "mocha": "^9.1.3",
38
+ "mocha": "^9.1.4",
39
39
  "source-map-support": "^0.5.21",
40
40
  "typescript": "^4.5.4"
41
41
  }