防止SQL注入 iBatis模糊查詢

爲了防止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 #+'%   
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章