if(!(row instanceof RowHolder)) {
throw new IllegalArgumentException("Unexpected row: " + row.getClass());
}
try {
RowHolder rowHolder = (RowHolder)row;
JDBCResultSet resultSet = rowHolder.rsHolder.resultSet;
JDBCResultSetMetaData metaData = resultSet.getMetaData();
boolean begun = false;
boolean savedCurrent = false;
for(int col = 1; col <= metaData.getColumnCount(); ++col) {
String colName = metaData.getColumnLabel(col);
if(metaData.getNestedResultSet(col) != null) {
if(!savedCurrent) {
holderStack.push(currentHolder);
savedCurrent = true;
}
JDBCResultSet nested = (JDBCResultSet)resultSet.getObject(col);
holderStack.push(new ResultSetHolder(nested, colName, rowHolder.rsHolder.depth + 1));
} else {
ValueSource valueSource = row.value(col - 1);
JsonRowWriter.writeValue(colName, valueSource, appender, !begun, options);
begun = true;