setAllowBareNamedParameters

The names of SQLite parameters begin with a prefix character. By default,node:sqlite requires that this prefix character is present when binding parameters. However, with the exception of dollar sign character, these prefix characters also require extra quoting when used in object keys.

To improve ergonomics, this method can be used to also allow bare named parameters, which do not require the prefix character in JavaScript code. There are several caveats to be aware of when enabling bare named parameters:

  • The prefix character is still required in SQL.

  • The prefix character is still allowed in JavaScript. In fact, prefixed names will have slightly better binding performance.

  • Using ambiguous named parameters, such as $k and @k, in the same prepared statement will result in an exception as it cannot be determined how to bind a bare name.

Since

v22.5.0

Parameters

enabled

Enables or disables support for binding named parameters without the prefix character.