Do not set constraints for groupby-constraints, since we

don't know if it is the base node or a group node we are being
added to.
This commit is contained in:
hns 2001-08-22 12:24:01 +00:00
parent 3b0be3f7e6
commit 1912cdc6ea

View file

@ -472,11 +472,15 @@ public class Relation {
* appropriate properties * appropriate properties
*/ */
public void setConstraints (Node parent, Node child) { public void setConstraints (Node parent, Node child) {
INode nonVirtual = parent.getNonVirtualParent (); INode home = parent.getNonVirtualParent ();
for (int i=0; i<constraints.length; i++) { for (int i=0; i<constraints.length; i++) {
// don't set groupby constraints since we don't know if the
// parent node is the base node or a group node
if (constraints[i].isGroupby)
continue;
Relation crel = otherType.columnNameToRelation (constraints[i].foreignName); Relation crel = otherType.columnNameToRelation (constraints[i].foreignName);
if (crel != null) { if (crel != null) {
INode home = constraints[i].isGroupby ? parent : nonVirtual; // INode home = constraints[i].isGroupby ? parent : nonVirtual;
String localName = constraints[i].localName; String localName = constraints[i].localName;
if (localName == null || localName.equals (ownType.getIDField ())) { if (localName == null || localName.equals (ownType.getIDField ())) {
INode currentValue = child.getNode (crel.propName, false); INode currentValue = child.getNode (crel.propName, false);
@ -496,7 +500,6 @@ public class Relation {
else else
value = home.getString (localName, false); value = home.getString (localName, false);
if (value != null) { if (value != null) {
// System.err.println ("SETTING "+child+"."+propname+" TO "+value);
child.setString (crel.propName, value); child.setString (crel.propName, value);
} }
} }