首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

ibatis中使用like时怎么避过sql注入

2012-08-29 
ibatis中使用like时如何避过sql注入普通的拼写方式为:if testremark ! null and remark ! and re

ibatis中使用like时如何避过sql注入
普通的拼写方式为:
<if test="remark != null and remark != ''">and remark like '%'+#{remark}+'%'</if>

如果遇到变量名刚好是数据库的关键字,拼写方式如下所示:
<if test="action != null and action != ''">
   <![CDATA[ 
     and action like '%'+#{action}+'%'
   ]]>
</if>

热点排行