-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
enhancementImprove a feature or add a new featureImprove a feature or add a new feature
Milestone
Description
Current implementation of SQL fragment include replaces placeholders only in text nodes of XML. If placeholder is placed for example in "test" attribute of "if" it is not replaced. It looks like a bug in the implementation which scans only "child" nodes but it had "attribute" branch too which has not been ever used.
Example usage:
<sql id="select-part">
SELECT d.field1, d.field2, ..., d.fieldN
<if test="${source} == 'active'">
, null AS archivedDate
FROM active_table d
</if>
<if test="${source} == 'archive'">
, d.achived AS archivedDate
FROM archive_table d
</if>
LEFT JOIN ...
ORDER BY ...
</sql>
<select id="fetchData" resultMap="Data">
<include refid="select-part">
<property name="source" value="active"/>
</include>
UNION ALL
<include refid="select-part">
<property name="source" value="archive"/>
</include>
</select>(example taken from original question on StackOverflow)
Metadata
Metadata
Assignees
Labels
enhancementImprove a feature or add a new featureImprove a feature or add a new feature