I am using mysql-node: https://github.com/mysqljs/mysql but I am a little confused about default sanitization, Mysql.Escape()
vs Mysql.EscapeId()
and the use of ?
vs ??
. The docs says?
Default Sanitization
When you pass an Object to .escape() or .query(), .escapeId() is used to avoid SQL injection in object keys.
I see the term Object, so does that mean I should still escape queries like this?
UPDATE table SET updated_at = userInput WHERE name = userInput
.
Mysql.Escape() vs Mysql.EscapeId()
What is the difference between these two functions. The docs says mysql.escape uses mysql.escapeId. I know they both sanitize input but is there a case where you use one or the other?
? vs ??
The docs use ?
and ??
interchangeably. Do they mean the same thing?