You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 sqlite3 has provided this as part of the api it may be nice to utilize here instead of creating an alternative process for creating that expanded sql.
Proposed implementation
Wondering if maybe Statement could have a expandedSql() method that could be used for this - always just pulls the sql:
db.serialize(()=>{db.run("CREATE TABLE lorem (info TEXT)");conststmt=db.prepare("INSERT INTO lorem VALUES (?)");console.log(stmt.expandedSql());// returns "INSERT INTO lorem VALUES (?)"stmt.bind("Ipsum");console.log(stmt.expandedSql());// returns "INSERT INTO lorem VALUES ("Ipsum")"stmt.run();stmt.finalize();});
Also could see this being in the trace as well.
Here is my quick use of the api performs the same result on a prepared statement:
smith-xyz
changed the title
Utilize sqlite3_expanded_sql to print sql statements with bindings
Utilize sqlite3_expanded_sql to retrieve sql statements with bindings
Feb 2, 2023
Summary
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 sqlite3 has provided this as part of the api it may be nice to utilize here instead of creating an alternative process for creating that expanded sql.
Proposed implementation
Wondering if maybe Statement could have a expandedSql() method that could be used for this - always just pulls the sql:
Also could see this being in the trace as well.
Here is my quick use of the api performs the same result on a prepared statement:
The text was updated successfully, but these errors were encountered: