@abaplint/transpiler 2.1.27 → 2.1.28

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.
@@ -1,8 +1,8 @@
1
1
  export declare type DatabaseSetupResult = {
2
2
  schemas: {
3
- sqlite: string;
4
- pg: string;
5
- hdb: string;
3
+ sqlite: string[];
4
+ pg: string[];
5
+ hdb: string[];
6
6
  };
7
- insert: string;
7
+ insert: string[];
8
8
  };
@@ -12,26 +12,27 @@ class DatabaseSetup {
12
12
  return {
13
13
  schemas: {
14
14
  sqlite: new sqlite_database_schema_1.SQLiteDatabaseSchema(this.reg).run(),
15
- hdb: "todo",
16
- pg: "todo",
15
+ hdb: ["todo"],
16
+ pg: ["todo"],
17
17
  },
18
18
  insert: this.buildInsert(),
19
19
  };
20
20
  }
21
21
  ////////////////////
22
22
  buildInsert() {
23
- let insert = "";
23
+ // note: avoid hitting maximum statement size by splitting into multiple statements
24
+ const insert = [];
24
25
  // INSERT data
25
26
  for (const obj of this.reg.getObjects()) {
26
27
  if (obj instanceof abaplint.Objects.MessageClass) {
27
- insert += this.insertT100(obj);
28
+ insert.push(this.insertT100(obj));
28
29
  }
29
30
  else if (obj instanceof abaplint.Objects.Class
30
31
  || obj instanceof abaplint.Objects.Interface) {
31
- insert += this.insertREPOSRC(obj);
32
+ insert.push(this.insertREPOSRC(obj));
32
33
  }
33
34
  }
34
- insert += this.insertT000();
35
+ insert.push(this.insertT000());
35
36
  return insert;
36
37
  }
37
38
  insertREPOSRC(obj) {
@@ -2,7 +2,7 @@ import * as abaplint from "@abaplint/core";
2
2
  export declare class SQLiteDatabaseSchema {
3
3
  private readonly reg;
4
4
  constructor(reg: abaplint.IRegistry);
5
- run(): string;
5
+ run(): string[];
6
6
  private transparentTable;
7
7
  private toType;
8
8
  }
@@ -7,14 +7,15 @@ class SQLiteDatabaseSchema {
7
7
  this.reg = reg;
8
8
  }
9
9
  run() {
10
- let ret = "";
10
+ const statements = [];
11
11
  // CREATE TABLEs
12
12
  for (const obj of this.reg.getObjects()) {
13
- if (obj instanceof abaplint.Objects.Table && obj.getTableCategory() === abaplint.Objects.TableCategory.Transparent) {
14
- ret += this.transparentTable(obj);
13
+ if (obj instanceof abaplint.Objects.Table
14
+ && obj.getTableCategory() === abaplint.Objects.TableCategory.Transparent) {
15
+ statements.push(this.transparentTable(obj).trim());
15
16
  }
16
17
  }
17
- return ret.trim();
18
+ return statements;
18
19
  }
19
20
  //////////////////
20
21
  transparentTable(tabl) {
@@ -23,7 +23,10 @@ export async function initializeABAP() {\n`;
23
23
  ret += ` const hdb = \`${dbSetup.schemas.hdb}\`;\n`;
24
24
  ret += ` const pg = \`${dbSetup.schemas.pg}\`;\n`;
25
25
  ret += ` const schemas = {sqlite, hdb, pg};\n`;
26
- ret += ` const insert = \`${dbSetup.insert}\`;\n`;
26
+ ret += ` const insert = [];\n`;
27
+ for (const i of dbSetup.insert) {
28
+ ret += `insert.push(\`${i}\`);\n`;
29
+ }
27
30
  if (extraSetup === undefined) {
28
31
  ret += `// no setup logic specified in config\n`;
29
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.1.27",
3
+ "version": "2.1.28",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",