mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Extend detection of the INSERT...RETURNING locking case to the DB.selectValue(s)/selectArray/selectObject() family of functions. Add tests for INSERT/UPDATE...RETURNING with those functions.
FossilOrigin-Name: 3181c50540df0eff6cb5db79bb477c469bb7b73b0692260ba600db200fcef4ac
This commit is contained in:
@ -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*/}
|
||||
|
Reference in New Issue
Block a user