Skip to content

Commit 1a55463

Browse files
committed
sqlite: manage sqlite3_stmt lifetime with RAII
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
1 parent ee5a070 commit 1a55463

5 files changed

Lines changed: 161 additions & 57 deletions

File tree

‎doc/api/sqlite.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,10 @@ console.log(query.get());
668668

669669
<!-- YAML
670670
added: v22.5.0
671+
changes:
672+
- version: REPLACEME
673+
pr-url: https://github.com/nodejs/node/pull/REPLACEME
674+
description: Throws `ERR_INVALID_ARG_VALUE` if `sql` contains no statement.
671675
-->
672676

673677
* `sql` {string} A SQL string to compile to a prepared statement.
@@ -686,6 +690,9 @@ added: v22.5.0
686690
Compiles a SQL statement into a [prepared statement][]. This method is a wrapper
687691
around [`sqlite3_prepare_v2()`][].
688692

693+
Throws `ERR_INVALID_ARG_VALUE` if `sql` contains no statement to compile, for
694+
example when it is empty or holds only whitespace or comments.
695+
689696
### `database.createTagStore([maxSize])`
690697

691698
<!-- YAML
@@ -1337,6 +1344,9 @@ class execute synchronously.
13371344
<!-- YAML
13381345
added: v24.9.0
13391346
changes:
1347+
- version: REPLACEME
1348+
pr-url: https://github.com/nodejs/node/pull/62419
1349+
description: Throws `ERR_INVALID_ARG_VALUE` if the template contains no statement.
13401350
- version: REPLACEME
13411351
pr-url: https://github.com/nodejs/node/pull/62001
13421352
description: Add support for boolean values in bound parameters.
@@ -1354,6 +1364,9 @@ changes:
13541364
Executes the given SQL query and returns all resulting rows as an array of
13551365
objects.
13561366

1367+
Throws `ERR_INVALID_ARG_VALUE` if the assembled template contains no statement
1368+
to compile, for example when it is empty or holds only whitespace or comments.
1369+
13571370
This function is intended to be used as a template literal tag, not to be
13581371
called directly.
13591372

@@ -1362,6 +1375,9 @@ called directly.
13621375
<!-- YAML
13631376
added: v24.9.0
13641377
changes:
1378+
- version: REPLACEME
1379+
pr-url: https://github.com/nodejs/node/pull/62419
1380+
description: Throws `ERR_INVALID_ARG_VALUE` if the template contains no statement.
13651381
- version: REPLACEME
13661382
pr-url: https://github.com/nodejs/node/pull/62001
13671383
description: Add support for boolean values in bound parameters.
@@ -1379,6 +1395,9 @@ changes:
13791395

13801396
Executes the given SQL query and returns the first resulting row as an object.
13811397

1398+
Throws `ERR_INVALID_ARG_VALUE` if the assembled template contains no statement
1399+
to compile, for example when it is empty or holds only whitespace or comments.
1400+
13821401
This function is intended to be used as a template literal tag, not to be
13831402
called directly.
13841403

@@ -1387,6 +1406,9 @@ called directly.
13871406
<!-- YAML
13881407
added: v24.9.0
13891408
changes:
1409+
- version: REPLACEME
1410+
pr-url: https://github.com/nodejs/node/pull/62419
1411+
description: Throws `ERR_INVALID_ARG_VALUE` if the template contains no statement.
13901412
- version: REPLACEME
13911413
pr-url: https://github.com/nodejs/node/pull/62001
13921414
description: Add support for boolean values in bound parameters.
@@ -1403,6 +1425,9 @@ changes:
14031425

14041426
Executes the given SQL query and returns an iterator over the resulting rows.
14051427

1428+
Throws `ERR_INVALID_ARG_VALUE` if the assembled template contains no statement
1429+
to compile, for example when it is empty or holds only whitespace or comments.
1430+
14061431
This function is intended to be used as a template literal tag, not to be
14071432
called directly.
14081433

@@ -1411,6 +1436,9 @@ called directly.
14111436
<!-- YAML
14121437
added: v24.9.0
14131438
changes:
1439+
- version: REPLACEME
1440+
pr-url: https://github.com/nodejs/node/pull/62419
1441+
description: Throws `ERR_INVALID_ARG_VALUE` if the template contains no statement.
14141442
- version: REPLACEME
14151443
pr-url: https://github.com/nodejs/node/pull/62001
14161444
description: Add support for boolean values in bound parameters.
@@ -1427,6 +1455,9 @@ changes:
14271455

14281456
Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
14291457

1458+
Throws `ERR_INVALID_ARG_VALUE` if the assembled template contains no statement
1459+
to compile, for example when it is empty or holds only whitespace or comments.
1460+
14301461
This function is intended to be used as a template literal tag, not to be
14311462
called directly.
14321463

0 commit comments

Comments
 (0)