Skip to content

Commit 40011d0

Browse files
authored
pluck (WiseLibs#350)
1 parent bdc1c1a commit 40011d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/api.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ Registers a user-defined `function` so that it can be used by SQL statements.
173173
```js
174174
db.function('add2', (a, b) => a + b);
175175

176-
db.prepare('SELECT add2(?, ?)').get(12, 4); // => 16
177-
db.prepare('SELECT add2(?, ?)').get('foo', 'bar'); // => "foobar"
178-
db.prepare('SELECT add2(?, ?, ?)').get(12, 4, 18); // => Error: wrong number of arguments
176+
db.prepare('SELECT add2(?, ?)').pluck().get(12, 4); // => 16
177+
db.prepare('SELECT add2(?, ?)').pluck().get('foo', 'bar'); // => "foobar"
178+
db.prepare('SELECT add2(?, ?, ?)').pluck().get(12, 4, 18); // => Error: wrong number of arguments
179179
```
180180

181181
By default, user-defined functions have a strict number of arguments (determined by `function.length`). You can register multiple functions of the same name, each with a different number of arguments, causing SQLite3 to execute a different function depending on how many arguments were passed to it. If you register two functions with same name and the same number of arguments, the second registration will erase the first one.
@@ -187,8 +187,8 @@ If your function is [deterministic](https://en.wikipedia.org/wiki/Deterministic_
187187
```js
188188
db.function('void', { deterministic: true, varargs: true }, () => {});
189189

190-
db.prepare("SELECT void()").get(); // => null
191-
db.prepare("SELECT void(?, ?)").get(55, 19); // => null
190+
db.prepare("SELECT void()").pluck().get(); // => null
191+
db.prepare("SELECT void(?, ?)").pluck().get(55, 19); // => null
192192
```
193193

194194
### .aggregate(*name*, *options*) -> *this*

0 commit comments

Comments
 (0)