You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Kunle Gbadamosi <kg...@gmail.com> on 2009/09/04 00:35:01 UTC

Dynamic (Evaluated) Prepend

Hi there,

I have a situation where I need to dynamically determine my prepend value
(which could be AND or OR). 

Here's a quick sample - 

<dynamic open="(" close=")">
   <isNotEmpty property="A" prepend="$logicOperator$">A = #A#</isNotEmpty>
   <isNotEmpty property="B" prepend="$logicOperator$">B = #B#</isNotEmpty>
</dynamic>


Looking at the snippet, I want to pass the value of the prepend using
$logicOperator$. And I want the first Prepend to be removed. Is there a way
I can I go about this ?

Thanks,
Kunle
-- 
View this message in context: http://www.nabble.com/Dynamic-%28Evaluated%29-Prepend-tp25285320p25285320.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: Dynamic (Evaluated) Prepend

Posted by meindert <me...@eduflex.com>.
I personally never trusted the dynamic prepend, so my solution would be to
avoid it;
WHERE 1=1 AND
<dynamic open="(" close=")">
   <isNotEmpty property="A"> $logicOperator$ A = #A#</isNotEmpty>
   <isNotEmpty property="B"> $logicOperator$ B = #B#</isNotEmpty>
</dynamic>

-----Original Message-----
From: Kunle Gbadamosi [mailto:kgbadamosi@gmail.com] 
Sent: 04 September 2009 12:35 AM
To: user-java@ibatis.apache.org
Subject: Dynamic (Evaluated) Prepend


Hi there,

I have a situation where I need to dynamically determine my prepend value
(which could be AND or OR). 

Here's a quick sample - 

<dynamic open="(" close=")">
   <isNotEmpty property="A" prepend="$logicOperator$">A = #A#</isNotEmpty>
   <isNotEmpty property="B" prepend="$logicOperator$">B = #B#</isNotEmpty>
</dynamic>


Looking at the snippet, I want to pass the value of the prepend using
$logicOperator$. And I want the first Prepend to be removed. Is there a way
I can I go about this ?

Thanks,
Kunle
-- 
View this message in context:
http://www.nabble.com/Dynamic-%28Evaluated%29-Prepend-tp25285320p25285320.ht
ml
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.409 / Virus Database: 270.13.76/2344 - Release Date: 09/03/09
18:05:00


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Dynamic (Evaluated) Prepend

Posted by Kunle Gbadamosi <kg...@gmail.com>.
Thanks Meindert.

One more question - Is it possible to have a global include ?

My sql-maps are separated into 3 xml files, each with its own namespace.

<sqlMap namespace="A">
<sqlMap namespace="B">
<sqlMap namespace="C">


Now, I have a common <sql> fragment that I would like to use in each of
them. Is there a way to separate this fragment, and include it in each of my
maps ?


Thanks,
Kunle.






Kunle Gbadamosi wrote:
> 
> Hi there,
> 
> I have a situation where I need to dynamically determine my prepend value
> (which could be AND or OR). 
> 
> Here's a quick sample - 
> 
> <dynamic open="(" close=")">
>    <isNotEmpty property="A" prepend="$logicOperator$">A = #A#</isNotEmpty>
>    <isNotEmpty property="B" prepend="$logicOperator$">B = #B#</isNotEmpty>
> </dynamic>
> 
> 
> Looking at the snippet, I want to pass the value of the prepend using
> $logicOperator$. And I want the first Prepend to be removed. Is there a
> way I can I go about this ?
> 
> Thanks,
> Kunle
> 

-- 
View this message in context: http://www.nabble.com/Dynamic-%28Evaluated%29-Prepend-tp25285320p25311765.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org