ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nguyen, Tom" <Tom.Ngu...@rels.info>
Subject RE: efficient management of comma in dynamic statement
Date Wed, 29 Nov 2006 22:25:00 GMT
Well, if you have a modification date/author column then it's easier...

 

UPDATE PRODUIT

SET LastModifedDate = getdate()

<dynamic>

   <isGreaterEqual property="IdCategory" compareValue="0">

      , idCat = #IdCategory#

   </isGreaterEqual>

</dynamic>

WHERE idProduit = #IdProduit#


Regards,

Tom Nguyen

 

________________________________

From: Tite Etoundi [mailto:etoundiaboa@yahoo.fr] 
Sent: Wednesday, November 29, 2006 4:09 PM
To: user-cs@ibatis.apache.org
Subject: efficient management of comma in dynamic statement

 

Hi,

 

Plz do anybody could help me how can I manage comma in statement as the follow:

 

 <update id="UpdateProduct" parameterClass="ProduitVOType" >
      UPDATE PRODUIT SET

      <dynamic>
            <isGreaterEqual property="IdCategory" compareValue="0">
              idCat = #IdCategory#
            </isGreaterEqual>
            
            <isNotNull property="CaractTechniques" prepend=",">
              caracteristiquesTech = #CaractTechniques#
            </isNotNull>
            
            <isNotEmpty property="DescriptionDetaillee" prepend=",">

              descDetaillee = #DescriptionDetaillee#
            </isNotEmpty>      
            
            <isNotEmpty property="ImageBasePath" prepend=",">
              imageBasePath = #ImageBasePath#
            </isNotEmpty>

            <isNotEmpty property="NomProduit" prepend=",">
              name = #NomProduit#
            </isNotEmpty>

            <isGreaterEqual property="QteEnStock" compareValue="0" prepend=",">
              qteEnStock = #QteEnStock#
            </isGreaterEqual>

      </dynamic>
      
      WHERE idProduit = #IdProduit#
    </update>

 

For example when QteEnStock = -1 or IdCategory = -1, I get the following exception {"Line
1: Incorrect syntax near ','."}

 

There could be a lot of cases as this one in this statement.

 

Could somebody help me?

 

Thanks.



------------------------------------------
Etoundi Aboa Tite E.
Ingénieur Polytechnicien
Maître ès Science Informatique
Concepteur de Solutions Mobiles
Développeur d'applications SimToolKit
Tel: 935 60 14
------------------------------------------

  

________________________________

Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail <http://fr.rd.yahoo.com/evt=40577/*http:/fr.promotions.yahoo.com/mail/nouveaumail.html%20%0d%0a>
 et son interface révolutionnaire. 


************************************************************************************
This e-mail message and any files transmitted herewith, are intended solely for the
use of the individual(s) addressed and may contain confidential, proprietary or 
privileged information.  If you are not the addressee indicated in this message 
(or responsible for delivery of this message to such person) you may not review, 
use, disclose or distribute this message or any files transmitted herewith.  If you 
receive this message in error, please contact the sender by reply e-mail and delete
this message and all copies of it from your system.
************************************************************************************

Mime
View raw message