>From what I see in JIRA IBATIS-316, this could constitute a test example 
>(incomplete for now).

Original information from JIRA:
<parameterMap id="sample" class="map">
<parameter property="id" jdbcType="VARCHAR" javaType="java.lang.String" 
mode="IN" />
<parameter property="sampleArray" typeName="SAMPLE_ARRAY" jdbcType="ARRAY" 
mode="OUT" />
</parameterMap>

<!-- Calling the Stored procedure -->
<procedure id="sample_proc" parameterMap="sample" >
{ call sample$pack.sample_proc( ?,? ) }
</procedure> 


Modification (just added a double dollar sign):
<parameterMap id="sample" class="map">
<parameter property="id" jdbcType="VARCHAR" javaType="java.lang.String" 
mode="IN" />
<parameter property="sampleArray" typeName="SAMPLE_ARRAY" jdbcType="ARRAY" 
mode="OUT" />
</parameterMap>

<!-- Calling the Stored procedure -->
<procedure id="sample_proc" parameterMap="sample" >
{ call sample$$pack.sample_proc( ?,? ) }
</procedure> 


I'm not sure this is a potential problem for nested iterates (or a bug 
exclusively about dollar signs), but it was talked about in the user mailing.
Someone wanted to put a dollar sign in his SQL Request, and Clinton Begin told 
him he could by doubling the dollar sign.
Clinton Begin said : 1) As for the $, Niels posted the wiki page which 
documents this.  Simply double up the $$ to escape it.

When you look at my correction about nested iterates in DynamicSql class, I 
guess this could cause a problem when it gets interpretted.
Part of DynamicSql class:
  /**
  * @param bodyContent
  * @param iterate
  */
  protected void iteratePropertyReplace(StringBuffer bodyContent, 
IterateContext iterate) {
    if(iterate!=null) {
      String[] mappings = new String[] {"#", "$"};  // Where dollar sign is 
checked!
      for (int i = 0; i < mappings.length; i++) {
          int startIndex = 0;
          int endIndex = -1;
          while (startIndex > -1 && startIndex < bodyContent.length()) {
              startIndex = bodyContent.indexOf(mappings[i], endIndex + 1);
              endIndex = bodyContent.indexOf(mappings[i], startIndex + 1);
              if (startIndex > -1 && endIndex > -1) {
                  bodyContent.replace(startIndex + 1, endIndex, 
iterate.addIndexToTagProperty(bodyContent.substring(startIndex + 1, endIndex)));
              }
          }
      }
    }
  }

We should make sure that doubling the dollar sign will not cause problems in 
our previous correction.

Christian

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Meadors
Sent: Thursday, 06 July 2006 19:43
To: dev@ibatis.apache.org
Subject: Re: Double $ sign

Do have an example?

On 7/6/06, Poitras Christian <[EMAIL PROTECTED]> wrote:
>
>
> Hi Jeff.
>
> I read the problem submitted in user list about this issue : using '$'
> character in package name.
> I wonder if double $ sign can cause problems with nested iterate tags.
>
> Can you take a look at this?
>
> Christian Poitras
> Institut de recherches cliniques de Montréal (IRCM) 
> [EMAIL PROTECTED]
>

Reply via email to