温馨提示×

模糊查询如何解决sql语句注入问题

小新
325
2021-01-14 19:34:43
栏目: 云计算
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

模糊查询如何解决sql语句注入问题

模糊查询解决sql语句注入问题的示例:

使用mysql中concat函数可以解决sql注入又能够在位置文件中写%,代码如下:

<select id = "selectByName"  resultType= "cn.test.domain.Employee">

    select 

       id, emp_name as empName,

sex,email,birthday,address

       from

            t_employee

       where

            emp_name like concat(‘%‘,#{empName},‘%‘)

</select>

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:SQL模糊查询语句怎么使用

0