It is not good idea to have more than one statement.

As I know, IBATIS uses PreaparedStatements for at least insert/update statements and

in JDBC API it is written that PreaparedStatements works with only one statement (see java.sql.Connection#prepareStatement).

 

Maybe it will work if your driver supports such kind of things but I don’t thing so J

 

Best,

Aram


From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 24, 2006 12:52 AM
To: [email protected]
Subject: Re: dynamic script's

 

The answer is yes - if the driver supports it.  If your driver supports multiple SQL statements in a single prepared statement, then you can do it.  iBATIS doesn't to anything to support or deny this function - it's totally dependant on the driver support.  iBATIS will only prepare one statement.

 

In my opinion, this is a bad idea even if the driver supports it.  I think it's better to start a transaction and make multiple calls to the different insert statements.  More portable, and probably more maintainable.

 

Jeff Butler



 

On 8/23/06, Daniel Pitts <[EMAIL PROTECTED]> wrote:

Is there a way to run an SQL "script" from iBATIS?
Such as:
INSERT INTO foo (#bar#, #baz#);
INSERT INTO ho (#hum#);


Also, if there is, is it possible to dynamically generate the SQL to do
so?
Eg:
INSERT INTO foo (#bar#, #baz#);
<iterate property="hos">INSERT INTO ho (#bar#, #hos[]#);</iterate>

Thanks.


 

Reply via email to