Cleaned up creation of SELECT statement for filter.additionalTables option.

This commit is contained in:
hns 2003-12-02 16:26:32 +00:00
parent 415a6cbb27
commit a48bec8be4
2 changed files with 10 additions and 19 deletions

View file

@ -938,6 +938,10 @@ public final class DbMapping implements Updatable {
s.append(table);
s.append(".*");
if (rel != null && rel.additionalTables != null) {
s.append(',').append(rel.additionalTables);
}
for (int i = 0; i < joins.length; i++) {
if (!joins[i].otherType.isRelational()) {
continue;

View file

@ -988,21 +988,20 @@ public final class NodeManager {
try {
String q = null;
StringBuffer tables = new StringBuffer(table);
if (rel.additionalTables != null) {
tables.append(',').append(rel.additionalTables);
}
StringBuffer b = new StringBuffer("SELECT ");
if (rel != null && rel.queryHints != null) {
if (rel.queryHints != null) {
b.append(rel.queryHints).append(" ");
}
b.append(table).append('.')
.append(idfield).append(" FROM ")
.append(tables);
.append(table);
if (rel.additionalTables != null) {
b.append(',').append(rel.additionalTables);
}
if (home.getSubnodeRelation() != null) {
// subnode relation was explicitly set
@ -1097,10 +1096,6 @@ public final class NodeManager {
Relation[] joins = dbm.getJoins();
StringBuffer q = dbm.getSelect(rel);
if (rel.additionalTables != null) {
q.append(',').append(rel.additionalTables);
}
try {
if (home.getSubnodeRelation() != null) {
q.append(home.getSubnodeRelation());
@ -1179,10 +1174,6 @@ public final class NodeManager {
Relation[] joins = dbm.getJoins();
StringBuffer q = dbm.getSelect(rel);
if (rel.additionalTables != null) {
q.append(',').append(rel.additionalTables);
}
try {
String idfield = (rel.groupby != null) ? rel.groupby : dbm.getIDField();
boolean needsQuotes = dbm.needsQuotes(idfield);
@ -1590,10 +1581,6 @@ public final class NodeManager {
Relation[] joins = dbm.getJoins();
StringBuffer q = dbm.getSelect(rel);
if (rel.additionalTables != null) {
q.append(',').append(rel.additionalTables);
}
if (home.getSubnodeRelation() != null && !rel.isComplexReference()) {
// combine our key with the constraints in the manually set subnode relation
q.append(" WHERE ");