@abaplint/runtime 1.8.1 → 1.8.5
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.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FieldSymbol, Structure, Table } from "../types";
|
|
2
|
+
import { ICharacter } from "../types/_character";
|
|
3
|
+
export interface IInsertDatabaseOptions {
|
|
4
|
+
from?: Structure | FieldSymbol;
|
|
5
|
+
table?: Table | FieldSymbol;
|
|
6
|
+
}
|
|
7
|
+
export declare function deleteDatabase(table: string | ICharacter, options: IInsertDatabaseOptions): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteDatabase = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
function deleteDatabase(table, options) {
|
|
6
|
+
if (this.db === undefined) {
|
|
7
|
+
throw new Error("Runtime, database not initialized");
|
|
8
|
+
}
|
|
9
|
+
if (options.table instanceof types_1.FieldSymbol) {
|
|
10
|
+
options.table = options.table.getPointer();
|
|
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 });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (options.from) {
|
|
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);
|
|
27
|
+
}
|
|
28
|
+
const sql = `DELETE FROM ${table} WHERE ${where.join(" AND ")}`;
|
|
29
|
+
let subrc = 0;
|
|
30
|
+
try {
|
|
31
|
+
this.db.exec(sql);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
subrc = 4;
|
|
35
|
+
}
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
abap.builtin.sy.get().subrc.set(subrc);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw "deleteDatabase todo";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.deleteDatabase = deleteDatabase;
|
|
44
|
+
//# sourceMappingURL=delete_database.js.map
|
|
@@ -17,6 +17,7 @@ import { getRunTime } from "./get_run_time";
|
|
|
17
17
|
import { getTime } from "./get_time";
|
|
18
18
|
import { insertDatabase } from "./insert_database";
|
|
19
19
|
import { insertInternal } from "./insert_internal";
|
|
20
|
+
import { deleteDatabase } from "./delete_database";
|
|
20
21
|
import { loop } from "./loop";
|
|
21
22
|
import { message } from "./message";
|
|
22
23
|
import { modifyDatabase } from "./modify_database";
|
|
@@ -49,6 +50,7 @@ export declare class Statements {
|
|
|
49
50
|
getBit: typeof getBit;
|
|
50
51
|
callFunction: typeof callFunction;
|
|
51
52
|
getRunTime: typeof getRunTime;
|
|
53
|
+
deleteDatabase: typeof deleteDatabase;
|
|
52
54
|
getTime: typeof getTime;
|
|
53
55
|
insertDatabase: typeof insertDatabase;
|
|
54
56
|
insertInternal: typeof insertInternal;
|
|
@@ -19,6 +19,7 @@ const get_run_time_1 = require("./get_run_time");
|
|
|
19
19
|
const get_time_1 = require("./get_time");
|
|
20
20
|
const insert_database_1 = require("./insert_database");
|
|
21
21
|
const insert_internal_1 = require("./insert_internal");
|
|
22
|
+
const delete_database_1 = require("./delete_database");
|
|
22
23
|
const loop_1 = require("./loop");
|
|
23
24
|
const message_1 = require("./message");
|
|
24
25
|
const modify_database_1 = require("./modify_database");
|
|
@@ -54,6 +55,7 @@ class Statements {
|
|
|
54
55
|
this.getBit = get_bit_1.getBit;
|
|
55
56
|
this.callFunction = call_function_1.callFunction;
|
|
56
57
|
this.getRunTime = get_run_time_1.getRunTime;
|
|
58
|
+
this.deleteDatabase = delete_database_1.deleteDatabase;
|
|
57
59
|
this.getTime = get_time_1.getTime;
|
|
58
60
|
this.insertDatabase = insert_database_1.insertDatabase;
|
|
59
61
|
this.insertInternal = insert_internal_1.insertInternal;
|
|
@@ -23,12 +23,14 @@ function insertInternal(options) {
|
|
|
23
23
|
}
|
|
24
24
|
return true;
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (abap.builtin.sy.get().subrc.get() === 0) {
|
|
26
|
+
if (tableOptions.isUnique === true) {
|
|
27
|
+
(0, read_table_1.readTable)(options.table, { withKey: compare });
|
|
29
28
|
// @ts-ignore
|
|
30
|
-
abap.builtin.sy.get().subrc.
|
|
31
|
-
|
|
29
|
+
if (abap.builtin.sy.get().subrc.get() === 0) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
abap.builtin.sy.get().subrc.set(4);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
let data = options.data;
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@abaplint/runtime",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"description": "Transpiler - Runtime",
|
|
5
|
-
"main": "build/src/index.js",
|
|
6
|
-
"typings": "build/src/index.d.ts",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"compile": "tsc",
|
|
13
|
-
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
-
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
-
"test": "npm run compile && mocha"
|
|
16
|
-
},
|
|
17
|
-
"mocha": {
|
|
18
|
-
"recursive": true,
|
|
19
|
-
"reporter": "progress",
|
|
20
|
-
"spec": "build/test/**/*.js",
|
|
21
|
-
"require": "source-map-support/register"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"ABAP",
|
|
25
|
-
"abaplint"
|
|
26
|
-
],
|
|
27
|
-
"author": "abaplint",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"hdb": "^0.19.1",
|
|
31
|
-
"sql.js": "^1.6.2"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/chai": "^4.3.0",
|
|
35
|
-
"@types/mocha": "^9.1.0",
|
|
36
|
-
"@types/sql.js": "^1.4.3",
|
|
37
|
-
"chai": "^4.3.6",
|
|
38
|
-
"mocha": "^9.2.0",
|
|
39
|
-
"source-map-support": "^0.5.21",
|
|
40
|
-
"typescript": "^4.5.5"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@abaplint/runtime",
|
|
3
|
+
"version": "1.8.5",
|
|
4
|
+
"description": "Transpiler - Runtime",
|
|
5
|
+
"main": "build/src/index.js",
|
|
6
|
+
"typings": "build/src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/abaplint/transpiler.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"compile": "tsc",
|
|
13
|
+
"publish:minor": "npm --no-git-tag-version version minor && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
14
|
+
"publish:patch": "npm --no-git-tag-version version patch && rm -rf build && npm install && npm run test && npm publish --access public",
|
|
15
|
+
"test": "npm run compile && mocha"
|
|
16
|
+
},
|
|
17
|
+
"mocha": {
|
|
18
|
+
"recursive": true,
|
|
19
|
+
"reporter": "progress",
|
|
20
|
+
"spec": "build/test/**/*.js",
|
|
21
|
+
"require": "source-map-support/register"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ABAP",
|
|
25
|
+
"abaplint"
|
|
26
|
+
],
|
|
27
|
+
"author": "abaplint",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"hdb": "^0.19.1",
|
|
31
|
+
"sql.js": "^1.6.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/chai": "^4.3.0",
|
|
35
|
+
"@types/mocha": "^9.1.0",
|
|
36
|
+
"@types/sql.js": "^1.4.3",
|
|
37
|
+
"chai": "^4.3.6",
|
|
38
|
+
"mocha": "^9.2.0",
|
|
39
|
+
"source-map-support": "^0.5.21",
|
|
40
|
+
"typescript": "^4.5.5"
|
|
41
|
+
}
|
|
42
|
+
}
|