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 Abdullah Kauchali <ab...@isanusi.com> on 2005/08/03 12:06:46 UTC

Dynamic Prepend and removal of "beginning" prepends

<insert id="create" parameterClass="DirectoryTypeBean">
 
INSERT INTO SEC_DirectoryType (
   
    <dynamic prepend="">        
        <isNotEmpty prepend="," property="directoryType_Code">
            DirectoryType_Code
        </isNotEmpty>
        <isNotEmpty prepend="," property="directoryType_ConnectionFactory">
            DirectoryType_ConnectionFactory
        </isNotEmpty>
        <isNotEmpty prepend="," property="directoryType_JavaApiValues">
            DirectoryType_JavaApiValues
        </isNotEmpty>
        <isNotEmpty prepend="," property="directoryType_DotNetApiValues">
            DirectoryType_DotNetApiValues
        </isNotEmpty>
 
        .....
 
 </dynamic>


I get incorrect SQL syntax when the first value is empty - iow:  there 
is a comma before the first column.

INSERT INTO SEC_DirectoryType (    ,   DirectoryType_ConnectionFactory ....

What do I do to get rid of the first comma?

TIA,

Kind regards

Abdullah

Re: [SOLVED]: Dynamic Prepend and removal of "beginning" prepends

Posted by Brandon Goodin <br...@gmail.com>.
the removeFirstPrepend is in the documentation. But! someone forgot to
release the updated docs with the last release... hmmmmm. We need to
release the latest version of the PDFs.

Brandon

On 8/4/05, Nathan Maves <Na...@sun.com> wrote:
> Abdullah,
> 
> Can you send me the full sql map of the now working code?
> 
> I can try and get something on the wiki today.
> 
> Nathan
> 
> 
> On Aug 3, 2005, at 12:11 PM, Larry Meadors wrote:
> Yeah, the wiki is where we try to consolidate the "a-hah!" stuff like this.
> ;-)
>  
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home
>  
>  Larry
>  
> 
> On 8/3/05, Abdullah Kauchali <ab...@isanusi.com> wrote:
> >
> http://www.mail-archive.com/ibatis-dev@incubator.apache.org/msg00702.html
> > 
> > (Is the wiki a different thing (tm) altogether?)
> > 
> > Larry Meadors wrote:
> > 
> > > Can you find a home for that gem on the wiki?
> > >
> > > On 8/3/05, *Abdullah Kauchali* <abdullah.kauchali@isanusi.com
> > > <mailto: abdullah.kauchali@isanusi.com>> wrote:
> > >
> > >     Ok, found an answer from the archives:
> > >
> > >     I need to sandwitch everything within the dynamic tag with this: 
> > >
> > >             <isParameterPresent removeFirstPrepend="true">
> > >     ...
> > >
> > >              </isParameterPresent>
> > >
> > >     This feature definitely needs to be documented.
> > >
> > >
> > 
> 
> 
>

Re: [SOLVED]: Dynamic Prepend and removal of "beginning" prepends

Posted by Nathan Maves <Na...@Sun.COM>.
Abdullah,

Can you send me the full sql map of the now working code?

I can try and get something on the wiki today.

Nathan

On Aug 3, 2005, at 12:11 PM, Larry Meadors wrote:

> Yeah, the wiki is where we try to consolidate the "a-hah!" stuff  
> like this. ;-)
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home
>
> Larry
>
>
> On 8/3/05, Abdullah Kauchali <ab...@isanusi.com> wrote:
> http://www.mail-archive.com/ibatis-dev@incubator.apache.org/ 
> msg00702.html
>
> (Is the wiki a different thing (tm) altogether?)
>
> Larry Meadors wrote:
>
> > Can you find a home for that gem on the wiki?
> >
> > On 8/3/05, *Abdullah Kauchali* <abdullah.kauchali@isanusi.com
> > <mailto: abdullah.kauchali@isanusi.com>> wrote:
> >
> >     Ok, found an answer from the archives:
> >
> >     I need to sandwitch everything within the dynamic tag with this:
> >
> >             <isParameterPresent removeFirstPrepend="true">
> >     ...
> >
> >              </isParameterPresent>
> >
> >     This feature definitely needs to be documented.
> >
> >
>


Re: [SOLVED]: Dynamic Prepend and removal of "beginning" prepends

Posted by Larry Meadors <la...@gmail.com>.
Yeah, the wiki is where we try to consolidate the "a-hah!" stuff like this. 
;-)

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home

Larry


On 8/3/05, Abdullah Kauchali <ab...@isanusi.com> wrote:
> 
> http://www.mail-archive.com/ibatis-dev@incubator.apache.org/msg00702.html
> 
> (Is the wiki a different thing (tm) altogether?)
> 
> Larry Meadors wrote:
> 
> > Can you find a home for that gem on the wiki?
> >
> > On 8/3/05, *Abdullah Kauchali* <abdullah.kauchali@isanusi.com
> > <ma...@isanusi.com>> wrote:
> >
> > Ok, found an answer from the archives:
> >
> > I need to sandwitch everything within the dynamic tag with this:
> >
> > <isParameterPresent removeFirstPrepend="true">
> > ...
> >
> > </isParameterPresent>
> >
> > This feature definitely needs to be documented.
> >
> >
>

Re: [SOLVED]: Dynamic Prepend and removal of "beginning" prepends

Posted by Abdullah Kauchali <ab...@isanusi.com>.
http://www.mail-archive.com/ibatis-dev@incubator.apache.org/msg00702.html

(Is the wiki a different thing (tm) altogether?)

Larry Meadors wrote:

> Can you find a home for that gem on the wiki?
>
> On 8/3/05, *Abdullah Kauchali* <abdullah.kauchali@isanusi.com 
> <ma...@isanusi.com>> wrote:
>
>     Ok, found an answer from the archives:
>
>     I need to sandwitch everything within the dynamic tag with this:
>
>             <isParameterPresent removeFirstPrepend="true">
>     ...
>
>              </isParameterPresent>
>
>     This feature definitely needs to be documented.
>
>

Re: [SOLVED]: Dynamic Prepend and removal of "beginning" prepends

Posted by Larry Meadors <la...@gmail.com>.
Can you find a home for that gem on the wiki?

On 8/3/05, Abdullah Kauchali <ab...@isanusi.com> wrote:
> 
> Ok, found an answer from the archives:
> 
> I need to sandwitch everything within the dynamic tag with this:
> 
> <isParameterPresent removeFirstPrepend="true">
> ...
> 
> </isParameterPresent>
> 
> This feature definitely needs to be documented.
> 
>

[SOLVED]: Dynamic Prepend and removal of "beginning" prepends

Posted by Abdullah Kauchali <ab...@isanusi.com>.
Ok, found an answer from the archives:

I need to sandwitch everything within the dynamic tag with this:

        <isParameterPresent removeFirstPrepend="true">
...

         </isParameterPresent>

This feature definitely needs to be documented.

Cheers

Abdullah


Abdullah Kauchali wrote:

> <insert id="create" parameterClass="DirectoryTypeBean">
>
> INSERT INTO SEC_DirectoryType (
>      <dynamic prepend="">               <isNotEmpty prepend="," 
> property="directoryType_Code">
>            DirectoryType_Code
>        </isNotEmpty>
>        <isNotEmpty prepend="," 
> property="directoryType_ConnectionFactory">
>            DirectoryType_ConnectionFactory
>        </isNotEmpty>
>        <isNotEmpty prepend="," property="directoryType_JavaApiValues">
>            DirectoryType_JavaApiValues
>        </isNotEmpty>
>        <isNotEmpty prepend="," property="directoryType_DotNetApiValues">
>            DirectoryType_DotNetApiValues
>        </isNotEmpty>
>
>        .....
>
> </dynamic>
>
>
> I get incorrect SQL syntax when the first value is empty - iow:  there 
> is a comma before the first column.
>
> INSERT INTO SEC_DirectoryType (    ,   DirectoryType_ConnectionFactory 
> ....
>
> What do I do to get rid of the first comma?
>
> TIA,
>
> Kind regards
>
> Abdullah
>