commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject Re: Re: [DBUtils][patch] executeQuery method
Date Sun, 24 Nov 2002 20:31:27 GMT



On Sun, 24 Nov 2002, Juozas Baliuka wrote:

>
>
> I need some simple utils for JDBC (o/r mappings do not solve all of my
> problems).
> I use callbacks at this time, it is good for performance and no problems
> with "cose":
>
> //connection is "ThreadLocal"
> db.executeQuery(
>           "SELECT * FROM Boing b WHERE b.name=?",
>            new Object[] { name },
>            new Handler(){
>                    public void handle(ResutSet rs )throws SQLException{
>                       //my
> code........................................................................
> ....................
>            }
>
>     }
>
>  );
> It is possible to have predefined handlers to convert result sets to data
> structure like List, if  max resultset size is known.
> It can be used to implement something like this :
>
> int count = db.executeIntQuery( "SELECT count(*) FROM Boing b WHERE
> b.name=?", new Object[] { name });
>
>
> I think this stuff can be usefull for JDBC developers.

I agree. Some legacy code at my company has the same concepts but is then
implemented irritatingly [all the handlers are anonymous inner classes of
one huge file].

Are you able to submit/commit your Handler system?

Hen


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


Mime
View raw message