@abaplint/runtime 2.0.7 → 2.0.10

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.
@@ -13,7 +13,10 @@ export interface InsertDatabaseOptions {
13
13
  values: string[];
14
14
  }
15
15
  export interface SelectDatabaseOptions {
16
+ /** select statement, in ABAP SQL syntax */
16
17
  select: string;
18
+ /** list of primary key fields, in lower case, if known */
19
+ primaryKey?: string[];
17
20
  }
18
21
  export declare type DatabaseValue = number | string | Uint8Array | null;
19
22
  export declare type DatabaseRow = {
@@ -36,6 +36,7 @@ import { ICharacter } from "../types/_character";
36
36
  import { FieldSymbol, Structure, Table } from "../types";
37
37
  import { INumeric } from "../types/_numeric";
38
38
  import { ICallFunctionOptions } from "./call_function";
39
+ import { SelectDatabaseOptions } from "../db/db";
39
40
  export declare class Statements {
40
41
  append: typeof append;
41
42
  assert: typeof assert;
@@ -70,7 +71,7 @@ export declare class Statements {
70
71
  insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number>;
71
72
  message(options: IMessageOptions): Promise<void>;
72
73
  modifyDatabase(table: string | ICharacter, options: IModifyDatabaseOptions): Promise<void>;
73
- select(target: Structure | Table | FieldSymbol, select: string): Promise<void>;
74
+ select(target: Structure | Table | FieldSymbol, select: SelectDatabaseOptions): Promise<void>;
74
75
  updateDatabase(table: string | ICharacter, options: IUpdateDatabaseOptions): Promise<number>;
75
76
  callFunction(options: ICallFunctionOptions): Promise<void>;
76
77
  write(source: INumeric | ICharacter | FieldSymbol | string | number, options?: IWriteOptions): void;
@@ -1,7 +1,8 @@
1
1
  import { Context } from "../context";
2
+ import { SelectDatabaseOptions } from "../db/db";
2
3
  import { FieldSymbol, Structure, Table } from "../types";
3
4
  export declare class SelectDatabase {
4
5
  private readonly context;
5
6
  constructor(context: Context);
6
- select(target: Structure | Table | FieldSymbol, select: string): Promise<void>;
7
+ select(target: Structure | Table | FieldSymbol, input: SelectDatabaseOptions): Promise<void>;
7
8
  }
@@ -7,9 +7,9 @@ class SelectDatabase {
7
7
  constructor(context) {
8
8
  this.context = context;
9
9
  }
10
- async select(target, select) {
10
+ async select(target, input) {
11
11
  var _a;
12
- const { rows: rows } = await this.context.defaultDB().select({ select });
12
+ const { rows: rows } = await this.context.defaultDB().select(input);
13
13
  if (target instanceof types_1.FieldSymbol) {
14
14
  if (target.isAssigned() === false) {
15
15
  throw "select, fs not assigned";
@@ -33,7 +33,8 @@ class SelectDatabase {
33
33
  else if (target instanceof types_1.Table) {
34
34
  for (const row of rows) {
35
35
  const targetRow = (0, clone_1.clone)(target.getRowType());
36
- for (const columnName in row) {
36
+ for (let columnName in row) {
37
+ columnName = columnName.toLowerCase();
37
38
  // todo, non structured table = table with simple rows
38
39
  // @ts-ignore
39
40
  (_a = targetRow.get()[columnName]) === null || _a === void 0 ? void 0 : _a.set(row[columnName]);
@@ -41,6 +42,8 @@ class SelectDatabase {
41
42
  // @ts-ignore
42
43
  abap.statements.insertInternal({ table: target, data: targetRow });
43
44
  }
45
+ // @ts-ignore
46
+ abap.builtin.sy.get().dbcnt.set(rows.length);
44
47
  }
45
48
  else {
46
49
  throw new Error("Runtime, SELECT todo");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.7",
3
+ "version": "2.0.10",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
- "@types/chai": "^4.3.0",
31
+ "@types/chai": "^4.3.1",
32
32
  "@types/mocha": "^9.1.0",
33
33
  "@types/sql.js": "^1.4.3",
34
34
  "chai": "^4.3.6",