From bcdfc32ff4a829439e7399ae06da14f731fdf178 Mon Sep 17 00:00:00 2001 From: schliepa Date: Thu, 27 Nov 2025 16:17:34 +0100 Subject: [PATCH] doc: show the use of string expressions in the SQLTagStore example 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}`). --- 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 dec01a512b9cef..60fa4453d09817 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.