1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Expose the auto-extension API to JS and reorganize some nearby code.

FossilOrigin-Name: 52b229d11d82bfb81c8b63e252c51c57a34dc50498dd685451588c185873c628
This commit is contained in:
stephan
2022-12-26 17:15:05 +00:00
parent ff78b2bee8
commit 84261bac96
6 changed files with 182 additions and 111 deletions

View File

@@ -2687,6 +2687,30 @@ self.sqlite3InitModule = sqlite3InitModule;
}/*OPFS util sanity checks*/)
;/* end OPFS tests */
////////////////////////////////////////////////////////////////////////
T.g('Auto-extension API')
.t({
name: "Auto-extension sanity checks.",
test: function(sqlite3){
let counter = 0;
const fp = wasm.installFunction('i(ppp)', function(pDb,pzErr,pApi){
++counter;
return 0;
});
(new sqlite3.oo1.DB()).close();
T.assert( 0===counter );
capi.sqlite3_auto_extension(fp);
(new sqlite3.oo1.DB()).close();
T.assert( 1===counter );
(new sqlite3.oo1.DB()).close();
T.assert( 2===counter );
capi.sqlite3_cancel_auto_extension(fp);
wasm.uninstallFunction(fp);
(new sqlite3.oo1.DB()).close();
T.assert( 2===counter );
}
});
////////////////////////////////////////////////////////////////////////
T.g('Session API')
.t({