I think I like the idea of the new token.  There have been list threads
before where accessing properties at map build would have been very
convenient.  This would be especially great for DB Trash (to reference a
thread from the past):

http://www.mail-archive.com/dev@ibatis.apache.org/msg01907.html

The only drawback I can think of is that it could be confusing and would
need to be very carefully documented.

But my question is a bit different - can we use the execution time string
replacement to build dynamic prepared statement parameters?  If the string
replacement routines run before the prepared statement routines then it
should work.  To use your new syntax:

#{myProperty,typehandl...@{mytypehandler}}

"myProperty" and "myTypeHandler" would both be attributes of a parameter
object.

The JIRA ticket has another request: @{queryString} where "queryString" is
"where somecolumn = #{myProperty}".  This would work too as long as the
runtime string replacement runs before looking for prepared statement
parameters.


Jeff Butler


On Tue, Jun 2, 2009 at 4:20 PM, Clinton Begin <clinton.be...@gmail.com>wrote:

> That was a challenge i had... Unfortunately, it will be parsed at statement
> execution time as a string replacement, not at map build time with the
> passed in properties.  It's an inconsistency... :-/
> In Statements:
>     #{}  == Prepared Statement Parameter
>     ${}  == String replacement at execution time for statements
>
> In Element Attributes:
>     <node attr="${value}"> will be replaced at map build time, using the
> properties as values...
>
> To separate the concepts, we'd have to introduce another token, perhaps
>     ${}  == Replaced at map build time, using the properties as values
> (consistent with element/attribute)
>     #{}  == Prepared Statement Parameter
>     @{} == String replacement at execution time for statements
>
> It might not be hard to change that, I think it's in one place in the
> code.
>
> Clinton
>
> On Tue, Jun 2, 2009 at 1:22 PM, Jeff Butler <jeffgbut...@gmail.com> wrote:
>
>> Hi Clinton,
>>
>> Sorry to ask without trying it, call me lazy...
>>
>> Can we do something like this:
>>
>> #{myProperty,typeHandler=${myTypeHandler}}
>>
>> In other words, does the string replacement parse run before the parameter
>> parse?
>>
>> This would simplify things for Ibator, but is also similar to an open
>> request with iBATIS 2 - http://issues.apache.org/jira/browse/IBATIS-599
>>
>>
>> Thanks!
>> Jeff Butler
>>
>>
>

Reply via email to