Skip to content

Commit

Permalink
docs: add example for multiple placeholders
Browse files Browse the repository at this point in the history
closes #1410
  • Loading branch information
betweenbrain authored and dougwilson committed May 10, 2016
1 parent 1c39fde commit 0fd2f7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Readme.md
Expand Up @@ -623,6 +623,16 @@ connection.query('SELECT * FROM users WHERE id = ?', [userId], function(err, res
});
```

Multiple placeholders are mapped to values in the same order as passed. For example,
in the following query `foo` equals `a`, `bar` equals `b`, `baz` equals `c`, and
`id` will be `userId`:

```js
connection.query('UPDATE users SET foo = ?, bar = ?, baz = ? WHERE id = ?', ['a', 'b', 'c', userId], function(err, results) {
// ...
});
```

This looks similar to prepared statements in MySQL, however it really just uses
the same `connection.escape()` method internally.

Expand Down

0 comments on commit 0fd2f7b

Please sign in to comment.