情况一
arr=['a','b']
sql="select * from student where name in (?)"
db.query(sql,arr,function(){
console.log(this.sql)
})
// select * from student where name in ('a'),只识别到数组的第一个
情况二
arr=['a','b']
sql="select * from student where name in (??)"
db.query(sql,arr,function(){
console.log(this.sql)
})
// select * from student where name in (`a`,`b`),识别出来为反引号,语句执行报错
情况三,这种是数组占位符的写法
arr=['a','b']
sql="select * from student where name in (??)"
db.query(sql,[arr],function(){
console.log(this.sql)
})
// select * from student where name in ('a','b),识别到整个数组