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 Ted Schrader <TS...@sgi-net.com> on 2006/01/26 20:26:52 UTC

Request for examples of remapResults

Hello,

 

I've Googled "remapResults" to get an idea of what this attribute does.
The search results have been a bit sparse and I don't think I understand
it completely.

 

Would anyone be so kind as to provide some examples of when I should use
it and why?  Better yet, perhaps this would be an excellent addition to
the FAQ section of the SqlMaps wiki.

 

Thanks!

 

Ted

 

 


Re: Request for examples of remapResults

Posted by Jeff Butler <je...@gmail.com>.
Here's a quick answer...

You should use remapResults when a query has a variable set of return
columns.  For example, if I say:

    select $fieldList$
    from table

or

    select *
    from $someTable$

Since the overhead to introspect the result set metadata is not trivial,
iBATIS will remember what was returned the last time the query was run.
This could create problems in these situations.

Without remapResults: If I set fieldList = 'fld1, fld2' the first time,
iBATIS will think that fld1 and fld2 are in the result set for the query
every time I run it.  So if the next time I run the query I specify
fieldList='fld3, fld4', iBATIS will not find fld1 and fld2 in the result
set, and will not return the proper results.  And iBATIS won't know about
fld3 and fld4 because they weren't in the query the first time it was run.

With remapResults: iBATIS will introspect the result set metadata every time
the query is run and will always return the proper results.

This feature comes at some performance cost, so only use it if you really
need it - when there is a variable set of returned columns (or if there is a
variable table name, etc.)

HTH -
Jeff Butler



On 1/26/06, Ted Schrader <TS...@sgi-net.com> wrote:
>
>  Hello,
>
>
>
> I've Googled "remapResults" to get an idea of what this attribute does.
> The search results have been a bit sparse and I don't think I understand it
> completely.
>
>
>
> Would anyone be so kind as to provide some examples of when I should use
> it and why?  Better yet, perhaps this would be an excellent addition to the
> FAQ section of the SqlMaps wiki.
>
>
>
> Thanks!
>
>
>
> Ted
>
>
>
>
>