ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mkhitaryan, Aram" <Aram.Mkhitar...@lycos-europe.com>
Subject RE: dynamic script's
Date Thu, 24 Aug 2006 07:25:14 GMT
Yeah, it would be nice to have such a feature!





From: Daniel Pitts [mailto:Daniel.Pitts@cnet.com] 
Sent: Thursday, August 24, 2006 1:03 AM
To: user-java@ibatis.apache.org
Subject: RE: dynamic script's



It might be nice to have some sort of scripting support though. Where you can at least chain
operations together. Maybe something like:


<batchTransaction id="deepInsertPost" parameterClass="map">

    <call insert="insertPost"/>

    <iterator property="postData.authors">

    <call insert="insertAuthorMap"/>




<insert id="insertAuthorMap">

   INSERT INTO authorMap (#post.id#, #authors[].id#)



I certainly could write this in java, but it seems generic enough that it might be nice to
support it at this level.


From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Wednesday, August 23, 2006 12:52 PM
To: user-java@ibatis.apache.org
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 <Daniel.Pitts@cnet.com> 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
INSERT INTO foo (#bar#, #baz#);
<iterate property="hos">INSERT INTO ho (#bar#, #hos[]#);</iterate> 



View raw message