@abaplint/runtime 2.3.37 → 2.3.38
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.
|
@@ -80,7 +80,7 @@ export declare class Statements {
|
|
|
80
80
|
private readonly context;
|
|
81
81
|
constructor(context: Context);
|
|
82
82
|
deleteDatabase(table: string | ICharacter, options: IDeleteDatabaseOptions): Promise<void>;
|
|
83
|
-
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number>;
|
|
83
|
+
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number | undefined>;
|
|
84
84
|
message(options: IMessageOptions): Promise<void>;
|
|
85
85
|
modifyDatabase(table: string | ICharacter, options: IModifyDatabaseOptions): Promise<void>;
|
|
86
86
|
select(target: Structure | Table | FieldSymbol, select: SelectDatabaseOptions, runtimeOptions?: SelectRuntimeOptions): Promise<void>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Context } from "../context";
|
|
2
|
-
import { Structure } from "../types";
|
|
2
|
+
import { Structure, Table } from "../types";
|
|
3
3
|
import { ICharacter } from "../types/_character";
|
|
4
4
|
export interface IInsertDatabaseOptions {
|
|
5
|
-
values
|
|
5
|
+
values?: Structure;
|
|
6
|
+
table?: Table;
|
|
6
7
|
}
|
|
7
8
|
export declare class InsertDatabase {
|
|
8
9
|
private readonly context;
|
|
9
10
|
constructor(context: Context);
|
|
10
|
-
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number>;
|
|
11
|
+
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number | undefined>;
|
|
11
12
|
}
|
|
@@ -8,6 +8,17 @@ class InsertDatabase {
|
|
|
8
8
|
async insertDatabase(table, options) {
|
|
9
9
|
const columns = [];
|
|
10
10
|
const values = [];
|
|
11
|
+
if (options.values === undefined && options.table === undefined) {
|
|
12
|
+
throw "insertDatabase, wrong input";
|
|
13
|
+
}
|
|
14
|
+
if (options.table !== undefined) {
|
|
15
|
+
for (const row of options.table.array()) {
|
|
16
|
+
await this.insertDatabase(table, { values: row });
|
|
17
|
+
}
|
|
18
|
+
// todo, set sy-subrc
|
|
19
|
+
// todo, set sy-dbcnt
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
11
22
|
const structure = options.values.get();
|
|
12
23
|
for (const k of Object.keys(structure)) {
|
|
13
24
|
columns.push(k);
|