use raw JDBC Api in getNodeIDs and check for maxSize field in Relation
This commit is contained in:
parent
9f3fae9b2f
commit
cf4b947efe
1 changed files with 20 additions and 9 deletions
|
@ -601,7 +601,8 @@ public final class NodeManager {
|
||||||
Connection con = rel.otherType.getConnection ();
|
Connection con = rel.otherType.getConnection ();
|
||||||
String table = rel.otherType.getTableName ();
|
String table = rel.otherType.getTableName ();
|
||||||
|
|
||||||
QueryDataSet qds = null;
|
Statement stmt = null;
|
||||||
|
// QueryDataSet qds = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String q = null;
|
String q = null;
|
||||||
|
@ -617,15 +618,22 @@ public final class NodeManager {
|
||||||
if (logSql)
|
if (logSql)
|
||||||
app.logEvent ("### getNodeIDs: "+q);
|
app.logEvent ("### getNodeIDs: "+q);
|
||||||
|
|
||||||
qds = new QueryDataSet (con, q);
|
// qds = new QueryDataSet (con, q);
|
||||||
|
stmt = con.createStatement ();
|
||||||
|
if (rel.maxSize > 0)
|
||||||
|
stmt.setMaxRows (rel.maxSize);
|
||||||
|
ResultSet result = stmt.executeQuery (q);
|
||||||
|
|
||||||
qds.fetchRecords ();
|
// qds.fetchRecords ();
|
||||||
|
|
||||||
// problem: how do we derive a SyntheticKey from a not-yet-persistent Node?
|
// problem: how do we derive a SyntheticKey from a not-yet-persistent Node?
|
||||||
Key k = rel.groupby != null ? home.getKey (): null;
|
Key k = rel.groupby != null ? home.getKey (): null;
|
||||||
for (int i=0; i<qds.size (); i++) {
|
while (result.next ()) {
|
||||||
Record rec = qds.getRecord (i);
|
String kstr = result.getString (1);
|
||||||
String kstr = rec.getValue (1).asString ();
|
// jump over null values - this can happen especially when the selected
|
||||||
|
// column is a group-by column.
|
||||||
|
if (kstr == null)
|
||||||
|
continue;
|
||||||
// make the proper key for the object, either a generic DB key or a groupby key
|
// make the proper key for the object, either a generic DB key or a groupby key
|
||||||
Key key = rel.groupby == null ?
|
Key key = rel.groupby == null ?
|
||||||
(Key) new DbKey (rel.otherType, kstr) :
|
(Key) new DbKey (rel.otherType, kstr) :
|
||||||
|
@ -641,9 +649,12 @@ public final class NodeManager {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
// tx.timer.endEvent ("getNodeIDs "+home);
|
// tx.timer.endEvent ("getNodeIDs "+home);
|
||||||
if (qds != null) {
|
// if (qds != null) {
|
||||||
qds.close ();
|
// qds.close ();
|
||||||
}
|
// }
|
||||||
|
if (stmt != null) try {
|
||||||
|
stmt.close ();
|
||||||
|
} catch (Exception ignore) {}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue