@abaplint/runtime 1.8.40 → 2.0.2
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.
- package/README.md +2 -2
- package/build/src/builtin/index.d.ts +1 -0
- package/build/src/builtin/index.js +1 -0
- package/build/src/builtin/insert.d.ts +9 -0
- package/build/src/builtin/insert.js +15 -0
- package/build/src/builtin/sy.js +2 -0
- package/build/src/context.d.ts +13 -0
- package/build/src/context.js +18 -0
- package/build/src/db/db.d.ts +49 -0
- package/build/src/db/db.js +3 -0
- package/build/src/index.d.ts +11 -13
- package/build/src/index.js +17 -21
- package/build/src/offset_length.js +1 -1
- package/build/src/statements/call_function.d.ts +6 -1
- package/build/src/statements/call_function.js +19 -15
- package/build/src/statements/delete_database.d.ts +7 -2
- package/build/src/statements/delete_database.js +34 -33
- package/build/src/statements/get_time.d.ts +2 -0
- package/build/src/statements/get_time.js +11 -8
- package/build/src/statements/index.d.ts +21 -21
- package/build/src/statements/index.js +26 -13
- package/build/src/statements/insert_database.d.ts +6 -1
- package/build/src/statements/insert_database.js +23 -28
- package/build/src/statements/message.d.ts +6 -1
- package/build/src/statements/message.js +34 -33
- package/build/src/statements/modify_database.d.ts +7 -2
- package/build/src/statements/modify_database.js +27 -23
- package/build/src/statements/select.d.ts +6 -1
- package/build/src/statements/select.js +29 -46
- package/build/src/statements/update_database.d.ts +7 -2
- package/build/src/statements/update_database.js +39 -42
- package/build/src/statements/write.d.ts +7 -3
- package/build/src/statements/write.js +29 -24
- package/build/src/template_formatting.d.ts +1 -0
- package/build/src/template_formatting.js +6 -1
- package/package.json +39 -41
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# @abaplint/runtime
|
|
2
|
-
|
|
1
|
+
# @abaplint/runtime
|
|
2
|
+
|
|
3
3
|
Runtime
|
|
@@ -27,6 +27,7 @@ __exportStar(require("./escape"), exports);
|
|
|
27
27
|
__exportStar(require("./find"), exports);
|
|
28
28
|
__exportStar(require("./floor"), exports);
|
|
29
29
|
__exportStar(require("./frac"), exports);
|
|
30
|
+
__exportStar(require("./insert"), exports);
|
|
30
31
|
__exportStar(require("./lines"), exports);
|
|
31
32
|
__exportStar(require("./nmax"), exports);
|
|
32
33
|
__exportStar(require("./nmin"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { String } from "../types";
|
|
2
|
+
import { ICharacter } from "../types/_character";
|
|
3
|
+
import { INumeric } from "../types/_numeric";
|
|
4
|
+
export interface IInsertInput {
|
|
5
|
+
val: ICharacter;
|
|
6
|
+
sub: ICharacter;
|
|
7
|
+
off?: INumeric;
|
|
8
|
+
}
|
|
9
|
+
export declare function insert(input: IInsertInput): String;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.insert = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
function insert(input) {
|
|
6
|
+
let value = input.val.get();
|
|
7
|
+
let offset = 0;
|
|
8
|
+
if (input.off) {
|
|
9
|
+
offset = input.off.get();
|
|
10
|
+
}
|
|
11
|
+
value = value.substring(0, offset) + input.sub.get() + value.substring(offset);
|
|
12
|
+
return new types_1.String().set(value);
|
|
13
|
+
}
|
|
14
|
+
exports.insert = insert;
|
|
15
|
+
//# sourceMappingURL=insert.js.map
|
package/build/src/builtin/sy.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.sy = new types_1.Structure({
|
|
|
6
6
|
abcde: new types_1.Character({ length: 26 }).set("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
|
|
7
7
|
datlo: new types_1.Date(),
|
|
8
8
|
datum: new types_1.Date(),
|
|
9
|
+
dbcnt: new types_1.Integer(),
|
|
9
10
|
fdpos: new types_1.Integer(),
|
|
10
11
|
index: new types_1.Integer(),
|
|
11
12
|
langu: new types_1.Character({ length: 1 }).set("E"),
|
|
@@ -19,6 +20,7 @@ exports.sy = new types_1.Structure({
|
|
|
19
20
|
subrc: new types_1.Integer(),
|
|
20
21
|
sysid: new types_1.Character({ length: 3 }).set("ABC"),
|
|
21
22
|
tabix: new types_1.Integer(),
|
|
23
|
+
tzone: new types_1.Integer(),
|
|
22
24
|
timlo: new types_1.Time(),
|
|
23
25
|
uname: new types_1.Character({ length: 12 }).set("USERNAME"),
|
|
24
26
|
uzeit: new types_1.Time(),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Console } from "./console";
|
|
2
|
+
import { DatabaseClient } from "./db/db";
|
|
3
|
+
import * as RFC from "./rfc";
|
|
4
|
+
export declare class Context {
|
|
5
|
+
console: Console;
|
|
6
|
+
databaseConnections: {
|
|
7
|
+
[name: string]: DatabaseClient;
|
|
8
|
+
};
|
|
9
|
+
RFCDestinations: {
|
|
10
|
+
[name: string]: RFC.RFCClient;
|
|
11
|
+
};
|
|
12
|
+
defaultDB(): DatabaseClient;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Context = void 0;
|
|
4
|
+
class Context {
|
|
5
|
+
constructor() {
|
|
6
|
+
// DEFAULT and secondary database connections
|
|
7
|
+
this.databaseConnections = {};
|
|
8
|
+
this.RFCDestinations = {};
|
|
9
|
+
}
|
|
10
|
+
defaultDB() {
|
|
11
|
+
if (this.databaseConnections["DEFAULT"] === undefined) {
|
|
12
|
+
throw new Error("Runtime, database not initialized");
|
|
13
|
+
}
|
|
14
|
+
return this.databaseConnections["DEFAULT"];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Context = Context;
|
|
18
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface DeleteDatabaseOptions {
|
|
2
|
+
table: string;
|
|
3
|
+
where: string;
|
|
4
|
+
}
|
|
5
|
+
export interface UpdateDatabaseOptions {
|
|
6
|
+
table: string;
|
|
7
|
+
where: string;
|
|
8
|
+
set: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface InsertDatabaseOptions {
|
|
11
|
+
table: string;
|
|
12
|
+
columns: string[];
|
|
13
|
+
values: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface SelectDatabaseOptions {
|
|
16
|
+
select: string;
|
|
17
|
+
}
|
|
18
|
+
export declare type DatabaseValue = number | string | Uint8Array | null;
|
|
19
|
+
export declare type DatabaseRow = {
|
|
20
|
+
[name: string]: DatabaseValue;
|
|
21
|
+
};
|
|
22
|
+
export declare type DatabaseRows = DatabaseRow[];
|
|
23
|
+
export interface SelectDatabaseResult {
|
|
24
|
+
rows: DatabaseRows;
|
|
25
|
+
}
|
|
26
|
+
export interface DatabaseClient {
|
|
27
|
+
/*** the type/name/identifier of the database */
|
|
28
|
+
name: string;
|
|
29
|
+
connect(): Promise<void>;
|
|
30
|
+
disconnect(): Promise<void>;
|
|
31
|
+
/*** execute any native SQL command */
|
|
32
|
+
execute(sql: string): Promise<void>;
|
|
33
|
+
beginTransaction(): Promise<void>;
|
|
34
|
+
commit(): Promise<void>;
|
|
35
|
+
rollback(): Promise<void>;
|
|
36
|
+
delete(options: DeleteDatabaseOptions): Promise<{
|
|
37
|
+
subrc: number;
|
|
38
|
+
dbcnt: number;
|
|
39
|
+
}>;
|
|
40
|
+
update(options: UpdateDatabaseOptions): Promise<{
|
|
41
|
+
subrc: number;
|
|
42
|
+
dbcnt: number;
|
|
43
|
+
}>;
|
|
44
|
+
insert(options: InsertDatabaseOptions): Promise<{
|
|
45
|
+
subrc: number;
|
|
46
|
+
dbcnt: number;
|
|
47
|
+
}>;
|
|
48
|
+
select(options: SelectDatabaseOptions): Promise<SelectDatabaseResult>;
|
|
49
|
+
}
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Console } from "./console";
|
|
2
|
+
import { Context } from "./context";
|
|
3
|
+
import { OffsetLength } from "./offset_length";
|
|
4
|
+
import { Statements } from "./statements";
|
|
5
|
+
import { templateFormatting } from "./template_formatting";
|
|
6
|
+
import { UnitTestResult } from "./unit_test";
|
|
2
7
|
import * as builtin from "./builtin";
|
|
3
8
|
import * as compare from "./compare";
|
|
9
|
+
import * as DB from "./db/db";
|
|
4
10
|
import * as operators from "./operators";
|
|
5
|
-
import { Statements } from "./statements";
|
|
6
11
|
import * as RFC from "./rfc";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { OffsetLength } from "./offset_length";
|
|
10
|
-
import { templateFormatting } from "./template_formatting";
|
|
11
|
-
export { UnitTestResult, RFC, types };
|
|
12
|
+
import * as types from "./types";
|
|
13
|
+
export { UnitTestResult, RFC, types, DB };
|
|
12
14
|
export declare class ABAP {
|
|
13
15
|
FunctionModules: {
|
|
14
16
|
[name: string]: any;
|
|
@@ -22,18 +24,14 @@ export declare class ABAP {
|
|
|
22
24
|
DDIC: {
|
|
23
25
|
[name: string]: any;
|
|
24
26
|
};
|
|
25
|
-
RFCDestinations: {
|
|
26
|
-
[name: string]: RFC.RFCClient;
|
|
27
|
-
};
|
|
28
27
|
statements: Statements;
|
|
29
28
|
types: typeof types;
|
|
30
29
|
builtin: typeof builtin;
|
|
31
30
|
operators: typeof operators;
|
|
32
31
|
compare: typeof compare;
|
|
33
|
-
console: Console;
|
|
34
|
-
db: undefined | any;
|
|
32
|
+
readonly console: Console;
|
|
35
33
|
OffsetLength: typeof OffsetLength;
|
|
36
34
|
templateFormatting: typeof templateFormatting;
|
|
35
|
+
readonly context: Context;
|
|
37
36
|
constructor();
|
|
38
|
-
initDB(sql?: string): Promise<void>;
|
|
39
37
|
}
|
package/build/src/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ABAP = exports.types = exports.RFC = exports.UnitTestResult = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
exports.ABAP = exports.DB = exports.types = exports.RFC = exports.UnitTestResult = void 0;
|
|
4
|
+
const console_1 = require("./console");
|
|
5
|
+
const context_1 = require("./context");
|
|
6
|
+
const offset_length_1 = require("./offset_length");
|
|
7
|
+
const statements_1 = require("./statements");
|
|
8
|
+
const template_formatting_1 = require("./template_formatting");
|
|
9
|
+
const unit_test_1 = require("./unit_test");
|
|
10
|
+
Object.defineProperty(exports, "UnitTestResult", { enumerable: true, get: function () { return unit_test_1.UnitTestResult; } });
|
|
6
11
|
const builtin = require("./builtin");
|
|
7
12
|
const compare = require("./compare");
|
|
13
|
+
const DB = require("./db/db");
|
|
14
|
+
exports.DB = DB;
|
|
8
15
|
const operators = require("./operators");
|
|
9
|
-
const statements_1 = require("./statements");
|
|
10
16
|
const RFC = require("./rfc");
|
|
11
17
|
exports.RFC = RFC;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const unit_test_1 = require("./unit_test");
|
|
15
|
-
Object.defineProperty(exports, "UnitTestResult", { enumerable: true, get: function () { return unit_test_1.UnitTestResult; } });
|
|
16
|
-
const offset_length_1 = require("./offset_length");
|
|
17
|
-
const template_formatting_1 = require("./template_formatting");
|
|
18
|
+
const types = require("./types");
|
|
19
|
+
exports.types = types;
|
|
18
20
|
class ABAP {
|
|
19
21
|
constructor() {
|
|
20
22
|
// global objects
|
|
@@ -22,28 +24,22 @@ class ABAP {
|
|
|
22
24
|
this.Classes = {};
|
|
23
25
|
this.Interfaces = {};
|
|
24
26
|
this.DDIC = {};
|
|
25
|
-
// RFC Destinations
|
|
26
|
-
this.RFCDestinations = {};
|
|
27
27
|
this.types = types;
|
|
28
28
|
this.builtin = builtin;
|
|
29
29
|
this.operators = operators;
|
|
30
30
|
this.compare = compare;
|
|
31
31
|
this.OffsetLength = offset_length_1.OffsetLength;
|
|
32
32
|
this.templateFormatting = template_formatting_1.templateFormatting;
|
|
33
|
+
this.context = new context_1.Context();
|
|
33
34
|
this.console = new console_1.Console();
|
|
34
|
-
this.
|
|
35
|
+
this.context.console = this.console;
|
|
36
|
+
this.statements = new statements_1.Statements(this.context);
|
|
35
37
|
// todo, this should not be a singleton, it should be part of this instance
|
|
38
|
+
// todo, move to context
|
|
36
39
|
builtin.sy.get().subrc.set(0);
|
|
37
40
|
builtin.sy.get().tabix.set(0);
|
|
38
41
|
builtin.sy.get().index.set(0);
|
|
39
|
-
|
|
40
|
-
async initDB(sql) {
|
|
41
|
-
const SQL = await (0, sql_js_1.default)();
|
|
42
|
-
this.db = new SQL.Database();
|
|
43
|
-
if (sql && sql !== "") {
|
|
44
|
-
this.db.run(sql);
|
|
45
|
-
}
|
|
46
|
-
this.statements.setDb(this.db);
|
|
42
|
+
this.statements.getTime({ sy: builtin.sy });
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
exports.ABAP = ABAP;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
1
2
|
export interface ICallFunctionOptions {
|
|
2
3
|
name: string;
|
|
3
4
|
destination: string;
|
|
@@ -7,4 +8,8 @@ export interface ICallFunctionOptions {
|
|
|
7
8
|
changing?: any;
|
|
8
9
|
exceptions?: any;
|
|
9
10
|
}
|
|
10
|
-
export declare
|
|
11
|
+
export declare class CallFunction {
|
|
12
|
+
private readonly context;
|
|
13
|
+
constructor(context: Context);
|
|
14
|
+
callFunction(options: ICallFunctionOptions): Promise<void>;
|
|
15
|
+
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if
|
|
9
|
-
|
|
3
|
+
exports.CallFunction = void 0;
|
|
4
|
+
class CallFunction {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
this.context = context;
|
|
7
|
+
}
|
|
8
|
+
// note: this is only called if DESTINIATION is supplied
|
|
9
|
+
async callFunction(options) {
|
|
10
|
+
const dest = this.context.RFCDestinations[options.destination];
|
|
11
|
+
if (dest === undefined) {
|
|
12
|
+
throw new Error(`RFC destination ${options.destination} does not exist`);
|
|
13
|
+
}
|
|
14
|
+
await dest.call(options.name, {
|
|
15
|
+
exporting: options.exporting,
|
|
16
|
+
importing: options.importing,
|
|
17
|
+
tables: options.tables,
|
|
18
|
+
changing: options.changing,
|
|
19
|
+
exceptions: options.exceptions,
|
|
20
|
+
});
|
|
10
21
|
}
|
|
11
|
-
await dest.call(options.name, {
|
|
12
|
-
exporting: options.exporting,
|
|
13
|
-
importing: options.importing,
|
|
14
|
-
tables: options.tables,
|
|
15
|
-
changing: options.changing,
|
|
16
|
-
exceptions: options.exceptions,
|
|
17
|
-
});
|
|
18
22
|
}
|
|
19
|
-
exports.
|
|
23
|
+
exports.CallFunction = CallFunction;
|
|
20
24
|
//# sourceMappingURL=call_function.js.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
1
2
|
import { FieldSymbol, Structure, Table } from "../types";
|
|
2
3
|
import { ICharacter } from "../types/_character";
|
|
3
|
-
export interface
|
|
4
|
+
export interface IDeleteDatabaseOptions {
|
|
4
5
|
from?: Structure | FieldSymbol;
|
|
5
6
|
table?: Table | FieldSymbol;
|
|
6
7
|
}
|
|
7
|
-
export declare
|
|
8
|
+
export declare class DeleteDatabase {
|
|
9
|
+
private readonly context;
|
|
10
|
+
constructor(context: Context);
|
|
11
|
+
deleteDatabase(table: string | ICharacter, options: IDeleteDatabaseOptions): Promise<void>;
|
|
12
|
+
}
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DeleteDatabase = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
class DeleteDatabase {
|
|
6
|
+
constructor(context) {
|
|
7
|
+
this.context = context;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
options.table
|
|
11
|
-
|
|
12
|
-
if (options.from instanceof types_1.FieldSymbol) {
|
|
13
|
-
options.from = options.from.getPointer();
|
|
14
|
-
}
|
|
15
|
-
if (options.table) {
|
|
16
|
-
for (const row of options.table.array()) {
|
|
17
|
-
deleteDatabase.bind(this)(table, { from: row });
|
|
9
|
+
async deleteDatabase(table, options) {
|
|
10
|
+
if (options.table instanceof types_1.FieldSymbol) {
|
|
11
|
+
options.table = options.table.getPointer();
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const where = [];
|
|
22
|
-
const structure = options.from.get();
|
|
23
|
-
for (const k of Object.keys(structure)) {
|
|
24
|
-
// todo, integers should not be surrounded by '"'?
|
|
25
|
-
const str = k + ' = "' + structure[k].get() + '"';
|
|
26
|
-
where.push(str);
|
|
13
|
+
if (options.from instanceof types_1.FieldSymbol) {
|
|
14
|
+
options.from = options.from.getPointer();
|
|
27
15
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
this.db.exec(sql);
|
|
16
|
+
if (typeof table !== "string") {
|
|
17
|
+
table = table.get();
|
|
32
18
|
}
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
if (options.table) {
|
|
20
|
+
for (const row of options.table.array()) {
|
|
21
|
+
this.deleteDatabase(table, { from: row });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (options.from) {
|
|
25
|
+
let where = [];
|
|
26
|
+
const structure = options.from.get();
|
|
27
|
+
for (const k of Object.keys(structure)) {
|
|
28
|
+
// todo, integers should not be surrounded by '"'?
|
|
29
|
+
const str = k + ' = "' + structure[k].get() + '"';
|
|
30
|
+
where.push(str);
|
|
31
|
+
}
|
|
32
|
+
where = where.join(" AND ");
|
|
33
|
+
const { subrc, dbcnt } = await this.context.defaultDB().delete({ table, where });
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
abap.builtin.sy.get().subrc.set(subrc);
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
abap.builtin.sy.get().dbcnt.set(dbcnt);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw "deleteDatabase todo";
|
|
35
41
|
}
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
abap.builtin.sy.get().subrc.set(subrc);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
throw "deleteDatabase todo";
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
exports.
|
|
44
|
+
exports.DeleteDatabase = DeleteDatabase;
|
|
44
45
|
//# sourceMappingURL=delete_database.js.map
|
|
@@ -9,14 +9,17 @@ function getTime(options) {
|
|
|
9
9
|
const time = (d.getUTCHours() + "").padStart(2, "0") +
|
|
10
10
|
(d.getUTCMinutes() + "").padStart(2, "0") +
|
|
11
11
|
(d.getUTCSeconds() + "").padStart(2, "0");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
if (options === undefined) {
|
|
13
|
+
options = {};
|
|
14
|
+
}
|
|
15
|
+
if ((options === null || options === void 0 ? void 0 : options.sy) === undefined) {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
options.sy = abap.builtin.sy;
|
|
18
|
+
}
|
|
19
|
+
options.sy.get().datlo.set(date);
|
|
20
|
+
options.sy.get().datum.set(date);
|
|
21
|
+
options.sy.get().timlo.set(time);
|
|
22
|
+
options.sy.get().uzeit.set(time);
|
|
20
23
|
if (options === null || options === void 0 ? void 0 : options.field) {
|
|
21
24
|
options.field.set(time);
|
|
22
25
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { append } from "./append";
|
|
2
2
|
import { assert } from "./assert";
|
|
3
3
|
import { assign } from "./assign";
|
|
4
|
-
import { callFunction } from "./call_function";
|
|
5
4
|
import { clear } from "./clear";
|
|
6
5
|
import { commit } from "./commit";
|
|
7
6
|
import { concatenate } from "./concatenate";
|
|
8
7
|
import { condense } from "./condense";
|
|
9
|
-
import { Console } from "../console";
|
|
10
8
|
import { convert } from "./convert";
|
|
11
9
|
import { createData } from "./create_data";
|
|
12
10
|
import { deleteInternal } from "./delete_internal";
|
|
@@ -15,25 +13,29 @@ import { find } from "./find";
|
|
|
15
13
|
import { getBit } from "./get_bit";
|
|
16
14
|
import { getRunTime } from "./get_run_time";
|
|
17
15
|
import { getTime } from "./get_time";
|
|
18
|
-
import {
|
|
16
|
+
import { IInsertDatabaseOptions } from "./insert_database";
|
|
19
17
|
import { insertInternal } from "./insert_internal";
|
|
20
|
-
import {
|
|
18
|
+
import { IDeleteDatabaseOptions } from "./delete_database";
|
|
21
19
|
import { loop } from "./loop";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
20
|
+
import { IMessageOptions } from "./message";
|
|
21
|
+
import { IModifyDatabaseOptions } from "./modify_database";
|
|
24
22
|
import { modifyInternal } from "./modify_internal";
|
|
25
23
|
import { moveCorresponding } from "./move_corresponding";
|
|
26
24
|
import { readTable } from "./read_table";
|
|
27
25
|
import { replace } from "./replace";
|
|
28
26
|
import { rollback } from "./rollback";
|
|
29
|
-
import { select } from "./select";
|
|
30
27
|
import { setBit } from "./set_bit";
|
|
31
28
|
import { shift } from "./shift";
|
|
32
29
|
import { sort } from "./sort";
|
|
33
30
|
import { split } from "./split";
|
|
34
31
|
import { translate } from "./translate";
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
32
|
+
import { IUpdateDatabaseOptions } from "./update_database";
|
|
33
|
+
import { IWriteOptions } from "./write";
|
|
34
|
+
import { Context } from "../context";
|
|
35
|
+
import { ICharacter } from "../types/_character";
|
|
36
|
+
import { FieldSymbol, Structure, Table } from "../types";
|
|
37
|
+
import { INumeric } from "../types/_numeric";
|
|
38
|
+
import { ICallFunctionOptions } from "./call_function";
|
|
37
39
|
export declare class Statements {
|
|
38
40
|
append: typeof append;
|
|
39
41
|
assert: typeof assert;
|
|
@@ -48,30 +50,28 @@ export declare class Statements {
|
|
|
48
50
|
describe: typeof describe;
|
|
49
51
|
find: typeof find;
|
|
50
52
|
getBit: typeof getBit;
|
|
51
|
-
callFunction: typeof callFunction;
|
|
52
53
|
getRunTime: typeof getRunTime;
|
|
53
|
-
deleteDatabase: typeof deleteDatabase;
|
|
54
54
|
getTime: typeof getTime;
|
|
55
|
-
insertDatabase: typeof insertDatabase;
|
|
56
55
|
insertInternal: typeof insertInternal;
|
|
57
56
|
loop: typeof loop;
|
|
58
|
-
message: typeof message;
|
|
59
57
|
modifyInternal: typeof modifyInternal;
|
|
60
58
|
moveCorresponding: typeof moveCorresponding;
|
|
61
59
|
readTable: typeof readTable;
|
|
62
|
-
updateDatabase: typeof updateDatabase;
|
|
63
|
-
modifyDatabase: typeof modifyDatabase;
|
|
64
60
|
replace: typeof replace;
|
|
65
61
|
rollback: typeof rollback;
|
|
66
|
-
select: typeof select;
|
|
67
62
|
setBit: typeof setBit;
|
|
68
63
|
shift: typeof shift;
|
|
69
64
|
sort: typeof sort;
|
|
70
65
|
split: typeof split;
|
|
71
66
|
translate: typeof translate;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
private readonly context;
|
|
68
|
+
constructor(context: Context);
|
|
69
|
+
deleteDatabase(table: string | ICharacter, options: IDeleteDatabaseOptions): Promise<void>;
|
|
70
|
+
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number>;
|
|
71
|
+
message(options: IMessageOptions): Promise<void>;
|
|
72
|
+
modifyDatabase(table: string | ICharacter, options: IModifyDatabaseOptions): Promise<void>;
|
|
73
|
+
select(target: Structure | Table | FieldSymbol, select: string): Promise<void>;
|
|
74
|
+
updateDatabase(table: string | ICharacter, options: IUpdateDatabaseOptions): Promise<number>;
|
|
75
|
+
callFunction(options: ICallFunctionOptions): Promise<void>;
|
|
76
|
+
write(source: INumeric | ICharacter | FieldSymbol | string | number, options?: IWriteOptions): void;
|
|
77
77
|
}
|
|
@@ -4,7 +4,6 @@ exports.Statements = void 0;
|
|
|
4
4
|
const append_1 = require("./append");
|
|
5
5
|
const assert_1 = require("./assert");
|
|
6
6
|
const assign_1 = require("./assign");
|
|
7
|
-
const call_function_1 = require("./call_function");
|
|
8
7
|
const clear_1 = require("./clear");
|
|
9
8
|
const commit_1 = require("./commit");
|
|
10
9
|
const concatenate_1 = require("./concatenate");
|
|
@@ -36,10 +35,11 @@ const split_1 = require("./split");
|
|
|
36
35
|
const translate_1 = require("./translate");
|
|
37
36
|
const update_database_1 = require("./update_database");
|
|
38
37
|
const write_1 = require("./write");
|
|
38
|
+
const call_function_1 = require("./call_function");
|
|
39
39
|
// this is a class, as statements like SELECT needs access to the database object instance
|
|
40
40
|
// and WRITE will access the Console
|
|
41
41
|
class Statements {
|
|
42
|
-
constructor(
|
|
42
|
+
constructor(context) {
|
|
43
43
|
this.append = append_1.append;
|
|
44
44
|
this.assert = assert_1.assert;
|
|
45
45
|
this.assign = assign_1.assign;
|
|
@@ -53,32 +53,45 @@ class Statements {
|
|
|
53
53
|
this.describe = describe_1.describe;
|
|
54
54
|
this.find = find_1.find;
|
|
55
55
|
this.getBit = get_bit_1.getBit;
|
|
56
|
-
this.callFunction = call_function_1.callFunction;
|
|
57
56
|
this.getRunTime = get_run_time_1.getRunTime;
|
|
58
|
-
this.deleteDatabase = delete_database_1.deleteDatabase;
|
|
59
57
|
this.getTime = get_time_1.getTime;
|
|
60
|
-
this.insertDatabase = insert_database_1.insertDatabase;
|
|
61
58
|
this.insertInternal = insert_internal_1.insertInternal;
|
|
62
59
|
this.loop = loop_1.loop;
|
|
63
|
-
this.message = message_1.message;
|
|
64
60
|
this.modifyInternal = modify_internal_1.modifyInternal;
|
|
65
61
|
this.moveCorresponding = move_corresponding_1.moveCorresponding;
|
|
66
62
|
this.readTable = read_table_1.readTable;
|
|
67
|
-
this.updateDatabase = update_database_1.updateDatabase;
|
|
68
|
-
this.modifyDatabase = modify_database_1.modifyDatabase;
|
|
69
63
|
this.replace = replace_1.replace;
|
|
70
64
|
this.rollback = rollback_1.rollback;
|
|
71
|
-
this.select = select_1.select;
|
|
72
65
|
this.setBit = set_bit_1.setBit;
|
|
73
66
|
this.shift = shift_1.shift;
|
|
74
67
|
this.sort = sort_1.sort;
|
|
75
68
|
this.split = split_1.split;
|
|
76
69
|
this.translate = translate_1.translate;
|
|
77
|
-
this.
|
|
78
|
-
|
|
70
|
+
this.context = context;
|
|
71
|
+
}
|
|
72
|
+
async deleteDatabase(table, options) {
|
|
73
|
+
return new delete_database_1.DeleteDatabase(this.context).deleteDatabase(table, options);
|
|
74
|
+
}
|
|
75
|
+
async insertDatabase(table, options) {
|
|
76
|
+
return new insert_database_1.InsertDatabase(this.context).insertDatabase(table, options);
|
|
77
|
+
}
|
|
78
|
+
async message(options) {
|
|
79
|
+
return new message_1.MessageStatement(this.context).message(options);
|
|
80
|
+
}
|
|
81
|
+
async modifyDatabase(table, options) {
|
|
82
|
+
return new modify_database_1.ModifyDatabase(this.context).modifyDatabase(table, options);
|
|
83
|
+
}
|
|
84
|
+
async select(target, select) {
|
|
85
|
+
return new select_1.SelectDatabase(this.context).select(target, select);
|
|
86
|
+
}
|
|
87
|
+
async updateDatabase(table, options) {
|
|
88
|
+
return new update_database_1.UpdateDatabase(this.context).updateDatabase(table, options);
|
|
89
|
+
}
|
|
90
|
+
async callFunction(options) {
|
|
91
|
+
return new call_function_1.CallFunction(this.context).callFunction(options);
|
|
79
92
|
}
|
|
80
|
-
|
|
81
|
-
this.
|
|
93
|
+
write(source, options) {
|
|
94
|
+
return new write_1.WriteStatement(this.context).write(source, options);
|
|
82
95
|
}
|
|
83
96
|
}
|
|
84
97
|
exports.Statements = Statements;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
1
2
|
import { Structure } from "../types";
|
|
2
3
|
import { ICharacter } from "../types/_character";
|
|
3
4
|
export interface IInsertDatabaseOptions {
|
|
4
5
|
values: Structure;
|
|
5
6
|
}
|
|
6
|
-
export declare
|
|
7
|
+
export declare class InsertDatabase {
|
|
8
|
+
private readonly context;
|
|
9
|
+
constructor(context: Context);
|
|
10
|
+
insertDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): Promise<number>;
|
|
11
|
+
}
|