<xsl:if test="position() != 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="name(.)"/>
</xsl:template>
<!--
Template:match="*" mode="value"
Programmer:Edmond Woychowsky
Purpose:The purpose of this template is to list the column values.
Update Date:Programmer:Description:
-->
<xsl:template match="*" mode="value">
<xsl:variable name="text">
<xsl:call-template name="in">
<xsl:with-param name="list" select="$textColumns"/>
<xsl:with-param name="value" select="name(.)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="date">
<xsl:call-template name="in">
<xsl:with-param name="list" select="$dateColumns"/>
<xsl:with-param name="value" select="name(.)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="position() != 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="$text = 'true'">
<xsl:text>'</xsl:text>
<xsl:call-template name="sqlApostrophe">
<xsl:with-param name="string" select="."/>
</xsl:call-template>
<xsl:text>'</xsl:text>
</xsl:when>
<xsl:when test="$date = 'true'">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
结论
过去几年来,我一直在使用这种,或与它类似的方法,都取得了很好的效果。尽管从SQL角度看,它的执行速度比不上比更常见的建立SQL的字符串串联方法提供更好结果的存储过程。我还想指出的是,我说过我使用这个或与它类似的方法,基本只增加了commit和rollback语句来处理错误。不过,这些修改仅仅是个人尝试和个人偏执行为。
评论加载中…
![]() |