Hi,
the DBReader can be much faster for resultsets with many columns if the
getFieldIndex(ColumnExpr c) method uses some kind of caching. The following
code is 10 times faster for a resultset with 20000 rows and 70 columns.
public class MyDBReader extends DBReader {
private static final long serialVersionUID = 1L;
private Map<ColumnExpr, Integer> fieldIndices = new HashMap<ColumnExpr,
Integer>();
@Override
public int getFieldIndex(ColumnExpr column) {
Integer i = fieldIndices.get(column);
if (i == null){
i = super.getFieldIndex(column);
fieldIndices.put(column, i);
}
return i;
}
}
What do you think?
Regards,
Ivan