当前位置: 代码迷 >> SQL >> ibatis中使用like时怎么避过sql注入
  详细解决方案

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

热度:73   发布时间:2016-05-05 13:54:53.0
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>
  相关解决方案