|
From: <tri...@tr...> - 2004-02-16 17:30:40
|
I can see the need to go beyond a single row/value type query.
How about a new method for the JdbcTemplate:
Object runSqlStatement(String)
Based on the type of SQL passed in it would return:
1) An Integer containing the number of rows affected if it is an update statement
runSqlStatement("update emp set salary = salary * 1.5") would return an Integer
with the update count
2) A single Object (Integer/Long/String) based on the value returned from a
single value/single row query
runSqlStatement("select last_name frmo emp where id = 2") would return a String
containing the last name
3) An ArrayList of ArrayLists containing a list of rows with a list of column
values returned by the query
runSqlStatement("selecy id, last_name from emp") would return an ArrayList
containing an ArrayList for each row. The second list would contain an Integer
with the id and a String with the last_name.
Number 3 might be a stretch, but we would still have to check for this, since we
have no control over the SQL coming in.
Thomas
Quoting rod...@in...:
> I've actually just (yesterday) introduced into into a whole
> bunch of test cases at a client. Maybe we could put an
> improved runSQLFunction() method on JdbcTemplate? This is a
> very convenient one-liner, and basically the only reason I
> use JdbcTemplate.
>
> Regards,
> Rod
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
|