RE : Re: Reuse of statement in an other statement

View: New views
2 Messages — Rating Filter:   Alert me  

RE : Re: Reuse of statement in an other statement

by Régis BRULEY :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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" <mmccurrey@...> 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 <regis@...> 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

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <regis@...> 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" <mmccurrey@...> 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 <regis@...> wrote: > > Hi, > > It's my first...




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