Recursive inclusions don't expand
---------------------------------

         Key: IBATIS-64
         URL: http://issues.apache.org/jira/browse/IBATIS-64
     Project: iBatis for Java
        Type: Bug
  Components: SQL Maps  
    Versions: 2.0.9    
    Reporter: Rohan Lenard


Given the documentation doesn't mention this it is hard to know what is correct.

I have an SQL Map like this 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-2.dtd";>

<sqlMap>

    <select id="getFrequencyTableData" parameterClass="java.util.Map" 
resultMap="frequency-table-result">
        SELECT sum(a) as a FROM tablea
        <dynamic prepend="WHERE">
$consolidationLevelClause$
                AND
                (
                    ( consolidation = #consolidationValues__0#
                        <isPropertyAvailable property="startValues__0"> AND 
start &lt; #startValues__0#
                        </isPropertyAvailable>
                     )
                    <isPropertyAvailable property="consolidationValues__1">
                        OR
                        ( consolidation = #consolidationValues__1# AND start 
&gt;= #startValues__1#
                        <isPropertyAvailable property="startValues__2">
                            AND start &lt; #startValues__2#
                        </isPropertyAvailable>
                        )
                        <isPropertyAvailable property="consolidationValues__2">
                           OR ( consolidation = #consolidationValues__2# AND 
start &gt;= #startValues__3#
                           <isPropertyAvailable property="startValues__4">
                               AND start
                               &lt; #startValues__4#
                           </isPropertyAvailable> )
                       </isPropertyAvailable>
                        <!-- This should never happen - but it's a good test -->
                        <isPropertyAvailable property="consolidationValues__3">
                            OR ( consolidation = #consolidationValues__3# AND 
start &gt;= #startValues__5#
                            <isPropertyAvailable property="startValues__6">
                                AND start
                                &lt; #startValues__6#
                            </isPropertyAvailable> )
                        </isPropertyAvailable>
                    </isPropertyAvailable>
                )
            </isNotNull>

            <!-- select endpoints -->
            <isNotNull property="haveEndpoints">
                AND (
                <isNotNull property="ep1_to_ep2">
                    ( <!-- handle EP1->EP2 direction -->
                    direction = 'EP1->EP2' AND epPairDefnId IN
                    <iterate property="ep1_to_ep2" open="(" close=")" 
conjunction=", ">
                        #ep1_to_ep2[]#
                    </iterate>
                    )
                    <isNotNull property="ep2_to_ep1">
                        OR
                    </isNotNull>
                </isNotNull>
                <isNotNull property="ep2_to_ep1">
                    ( <!-- handle EP2->EP1 direction -->
                        direction = 'EP2->EP1' AND epPairDefnId IN
                        <iterate property="ep2_to_ep1" open="(" close=")" 
conjunction=", ">
                        #ep2_to_ep1[]#
                    </iterate>
                    )
                </isNotNull>
                )
            </isNotNull>

            <isNotNull property="timeRestrictFrom">
                AND ( $timeRestrictStartField$ >= #timeRestrictStartValue# )
            </isNotNull>
            <isNotNull property="timeRestrictTo">
                AND ( $timeRestrictEndField$ &lt;= #timeRestrictEndValue# )
            </isNotNull>
            <isNotNull property="timeRestrictBetween">
                AND ( $timeRestrictStartField$ >= #timeRestrictStartValue#
                AND $timeRestrictEndField$ &lt;= #timeRestrictEndValue# )
            </isNotNull>
            <isNotNull property="timeRestrictOnly">
                AND ( $timeRestrictStartField$ = #timeRestrictStartValue#
                AND $timeRestrictEndField$ = #timeRestrictStartValue# )
            </isNotNull>

            <isNotNull property="timePeriodClause">
                AND $timePeriodClause$
            </isNotNull>
        </dynamic>

        GROUP BY
        <isNotNull property="timeChunkClause">
            begin,
        </isNotNull>
            <!-- Note: upperlimit is "strictly" required - but not by MYSQL - 
for HSQLDB and probably other DBs -->
            lowerlimit, upperlimit
    </select>
</sqlMap>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to