in rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java [273:329]
private void processRecursiveRow() throws SQLException {
int i = 1;
// create map to keep track of recursive indexes
// each recursive table contains a 0-based index to keep track of the sequence
Map recursiveIndexes = new HashMap();
for (Iterator itTablePropertyNames = recursiveTablePropertyNames.iterator(); itTablePropertyNames.hasNext(); ) {
recursiveIndexes.put(itTablePropertyNames.next(), new Integer(-1));
}
// loop thru result set columns
// assuming that the columns of each recursive table are grouped together (metadata do not allow for further granularity)
while (i <= resultSetSize) {
TableData table;
String tablePropertyName = tablePropertyNames[i];
if (recursiveTablePropertyNames.contains(tablePropertyName)) {
// increment current recursive index for table
int recursiveIndex = ((Integer) recursiveIndexes.get(tablePropertyName)).intValue() + 1;
recursiveIndexes.put(tablePropertyName, new Integer(recursiveIndex));
// get table data
table = getRecursiveRawData(tablePropertyName, recursiveIndex);
} else {
table = getRawData(tablePropertyNames[i]);
}
while ((i <= resultSetSize) && (isPKColumn[i])) {
Object data = getObject(currentResultSet, i);
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding column: " + columnPropertyNames[i]
+ "\tValue: " + data + "\tTable: "
+ tablePropertyNames[i]);
}
table.addData(columnPropertyNames[i], true, data);
i++;
}
while ((i <= resultSetSize) && (!isPKColumn[i])) {
Object data = getObject(currentResultSet, i);
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding column: " + columnPropertyNames[i]
+ "\tValue: " + data + "\tTable: "
+ tablePropertyNames[i]);
}
table.addData(columnPropertyNames[i], false, data);
i++;
}
// skip table if empty
if (table.isTableEmpty()) {
table.clear();
} else {
this.allTableData.add(table);
}
}
checkResultSetMissesPK();
}