ITeye博客

Ibatis防止sql注入

boendev · 2012-07-23 18:36 · 互联网 · Markdown

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

mysql: select * from stu where name like concat('%',#name #,'%') 

oracle: select * from stu where name like '%'||#name #||'%'  SQL 

Server:select * from stu where name like '%'+#name #+'%

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。