* Only prepend table name to query if access name doesn't contain "(" or "."
This makes it possible to use an SQL function as group criterium
This commit is contained in:
parent
5efab894ef
commit
8044f33450
2 changed files with 9 additions and 6 deletions
|
@ -908,9 +908,10 @@ public final class NodeManager {
|
|||
b.append(rel.queryHints).append(" ");
|
||||
}
|
||||
|
||||
b.append(table).append('.')
|
||||
.append(idfield).append(" FROM ")
|
||||
.append(table);
|
||||
if (idfield.indexOf('(') == -1 && idfield.indexOf('.') == -1) {
|
||||
b.append(table).append('.');
|
||||
}
|
||||
b.append(idfield).append(" FROM ").append(table);
|
||||
|
||||
rel.appendAdditionalTables(b);
|
||||
|
||||
|
@ -1345,7 +1346,7 @@ public final class NodeManager {
|
|||
|
||||
// if we do a groupby query (creating an intermediate layer of groupby nodes),
|
||||
// retrieve the value of that field instead of the primary key
|
||||
String namefield = (rel.groupby == null) ? rel.accessName : rel.groupby;
|
||||
String namefield = (rel.groupby == null) ? rel.accessName : rel.groupby;
|
||||
Connection con = rel.otherType.getConnection();
|
||||
// set connection to read-only mode
|
||||
if (!con.isReadOnly()) con.setReadOnly(true);
|
||||
|
|
|
@ -1242,8 +1242,10 @@ public final class Relation {
|
|||
local = ref.getString(homeprop);
|
||||
}
|
||||
|
||||
q.append(otherType.getTableName());
|
||||
q.append(".");
|
||||
if (foreignName.indexOf('(') == -1 && foreignName.indexOf('.') == -1) {
|
||||
q.append(otherType.getTableName());
|
||||
q.append(".");
|
||||
}
|
||||
q.append(foreignName);
|
||||
q.append(" = ");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue