Yes, it should work, as long as you get the SQL template around all
the iterations correct.

Larry


On 5/29/05, Rob Butler <[EMAIL PROTECTED]> wrote:
> Not yet.  It seemed a little "out there" that it would
> work.  So I thought I would ask.  Someone who really
> knows the internals of iBatis would be able to say
> yes/no right off.
> 
> Rob
> 
> --- Larry Meadors <[EMAIL PROTECTED]> wrote:
> > Did you try it?
> >
> > On 5/29/05, Rob Butler <[EMAIL PROTECTED]> wrote:
> > > I want to create a statement that performs inserts
> > (or
> > > updates, or creates tables) that can have the
> > table
> > > name as well as the number and type of the columns
> > > determined at run time.
> > >
> > > Assume a Map has two entries, tableName and
> > records.
> > > Records is a List of record objects.  Record
> > objects
> > > have 3 values, fieldName, value and type.
> > fieldName
> > > is the name of the column, and type is the JDBC
> > type
> > > of the column.  Value is always either a Date,
> > Integer
> > > (object, not primative), Long (object, not
> > primative)
> > > or String.
> > >
> > > So assuming everything above, would the sqlMap
> > segment
> > > below work?
> > >
> > > <insert id="insertRecord"
> > > parameterClass="java.util.Map">
> > >    insert into $tableName$
> > >      <iterate open="(" close=")" conjunction=", ">
> > >        $records[].fieldName$
> > >      </iterate>
> > >    values
> > >      <iterate open="(" close=")" conjunction=", ">
> > >        #records[].value#:$records[].type$
> > >      </iterate>
> > > </insert>
> > >
> > > Thanks!
> > > Rob
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > >
> >
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new Resources site
> http://smallbusiness.yahoo.com/resources/
>

Reply via email to