File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -661,6 +661,22 @@ connection.query({
661661);
662662```
663663
664+ If the query only has a single replacement character (` ? ` ), and the value is
665+ not ` null ` , ` undefiend ` , or an array, it can be passed directly as the second
666+ argument to ` .query ` :
667+
668+ ``` js
669+ connection .query (
670+ ' SELECT * FROM `books` WHERE `author` = ?' ,
671+ ' David' ,
672+ function (error , results , fields ) {
673+ // error will be an Error if one occurred during the query
674+ // results will contain the results of the query
675+ // fields will contain information about the returned results fields (if any)
676+ }
677+ );
678+ ```
679+
664680## Escaping query values
665681
666682** Caution** These methods of escaping values only works when the
You can’t perform that action at this time.
0 commit comments