More fixes for groupby-support in embedded db.

This commit is contained in:
hns 2004-01-28 15:05:10 +00:00
parent 969ef70c93
commit 2f2b0ae051

View file

@ -531,11 +531,7 @@ public final class Node implements INode, Serializable {
* @param dbmap ... * @param dbmap ...
*/ */
public void setDbMapping(DbMapping dbmap) { public void setDbMapping(DbMapping dbmap) {
if (this.dbmap != dbmap) { this.dbmap = dbmap;
this.dbmap = dbmap;
// primaryKey = null;
}
} }
/** /**
@ -854,6 +850,8 @@ public final class Node implements INode, Serializable {
// if group-by node doesn't exist, we'll create it // if group-by node doesn't exist, we'll create it
if (groupbyNode == null) { if (groupbyNode == null) {
groupbyNode = getGroupbySubnode(groupbyValue, true); groupbyNode = getGroupbySubnode(groupbyValue, true);
} else {
groupbyNode.setDbMapping(dbmap.getGroupbyMapping());
} }
groupbyNode.addNode(node); groupbyNode.addNode(node);
@ -1130,7 +1128,7 @@ public final class Node implements INode, Serializable {
* *
* @return ... * @return ...
*/ */
public Node getGroupbySubnode(String sid, boolean create) { protected Node getGroupbySubnode(String sid, boolean create) {
loadNodes(); loadNodes();
if (subnodes == null) { if (subnodes == null) {
@ -1151,10 +1149,10 @@ public final class Node implements INode, Serializable {
// set "groupname" property to value of groupby field // set "groupname" property to value of groupby field
node.setString("groupname", sid); node.setString("groupname", sid);
node.setString("name", sid); node.setString("name", sid);
node.setDbMapping(groupbyMapping);
if (relational) { if (!relational) {
node.setDbMapping(groupbyMapping);
} else {
setNode(sid, node); setNode(sid, node);
subnodes.add(node.getHandle()); subnodes.add(node.getHandle());
} }
@ -2100,7 +2098,7 @@ public final class Node implements INode, Serializable {
public void setNode(String propname, INode value) { public void setNode(String propname, INode value) {
// nmgr.logEvent ("setting node prop"); // nmgr.logEvent ("setting node prop");
// check if types match, otherwise throw exception // check if types match, otherwise throw exception
DbMapping nmap = (dbmap == null) ? null : dbmap.getPropertyMapping(propname); DbMapping nmap = (dbmap == null) ? null : dbmap.getExactPropertyMapping(propname);
if ((nmap != null) && (nmap != value.getDbMapping())) { if ((nmap != null) && (nmap != value.getDbMapping())) {
if (value.getDbMapping() == null) { if (value.getDbMapping() == null) {