Skip to content

Commit 260abff

Browse files
committed
Documentation updated for parametrized include
1 parent 7d95da4 commit 260abff

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/site/xdoc/sqlmap-xml.xml

100644100755
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,18 +485,19 @@ ps.setInt(1,id);]]></source>
485485
<subsection name="sql">
486486
<p>
487487
This element can be used to define a reusable fragment of SQL code that can be
488-
included in other statements. For example:
488+
included in other statements. It can be statically (during load phase) parametrized and also included many time
489+
with different property values. For example:
489490
</p>
490491

491-
<source><![CDATA[<sql id="userColumns"> id,username,password </sql>]]></source>
492+
<source><![CDATA[<sql id="userColumns"> ${alias}.id,${alias}.username,${alias}.password </sql>]]></source>
492493

493494
<p>
494495
The SQL fragment can then be included in another statement, for example:
495496
</p>
496497

497498
<source><![CDATA[<select id="selectUsers" resultType="map">
498-
select <include refid="userColumns"/>
499-
from some_table
499+
select <include refid="userColumns"><property name="alias" value="t"/></include>
500+
from some_table t
500501
where id = #{id}
501502
</select>]]></source>
502503
</subsection>

0 commit comments

Comments
 (0)