@abaplint/core 2.120.25 → 2.120.26
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/build/src/abap/5_syntax/expressions/_check_database_fields.js +35 -0
- package/build/src/abap/5_syntax/expressions/select.js +2 -30
- package/build/src/abap/5_syntax/statements/delete_database.js +9 -1
- package/build/src/abap/5_syntax/statements/update_database.js +9 -1
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkDatabaseFields = checkDatabaseFields;
|
|
4
|
+
const basic_1 = require("../../types/basic");
|
|
5
|
+
const _syntax_input_1 = require("../_syntax_input");
|
|
6
|
+
function checkDatabaseFields(fields, dbSources, input, token) {
|
|
7
|
+
if (dbSources.length > 1) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const first = dbSources[0];
|
|
11
|
+
if (first === undefined) {
|
|
12
|
+
// then its voided
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const type = first.parseType(input.scope.getRegistry());
|
|
16
|
+
if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!(type instanceof basic_1.StructureType)) {
|
|
20
|
+
const message = "checkFields, expected structure, " + type.constructor.name;
|
|
21
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
for (const field of fields) {
|
|
25
|
+
if (field === "*") {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (/^\w+$/.test(field) && type.getComponentByName(field) === undefined) {
|
|
29
|
+
const message = `checkFields, field ${field} not found`;
|
|
30
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=_check_database_fields.js.map
|
|
@@ -48,6 +48,7 @@ const dynamic_1 = require("./dynamic");
|
|
|
48
48
|
const _reference_1 = require("../_reference");
|
|
49
49
|
const _syntax_input_1 = require("../_syntax_input");
|
|
50
50
|
const version_1 = require("../../../version");
|
|
51
|
+
const _check_database_fields_1 = require("./_check_database_fields");
|
|
51
52
|
const isSimple = /^\w+$/;
|
|
52
53
|
class Select {
|
|
53
54
|
static runSyntax(node, input, skipImplicitInto = false, selectLoop = false) {
|
|
@@ -72,7 +73,7 @@ class Select {
|
|
|
72
73
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
(0, _check_database_fields_1.checkDatabaseFields)(fields.map(field => field.code), dbSources, input, node.getFirstToken());
|
|
76
77
|
const intoExpression = this.handleInto(node, input, fields, dbSources);
|
|
77
78
|
const fae = node.findDirectExpression(Expressions.SQLForAllEntries);
|
|
78
79
|
if (fae) {
|
|
@@ -299,35 +300,6 @@ class Select {
|
|
|
299
300
|
}
|
|
300
301
|
return undefined;
|
|
301
302
|
}
|
|
302
|
-
static checkFields(fields, dbSources, input, node) {
|
|
303
|
-
if (dbSources.length > 1) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
const first = dbSources[0];
|
|
307
|
-
if (first === undefined) {
|
|
308
|
-
// then its voided
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
const type = first.parseType(input.scope.getRegistry());
|
|
312
|
-
if (type instanceof basic_1.VoidType || type instanceof basic_1.UnknownType) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
if (!(type instanceof basic_1.StructureType)) {
|
|
316
|
-
const message = "checkFields, expected structure, " + type.constructor.name;
|
|
317
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
for (const field of fields) {
|
|
321
|
-
if (field.code === "*") {
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
if (isSimple.test(field.code) && type.getComponentByName(field.code) === undefined) {
|
|
325
|
-
const message = `checkFields, field ${field.code} not found`;
|
|
326
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
303
|
static countResultType(scope) {
|
|
332
304
|
if ((0, version_1.releaseAtLeast)(scope.getRelease(), version_1.Release.v750)
|
|
333
305
|
|| scope.getOpenABAP()
|
|
@@ -38,6 +38,7 @@ const Expressions = __importStar(require("../../2_statements/expressions"));
|
|
|
38
38
|
const source_1 = require("../expressions/source");
|
|
39
39
|
const dynamic_1 = require("../expressions/dynamic");
|
|
40
40
|
const database_table_1 = require("../expressions/database_table");
|
|
41
|
+
const _check_database_fields_1 = require("../expressions/_check_database_fields");
|
|
41
42
|
class DeleteDatabase {
|
|
42
43
|
runSyntax(node, input) {
|
|
43
44
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
@@ -51,7 +52,14 @@ class DeleteDatabase {
|
|
|
51
52
|
}
|
|
52
53
|
const dbtab = node.findFirstExpression(Expressions.DatabaseTable);
|
|
53
54
|
if (dbtab !== undefined) {
|
|
54
|
-
database_table_1.DatabaseTable.runSyntax(dbtab, input);
|
|
55
|
+
const dbSource = database_table_1.DatabaseTable.runSyntax(dbtab, input);
|
|
56
|
+
const fields = node.findAllExpressions(Expressions.SQLCompare)
|
|
57
|
+
.map(compare => { var _a; return (_a = compare.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); })
|
|
58
|
+
.filter(field => field !== undefined);
|
|
59
|
+
for (const orderBy of node.findAllExpressions(Expressions.SQLOrderBy)) {
|
|
60
|
+
fields.push(...orderBy.findAllExpressions(Expressions.SQLFieldName).map(field => field.concatTokens().toUpperCase()));
|
|
61
|
+
}
|
|
62
|
+
(0, _check_database_fields_1.checkDatabaseFields)(fields, [dbSource], input, node.getFirstToken());
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -42,11 +42,19 @@ const _typed_identifier_1 = require("../../types/_typed_identifier");
|
|
|
42
42
|
const identifier_1 = require("../../1_lexer/tokens/identifier");
|
|
43
43
|
const database_table_1 = require("../expressions/database_table");
|
|
44
44
|
const dynamic_1 = require("../expressions/dynamic");
|
|
45
|
+
const _check_database_fields_1 = require("../expressions/_check_database_fields");
|
|
45
46
|
class UpdateDatabase {
|
|
46
47
|
runSyntax(node, input) {
|
|
47
48
|
const dbtab = node.findFirstExpression(Expressions.DatabaseTable);
|
|
48
49
|
if (dbtab !== undefined) {
|
|
49
|
-
database_table_1.DatabaseTable.runSyntax(dbtab, input);
|
|
50
|
+
const dbSource = database_table_1.DatabaseTable.runSyntax(dbtab, input);
|
|
51
|
+
const fields = node.findAllExpressions(Expressions.SQLFieldAndValue)
|
|
52
|
+
.flatMap(fieldAndValue => fieldAndValue.findDirectExpressions(Expressions.SQLFieldName))
|
|
53
|
+
.map(field => field.concatTokens().toUpperCase());
|
|
54
|
+
fields.push(...node.findAllExpressions(Expressions.SQLCompare)
|
|
55
|
+
.map(compare => { var _a; return (_a = compare.findDirectExpression(Expressions.SQLFieldName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); })
|
|
56
|
+
.filter(field => field !== undefined));
|
|
57
|
+
(0, _check_database_fields_1.checkDatabaseFields)(fields, [dbSource], input, node.getFirstToken());
|
|
50
58
|
}
|
|
51
59
|
const tableName = node.findDirectExpression(Expressions.DatabaseTable);
|
|
52
60
|
const tokenName = tableName === null || tableName === void 0 ? void 0 : tableName.getFirstToken();
|
package/build/src/registry.js
CHANGED