|
From: Rod J. <rod...@in...> - 2004-02-20 07:11:46
|
I'm in favour of a new execute(String) method. I think the name change for
the existing method is fine.
----- Original Message -----
From: "Thomas Risberg" <tri...@tr...>
To: <spr...@li...>
Sent: Friday, February 20, 2004 4:59 AM
Subject: [Springframework-developer] Add execute(sql) method to
JdbcTemplate?
> I like the new convenience methods we added to JdbcTemplate, but there
> is still one missing. I would like to add a simple "void execute(String
> sql) method that simply creates a statement and executes the sql. No
> return values, prepared statements or parameters, just a plain execute.
> It would be nice for something like the following:
>
> JdbcTemplate jt = new JdbcTemplate(dataSource);
> jt.execute("drop table spring_test");
> jt.execute("create table spring_test (id integer, name
> varchar(100))");
> jt.update("insert into spring_test (id, name) values (?, ?)",
> new Object[] {new Integer(1), "Marc"});
> jt.update("insert into spring_test (id, name) values (?, ?)",
> new Object[] {new Integer(2), "Bill"});
> List l = jt.queryForList("select * from spring_test");
> System.out.println(l);
>
> I could use an update(sql) for the DDL statements, but they are not
> update statements, so I would prefer the execute name and also bypassing
> the prepared statement - no reason to prepare a statement for a one off
> statement without bind variables.
>
> The only problem is that we have another execute method that is used by
> the StoredProcedure for running a CallableStatement. We could rename
> that one to call() or executeCall(). I don't think anybody is using
> this method directly, so the impact on existing code would be low.
>
> What do you all think?
>
> Thomas
>
>
>
> -------------------------------------------------------
> 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
>
|