@abaplint/runtime 1.7.16 → 1.7.20

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
@@ -7,13 +7,14 @@ import { concatenate } from "./concatenate";
7
7
  import { condense } from "./condense";
8
8
  import { Console } from "../console";
9
9
  import { convert } from "./convert";
10
+ import { createData } from "./create_data";
10
11
  import { deleteInternal } from "./delete_internal";
11
12
  import { describe } from "./describe";
12
13
  import { find } from "./find";
13
- import { createData } from "./create_data";
14
- import { getRunTime } from "./get_run_time";
15
14
  import { getBit } from "./get_bit";
15
+ import { getRunTime } from "./get_run_time";
16
16
  import { getTime } from "./get_time";
17
+ import { insertDatabase } from "./insert_database";
17
18
  import { insertInternal } from "./insert_internal";
18
19
  import { loop } from "./loop";
19
20
  import { message } from "./message";
@@ -45,6 +46,7 @@ export declare class Statements {
45
46
  getBit: typeof getBit;
46
47
  getRunTime: typeof getRunTime;
47
48
  getTime: typeof getTime;
49
+ insertDatabase: typeof insertDatabase;
48
50
  insertInternal: typeof insertInternal;
49
51
  loop: typeof loop;
50
52
  message: typeof message;
@@ -9,13 +9,14 @@ const commit_1 = require("./commit");
9
9
  const concatenate_1 = require("./concatenate");
10
10
  const condense_1 = require("./condense");
11
11
  const convert_1 = require("./convert");
12
+ const create_data_1 = require("./create_data");
12
13
  const delete_internal_1 = require("./delete_internal");
13
14
  const describe_1 = require("./describe");
14
15
  const find_1 = require("./find");
15
- const create_data_1 = require("./create_data");
16
- const get_run_time_1 = require("./get_run_time");
17
16
  const get_bit_1 = require("./get_bit");
17
+ const get_run_time_1 = require("./get_run_time");
18
18
  const get_time_1 = require("./get_time");
19
+ const insert_database_1 = require("./insert_database");
19
20
  const insert_internal_1 = require("./insert_internal");
20
21
  const loop_1 = require("./loop");
21
22
  const message_1 = require("./message");
@@ -50,6 +51,7 @@ class Statements {
50
51
  this.getBit = get_bit_1.getBit;
51
52
  this.getRunTime = get_run_time_1.getRunTime;
52
53
  this.getTime = get_time_1.getTime;
54
+ this.insertDatabase = insert_database_1.insertDatabase;
53
55
  this.insertInternal = insert_internal_1.insertInternal;
54
56
  this.loop = loop_1.loop;
55
57
  this.message = message_1.message;
@@ -0,0 +1,6 @@
1
+ import { Structure } from "../types";
2
+ import { ICharacter } from "../types/_character";
3
+ export interface IInsertDatabaseOptions {
4
+ values: Structure;
5
+ }
6
+ export declare function insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertDatabase = void 0;
4
+ function insertDatabase(table, options) {
5
+ if (this.db === undefined) {
6
+ throw new Error("Runtime, database not initialized");
7
+ }
8
+ const columns = [];
9
+ const values = [];
10
+ const structure = options.values.get();
11
+ for (const k of Object.keys(structure)) {
12
+ columns.push(k);
13
+ // todo, integers should not be surrounded by '"'?
14
+ values.push('"' + structure[k].get() + '"');
15
+ }
16
+ const sql = `INSERT INTO ${table} (${columns.join(",")}) VALUES (${values.join(",")})`;
17
+ // console.dir(sql);
18
+ try {
19
+ this.db.exec(sql);
20
+ // @ts-ignore
21
+ abap.builtin.sy.get().subrc.set(0);
22
+ }
23
+ catch (error) {
24
+ // eg "UNIQUE constraint failed" errors
25
+ // @ts-ignore
26
+ abap.builtin.sy.get().subrc.set(4);
27
+ }
28
+ }
29
+ exports.insertDatabase = insertDatabase;
30
+ //# sourceMappingURL=insert_database.js.map
@@ -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;
@@ -20,6 +20,10 @@ function select(target, select) {
20
20
  }
21
21
  throw error;
22
22
  }
23
+ if (target instanceof types_1.FieldSymbol) {
24
+ // @ts-ignore
25
+ target = target.getPointer();
26
+ }
23
27
  target.clear();
24
28
  if (target instanceof types_1.Structure) {
25
29
  if (((_a = res[0]) === null || _a === void 0 ? void 0 : _a.values[0]) === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "1.7.16",
3
+ "version": "1.7.20",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",