ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: is this possible?
Date Mon, 30 May 2005 05:04:21 GMT
Did you try it?

On 5/29/05, Rob Butler <crodster2k@yahoo.com> 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
>

Mime
View raw message