From e6233af3f38eb1189e48025b9bb245880af0459a Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 19 Mar 2025 21:12:00 -0400 Subject: [PATCH] sqlite: add support for unknown named parameters This commit adds a method for toggling support for unknown named parameters in prepared statements. Fixes: https://github.com/nodejs/node/issues/55533 --- doc/api/sqlite.md | 11 +++++ src/node_sqlite.cc | 32 +++++++++++++-- src/node_sqlite.h | 3 ++ test/parallel/test-sqlite-named-parameters.js | 41 +++++++++++++++++++ 4 files changed, 84 insertions(+), 3 deletions(-) diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index 3601a361ef564d..ba2b3b5bb50448 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -542,6 +542,17 @@ are several caveats to be aware of when enabling bare named parameters: statement will result in an exception as it cannot be determined how to bind a bare name. +### `statement.setAllowUnknownNamedParameters(enabled)` + + + +* `enabled` {boolean} Enables or disables support for unknown named parameters. + +By default, if an unknown name is encountered while binding parameters, an +exception is thrown. This method allows unknown named parameters to be ignored. + ### `statement.setReadBigInts(enabled)`