From d0c102495a5958d2cce1b42ed9cd45eddbafac7f Mon Sep 17 00:00:00 2001 From: schliepa Date: Sun, 30 Nov 2025 14:31:56 +0100 Subject: [PATCH] doc: show the use of string expressions in the SQLTagStore example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a users attempts to escape strings with quotes in SQLTagStore template strings (`'${expression}'`), as is usually required for SQL query strings, the queries would fail. This change shows an example on the correct use (`${expression}`). PR-URL: https://github.com/nodejs/node/pull/60873 Reviewed-By: René Reviewed-By: Colin Ihrig --- doc/api/sqlite.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index dec01a512b..60fa4453d0 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -550,8 +550,8 @@ sql.run`INSERT INTO users VALUES (1, 'Alice')`; sql.run`INSERT INTO users VALUES (2, 'Bob')`; // Using the 'get' method to retrieve a single row. -const id = 1; -const user = sql.get`SELECT * FROM users WHERE id = ${id}`; +const name = 'Alice'; +const user = sql.get`SELECT * FROM users WHERE name = ${name}`; console.log(user); // { id: 1, name: 'Alice' } // Using the 'all' method to retrieve all rows. @@ -577,8 +577,8 @@ sql.run`INSERT INTO users VALUES (1, 'Alice')`; sql.run`INSERT INTO users VALUES (2, 'Bob')`; // Using the 'get' method to retrieve a single row. -const id = 1; -const user = sql.get`SELECT * FROM users WHERE id = ${id}`; +const name = 'Alice'; +const user = sql.get`SELECT * FROM users WHERE name = ${name}`; console.log(user); // { id: 1, name: 'Alice' } // Using the 'all' method to retrieve all rows.