@sap/cds-compiler 2.11.0 → 2.11.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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
Note: `beta` fixes, changes and features are usually not listed in this ChangeLog but [here](doc/CHANGELOG_BETA.md).
|
|
8
8
|
The compiler behavior concerning `beta` features can change at any time without notice.
|
|
9
9
|
|
|
10
|
+
## Version 2.11.2 - 2021-12-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- to.sql/hdi/hdbcds:
|
|
15
|
+
+ No foreign key constraint will be rendered for managed `composition of one` if annotated with `@assert.integrity: false`
|
|
16
|
+
+ Correctly handle managed associations with other managed associations as foreign keys in conjunction with `exists`
|
|
17
|
+
|
|
10
18
|
## Version 2.11.0 - 2021-12-02
|
|
11
19
|
|
|
12
20
|
### Added
|
|
@@ -294,13 +294,8 @@ function createReferentialConstraints(csn, options) {
|
|
|
294
294
|
// for "auto-generated" associations like for the up_ of a composition of aspects,
|
|
295
295
|
// the annotation on the composition influences the referential constraint for the
|
|
296
296
|
// up_ association
|
|
297
|
-
if (element.$selfOnCondition && element.targetAspect)
|
|
297
|
+
if (element.$selfOnCondition && element.targetAspect)
|
|
298
298
|
assignPropOnBacklinkIfPossible(SKIP_FOR_UP, true);
|
|
299
|
-
return true;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (element.type === 'cds.Composition')
|
|
303
|
-
return false;
|
|
304
299
|
|
|
305
300
|
return true;
|
|
306
301
|
}
|
|
@@ -137,6 +137,9 @@ function transformForHanaWithCsn(inputModel, options, moduleName) {
|
|
|
137
137
|
error, warning, info, inspectRef, effectiveType, artifactRef, csnUtils: getUtils(csn), csn, options, getFinalBaseType, isAspect
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
// Needs to happen before tuple expansion, so the newly generated WHERE-conditions have it applied
|
|
141
|
+
handleExists(csn, options, error);
|
|
142
|
+
|
|
140
143
|
// Check if structured elements and managed associations are compared in an expression
|
|
141
144
|
// and expand these structured elements. This tuple expansion allows all other
|
|
142
145
|
// subsequent procession steps (especially a2j) to see plain paths in expressions.
|
|
@@ -149,7 +152,6 @@ function transformForHanaWithCsn(inputModel, options, moduleName) {
|
|
|
149
152
|
// FIXME: This does something very similar to cloneWithTransformations -> refactor?
|
|
150
153
|
const transformCsn = transformUtils.transformModel;
|
|
151
154
|
|
|
152
|
-
handleExists(csn, options, error);
|
|
153
155
|
|
|
154
156
|
// (001) Add a temporal where condition to views where applicable before assoc2join
|
|
155
157
|
// assoc2join eventually rewrites the table aliases
|
|
@@ -1094,16 +1094,16 @@ function getTransformers(model, options, pathDelimiter = '_') {
|
|
|
1094
1094
|
function expandStructsInExpression(csn, options = {}) {
|
|
1095
1095
|
applyTransformations(csn, {
|
|
1096
1096
|
'on': (parent, name, on, path) => {
|
|
1097
|
-
parent.on = expand(parent.on, path);
|
|
1097
|
+
parent.on = expand(parent.on, path.concat(name));
|
|
1098
1098
|
},
|
|
1099
1099
|
'having': (parent, name, having, path) => {
|
|
1100
|
-
parent.having = expand(parent.having, path);
|
|
1100
|
+
parent.having = expand(parent.having, path.concat(name));
|
|
1101
1101
|
},
|
|
1102
1102
|
'where': (parent, name, where, path) => {
|
|
1103
|
-
parent.where = expand(parent.where, path);
|
|
1103
|
+
parent.where = expand(parent.where, path.concat(name));
|
|
1104
1104
|
},
|
|
1105
1105
|
'xpr': (parent, name, xpr, path) => {
|
|
1106
|
-
parent.xpr = expand(parent.xpr, path);
|
|
1106
|
+
parent.xpr = expand(parent.xpr, path.concat(name));
|
|
1107
1107
|
}
|
|
1108
1108
|
}, undefined, undefined, options);
|
|
1109
1109
|
|
|
@@ -1121,17 +1121,21 @@ function getTransformers(model, options, pathDelimiter = '_') {
|
|
|
1121
1121
|
if(i < expr.length-2)
|
|
1122
1122
|
{
|
|
1123
1123
|
const [lhs, op, rhs] = expr.slice(i);
|
|
1124
|
+
|
|
1125
|
+
// we might have to ad-hoc resolve a ref, since handleExists is run before hand and generates new refs.
|
|
1126
|
+
const lhsArt = lhs._art || lhs.ref && !lhs.$scope && inspectRef(location.concat(i)).art;
|
|
1127
|
+
const rhsArt = rhs._art || rhs.ref && !rhs.$scope && inspectRef(location.concat(i+2)).art;
|
|
1124
1128
|
// lhs & rhs must be expandable types (structures or managed associations)
|
|
1125
|
-
if(
|
|
1129
|
+
if(lhsArt && rhsArt &&
|
|
1126
1130
|
lhs.ref && rhs.ref &&
|
|
1127
|
-
isExpandable(
|
|
1131
|
+
isExpandable(lhsArt) && isExpandable(rhsArt) &&
|
|
1128
1132
|
['=', '<', '>', '>=', '<=', '!=', '<>'].includes(op) &&
|
|
1129
1133
|
!(isDollarSelfOrProjectionOperand(lhs) || isDollarSelfOrProjectionOperand(rhs))) {
|
|
1130
1134
|
|
|
1131
1135
|
// if path is scalar and no assoc or has no type (@Core.Computed) use original expression
|
|
1132
1136
|
// only do the expansion on (managed) assocs and (items.)elements, array of check in ON cond is done elsewhere
|
|
1133
|
-
const lhspaths = /*isScalarOrNoType(lhs._art) ? [ lhs ] : */ flattenPath({ _art:
|
|
1134
|
-
const rhspaths = /*isScalarOrNoType(rhs._art) ? [ rhs ] : */ flattenPath({ _art:
|
|
1137
|
+
const lhspaths = /*isScalarOrNoType(lhs._art) ? [ lhs ] : */ flattenPath({ _art: lhsArt, ref: lhs.ref }, false, true );
|
|
1138
|
+
const rhspaths = /*isScalarOrNoType(rhs._art) ? [ rhs ] : */ flattenPath({ _art: rhsArt, ref: rhs.ref }, false, true );
|
|
1135
1139
|
|
|
1136
1140
|
// mapping dict for lhs/rhs for mismatch check
|
|
1137
1141
|
// strip lhs/rhs prefix from flattened paths to check remaining common trailing path
|