模糊查詢的like '%$name$%'的sql注入避免

模糊查詢的like '%$name$%'的sql注入避免

Ibatis like 查詢防止SQL注入的方法

Ibatis like 查詢防止SQL注入的方法

mysql: select * from tbl_school where school_name like concat('%',#{name},'%')     
   
oracle: select * from tbl_school where school_name like '%'||#{name}||'%'    
   
sql server:select * from tbl_school where school_name like '%'+#{name}+'%'

 

適用Oracle和MySQL的方式:

select * from tbl_school where school_name like concat(#{name},'%')  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章