avoid sending an SQL statement in updateNode if the only thing

marked as dirty is a virtual node. This used to throw an exception
when adding subnodes to a node that also has a virtual node.
This commit is contained in:
hns 2001-03-11 15:25:34 +00:00
parent 9e2a4f561e
commit faead64efc

View file

@ -401,34 +401,40 @@ public final class NodeManager {
if (p.dirty) { if (p.dirty) {
switch (p.getType ()) { switch (p.getType ()) {
case IProperty.STRING: case IProperty.STRING:
updated++;
rec.setValue (rel.getDbField(), p.getStringValue ()); rec.setValue (rel.getDbField(), p.getStringValue ());
break; break;
case IProperty.BOOLEAN: case IProperty.BOOLEAN:
updated++;
rec.setValue (rel.getDbField(), p.getBooleanValue ()); rec.setValue (rel.getDbField(), p.getBooleanValue ());
break; break;
case IProperty.DATE: case IProperty.DATE:
updated++;
Timestamp t = new Timestamp (p.getDateValue ().getTime ()); Timestamp t = new Timestamp (p.getDateValue ().getTime ());
rec.setValue (rel.getDbField(), t); rec.setValue (rel.getDbField(), t);
break; break;
case IProperty.INTEGER: case IProperty.INTEGER:
updated++;
rec.setValue (rel.getDbField(), p.getIntegerValue ()); rec.setValue (rel.getDbField(), p.getIntegerValue ());
break; break;
case IProperty.FLOAT: case IProperty.FLOAT:
updated++;
rec.setValue (rel.getDbField(), p.getFloatValue ()); rec.setValue (rel.getDbField(), p.getFloatValue ());
break; break;
case IProperty.NODE: case IProperty.NODE:
if (rel.direction == Relation.FORWARD) { if (!rel.virtual && rel.direction == Relation.FORWARD) {
// INode n = p.getNodeValue (); // INode n = p.getNodeValue ();
// String foreignID = n == null ? null : n.getID (); // String foreignID = n == null ? null : n.getID ();
updated++;
rec.setValue (rel.getDbField(), p.getStringValue ()); rec.setValue (rel.getDbField(), p.getStringValue ());
} }
break; break;
} }
updated++;
p.dirty = false; p.dirty = false;
} }
} else if (rel != null && rel.getDbField() != null) { } else if (rel != null && rel.getDbField() != null) {
updated++; updated++;
rec.setValueNull (rel.getDbField()); rec.setValueNull (rel.getDbField());
} }