我使用https://github.com/mysqljs/mysql.git库。
我有一个mysql db查询架构,由于文件太多,我无法一一修改SQL查询文件来转义每个参数,但是所有的SQL查询都会调用同一个基础mysql实例的查询方法,所以我想知道我是否可以在基本 mysql 查询方法中转义最终的 SQL 字符串。
我想转义整个 SQL 字符串,比如
select * from tableA where name = 'foo'bar
至
select * from tableA where name = 'foo\'bar'
使用一些功能,mysql_escape("select * from tableA where name = 'foo'bar'")
而不是使用准备查询或连接转义字符串来执行此操作。