@abaplint/core 2.97.0 → 2.97.3
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.
|
@@ -269,7 +269,7 @@ class BasicTypes {
|
|
|
269
269
|
return undefined;
|
|
270
270
|
}
|
|
271
271
|
parseTable(node, name) {
|
|
272
|
-
var _a, _b, _c;
|
|
272
|
+
var _a, _b, _c, _d;
|
|
273
273
|
const typename = node.findFirstExpression(Expressions.TypeName);
|
|
274
274
|
const text = (_a = node.findFirstExpression(Expressions.TypeTable)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
275
275
|
if (text === undefined) {
|
|
@@ -292,7 +292,8 @@ class BasicTypes {
|
|
|
292
292
|
}
|
|
293
293
|
const typeTableKeys = node.findAllExpressions(expressions_1.TypeTableKey);
|
|
294
294
|
const firstKey = typeTableKeys[0];
|
|
295
|
-
const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined
|
|
295
|
+
const isNamed = (firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) !== undefined
|
|
296
|
+
&& ((_b = firstKey === null || firstKey === void 0 ? void 0 : firstKey.findDirectExpression(expressions_1.Field)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase()) !== "PRIMARY_KEY";
|
|
296
297
|
const primaryKey = {
|
|
297
298
|
name: "primary_key",
|
|
298
299
|
type: type || basic_1.TableAccessType.standard,
|
|
@@ -311,7 +312,7 @@ class BasicTypes {
|
|
|
311
312
|
const secondaryKeys = [];
|
|
312
313
|
for (let i = start; i < typeTableKeys.length; i++) {
|
|
313
314
|
const row = typeTableKeys[i];
|
|
314
|
-
const name = (
|
|
315
|
+
const name = (_c = row.findDirectExpression(expressions_1.Field)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
315
316
|
if (name === undefined) {
|
|
316
317
|
continue;
|
|
317
318
|
}
|
|
@@ -407,7 +408,7 @@ class BasicTypes {
|
|
|
407
408
|
else if (typename && (text.startsWith("TYPE TABLE FOR CREATE ")
|
|
408
409
|
|| text.startsWith("TYPE TABLE FOR UPDATE "))) {
|
|
409
410
|
const name = typename.concatTokens();
|
|
410
|
-
const type = (
|
|
411
|
+
const type = (_d = this.scope.getDDIC().lookupDDLS(name)) === null || _d === void 0 ? void 0 : _d.type;
|
|
411
412
|
if (type) {
|
|
412
413
|
return new Types.TableType(new basic_1.VoidType("RapTodo"), options);
|
|
413
414
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -8,6 +8,7 @@ const _abap_rule_1 = require("./_abap_rule");
|
|
|
8
8
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
9
9
|
const version_1 = require("../version");
|
|
10
10
|
const _irule_1 = require("./_irule");
|
|
11
|
+
const edit_helper_1 = require("../edit_helper");
|
|
11
12
|
class StrictSQLConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
12
13
|
}
|
|
13
14
|
exports.StrictSQLConf = StrictSQLConf;
|
|
@@ -25,8 +26,10 @@ class StrictSQL extends _abap_rule_1.ABAPRule {
|
|
|
25
26
|
|
|
26
27
|
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenopensql_strict_mode_750.htm
|
|
27
28
|
|
|
28
|
-
Also see separate rule sql_escape_host_variables
|
|
29
|
-
|
|
29
|
+
Also see separate rule sql_escape_host_variables
|
|
30
|
+
|
|
31
|
+
Activates from v750 and up`,
|
|
32
|
+
tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
getConfig() {
|
|
@@ -41,7 +44,7 @@ Also see separate rule sql_escape_host_variables`,
|
|
|
41
44
|
if (type === "INTF" || type === "TYPE") {
|
|
42
45
|
return [];
|
|
43
46
|
}
|
|
44
|
-
if (this.reg.getConfig().getVersion() < version_1.Version.
|
|
47
|
+
if (this.reg.getConfig().getVersion() < version_1.Version.v750
|
|
45
48
|
&& this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {
|
|
46
49
|
return [];
|
|
47
50
|
}
|
|
@@ -55,11 +58,15 @@ Also see separate rule sql_escape_host_variables`,
|
|
|
55
58
|
if (into === undefined || where === undefined) {
|
|
56
59
|
continue;
|
|
57
60
|
}
|
|
58
|
-
if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
|
|
61
|
+
else if (where.getFirstToken().getStart().isBefore(into.getFirstToken().getStart())) {
|
|
59
62
|
continue;
|
|
60
63
|
}
|
|
64
|
+
const fix1 = edit_helper_1.EditHelper.deleteRange(file, into.getFirstToken().getStart(), into.getLastToken().getEnd());
|
|
65
|
+
const whereLast = where.getLastToken();
|
|
66
|
+
const fix2 = edit_helper_1.EditHelper.insertAt(file, whereLast.getEnd(), " " + into.concatTokens());
|
|
67
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
61
68
|
const message = "INTO/APPENDING must be last in strict SQL";
|
|
62
|
-
const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity);
|
|
69
|
+
const issue = issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);
|
|
63
70
|
issues.push(issue);
|
|
64
71
|
break;
|
|
65
72
|
}
|