mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Correct a one-too-many-exclamation-points bug which caused the opposite of intended semantics in oo1.Stmt.pointer ownership.
FossilOrigin-Name: 91e709f36d36174534b4cf4ff548a558e66cca5e23a6c8c106bc43375fc3ce72
This commit is contained in:
@ -1273,15 +1273,22 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
|
||||
}
|
||||
T.assert( dw===dw.exec("select 1") );
|
||||
dw.affirmOpen();
|
||||
rc = capi.sqlite3_prepare_v2( dw, "select 1", -1, ppOut, 0 );
|
||||
const select1 = "select 1";
|
||||
rc = capi.sqlite3_prepare_v2( dw, select1, -1, ppOut, 0 );
|
||||
T.assert( 0===rc, 'prepare_v2() rc='+rc );
|
||||
pStmt = wasm.peekPtr(ppOut);
|
||||
T.assert( pStmt && wasm.isPtr(pStmt), 'pStmt is valid?' );
|
||||
try {
|
||||
//log( "capi.sqlite3_sql() =",capi.sqlite3_sql(pStmt));
|
||||
T.assert( select1 === capi.sqlite3_sql(pStmt), 'SQL mismatch' );
|
||||
q = sqlite3.oo1.Stmt.wrapHandle(dw, pStmt, false);
|
||||
//log("q@"+pStmt+" does not own handle");
|
||||
T.assert( q.step(), "step()" )
|
||||
.assert( !q.step(), "!step()" );
|
||||
q.finalize();
|
||||
q = undefined;
|
||||
T.assert( select1 === capi.sqlite3_sql(pStmt), 'SQL mismatch'
|
||||
/* This will fail if we've mismanaged pStmt's lifetime */);
|
||||
q = sqlite3.oo1.Stmt.wrapHandle(dw, pStmt, true);
|
||||
pStmt = 0;
|
||||
q.reset();
|
||||
|
Reference in New Issue
Block a user