in getNodeByRelation, check for manually set subnodeRelation
for additional constraints.
This commit is contained in:
parent
eb0c453cc0
commit
0ea389b663
1 changed files with 28 additions and 18 deletions
|
@ -877,10 +877,20 @@ public final class NodeManager {
|
|||
TableDataSet tds = null;
|
||||
try {
|
||||
DbMapping dbm = rel.otherType;
|
||||
tds = new TableDataSet (dbm.getConnection (), dbm.getSchema (), dbm.getKeyDef ());
|
||||
String where = rel.buildQuery (home, home.getNonVirtualParent (), kstr, "", false);
|
||||
|
||||
tds.where (where);
|
||||
tds = new TableDataSet (dbm.getConnection (), dbm.getSchema (), dbm.getKeyDef ());
|
||||
|
||||
if (home.getSubnodeRelation () != null) {
|
||||
// combine our key with the constraints in the manually set subnode relation
|
||||
StringBuffer where = new StringBuffer ();
|
||||
where.append (rel.accessor);
|
||||
where.append (" = '");
|
||||
where.append (escape(kstr));
|
||||
where.append ("' AND ");
|
||||
where.append (home.getSubnodeRelation ().trim().substring(5).trim());
|
||||
tds.where (where.toString ());
|
||||
} else
|
||||
tds.where (rel.buildQuery (home, home.getNonVirtualParent (), kstr, "", false));
|
||||
|
||||
if (logSql)
|
||||
app.logEvent ("### getNodeByRelation: "+tds.getSelectString());
|
||||
|
@ -913,7 +923,7 @@ public final class NodeManager {
|
|||
}
|
||||
|
||||
// a utility method to escape single quotes
|
||||
/* private String escape (String str) {
|
||||
private String escape (String str) {
|
||||
if (str == null)
|
||||
return null;
|
||||
if (str.indexOf ("'") < 0)
|
||||
|
@ -927,7 +937,7 @@ public final class NodeManager {
|
|||
sbuf.append (c);
|
||||
}
|
||||
return sbuf.toString ();
|
||||
} */
|
||||
}
|
||||
|
||||
|
||||
public Object[] getCacheEntries () {
|
||||
|
|
Loading…
Add table
Reference in a new issue