现在的位置: 首页 > 综合 > 正文

防止SQL注入 iBatis模糊查询

2013年10月12日 ⁄ 综合 ⁄ 共 248字 ⁄ 字号 评论关闭

为了防止SQL注入,iBatis模糊查询时也要避免使用$$来进行传值。下面是三个不同数据库的ibatis的模糊查询传值。

  1. mysql: select * from stu where name like concat('%',#name #,'%')  
  2.  
  3. oracle: select * from stu where name like '%'||#name #||'%' 
  4.  
  5. SQL Server:select * from stu where name like '%'+#name #+'%   

抱歉!评论已关闭.