-
-
Notifications
You must be signed in to change notification settings - Fork 430
Open
Description
With sqlite3_expanded_sql() you can retrieve the expanded version of the sql statement with the bindings. This is useful mostly for debugging purposes but could be useful if one has a disaster recovery process utilizing the prepared sql statements. Since its part of the sqlite api it seems to be a nice to have.
const db = new Database(':memory:');
db.exec('CREATE TABLE users (id INTEGER, name TEXT, email TEXT)');
const stmt = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
console.log(stmt.source); // "INSERT INTO users (name, email) VALUES (?, ?)"
console.log(stmt.expandedSQL); // "INSERT INTO users (name, email) VALUES (?, ?)" (no bindings yet)
stmt.bind('John Doe', '[email protected]');
console.log(stmt.expandedSQL); // "INSERT INTO users (name, email) VALUES ('John Doe', '[email protected]')"I'm willing to work on this feature if it makes sense to add for better-sqlite3.
Metadata
Metadata
Assignees
Labels
No labels