You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Régis BRULEY <re...@bruley.org> on 2009/07/10 18:57:31 UTC

RE : Re: Reuse of statement in an other statement

Hi,

Test that's help. I saw this "include". But can i pass a parameter in it ?
It seems note working...

Thanks again

Régis

Le 10 juil. 2009, 6:09 PM, "Michael McCurrey" <mm...@gmail.com> a
écrit :

You can, but not directly in how you have it.

IBatis includes a feature called fragements.  In your map file, put your
*core* sql in a statement such as
    <sql id="Fragment">
      insert something
    </sql>

Then down in your real insert statement reference it as such:
    <insert id="test">
      <include refid="Fragment"></include>
    </insert>

Does this help?

On Fri, Jul 10, 2009 at 8:19 AM, Régis BRULEY <re...@bruley.org> wrote: > >
Hi, > > It's my first...
-- 
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

Re: RE : Re: Reuse of statement in an other statement

Posted by Michael McCurrey <mm...@gmail.com>.
You can't have your statement pass a dynamic parameter to that; however, you
can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1)
values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <re...@bruley.org> wrote:

> Hi,
>
> Test that's help. I saw this "include". But can i pass a parameter in it ?
> It seems note working...
>
> Thanks again
>
> Régis
>
> Le 10 juil. 2009, 6:09 PM, "Michael McCurrey" <mm...@gmail.com> a
> écrit :
>
> You can, but not directly in how you have it.
>
> IBatis includes a feature called fragements.  In your map file, put your
> *core* sql in a statement such as
>     <sql id="Fragment">
>       insert something
>     </sql>
>
> Then down in your real insert statement reference it as such:
>     <insert id="test">
>       <include refid="Fragment"></include>
>     </insert>
>
> Does this help?
>
> On Fri, Jul 10, 2009 at 8:19 AM, Régis BRULEY <re...@bruley.org> wrote: >
> > Hi, > > It's my first...
> --
> Michael J. McCurrey
> Read with me at http://www.mccurrey.com
> http://chaoticmindramblings.blogspot.com/
>
>


-- 
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/