爲了防止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 #+'%
爲了防止SQL注入,iBatis模糊查詢時也要避免使用$$來進行傳值。下面是三個不同數據庫的ibatis的模糊查詢傳值。