aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-oo1.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/api/sqlite3-api-oo1.js')
-rw-r--r--ext/wasm/api/sqlite3-api-oo1.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js
index 2f5b9fc1c..4677b8976 100644
--- a/ext/wasm/api/sqlite3-api-oo1.js
+++ b/ext/wasm/api/sqlite3-api-oo1.js
@@ -478,7 +478,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const __selectFirstRow = (db, sql, bind, ...getArgs)=>{
const stmt = db.prepare(sql);
try {
- return stmt.bind(bind).step() ? stmt.get(...getArgs) : undefined;
+ const rc = stmt.bind(bind).step() ? stmt.get(...getArgs) : undefined;
+ stmt.reset(/*for INSERT...RETURNING locking case*/);
+ return rc;
}finally{
stmt.finalize();
}
@@ -1133,6 +1135,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
try {
stmt.bind(bind);
while(stmt.step()) rc.push(stmt.get(0,asType));
+ stmt.reset(/*for INSERT...RETURNING locking case*/);
}finally{
stmt.finalize();
}
@@ -1686,7 +1689,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
*/
stepFinalize: function(){
try{
- return this.step();
+ const rc = this.step();
+ this.reset(/*for INSERT...RETURNING locking case*/);
+ return rc;
}finally{
try{this.finalize()}
catch(e){/*ignored*/}