commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Krivoshein <i...@mikkri.com>
Subject Re: [DbUtils] Generalized ResultSet iterator
Date Wed, 02 Jun 2004 10:35:49 GMT
Hello David,

Thank you for your answer.

I think that this adds much value not because it is something hard to 
develop, but because it shows right way to use library
in this particular cases. So library user will be confident that in 
later library releases this approach will work.
I completely dislike idea of maintaining my own version of DbUtils that 
is compatible with my codebase.
I'd like to consider Jakarta commons project as vendor that gives me 
this library and I'd like to trust Jakarta commons project
in that library will stay backward and forward compatible during 
reasonable time frame.

And about your ResultSetRowHandler.

Lets consider case then you need to calculate summ of some funcation on 
particular query results.
It sounds reasonable to avoid in memory resultset version creation.
So to be flexible I'd recommend to develop generalized row processor and 
is able to produce result
of any type and then derive one row processor that will produce Lists 
and work as you described here.

>If we add this, I see it as a new ResultSetRowHandler class:
>public abstract class ResultSetRowProcessor implements ResultSetHandler {
>
>    public Object handle(ResultSet rs) throws SQLException {
>        List rows = new ArrayList();
>        while (rs.next()) {
>            rows.add(this.processRow(rs));
>        }
>        return rows;
>    }
>    protected abstract Object handleRow(ResultSet rs) throws SQLException;
>}
>
>The question is how much value this actually adds to DbUtils?
>
>David
>

Best regards,
Mikhail Krivoshein



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message