mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Expose a JS-friendly subset of sqlite3_config() to JS, with the notable caveats that (1) setting up the JS bindings requires starting the library, making sqlite3_config() illegal to call and (2) calling sqlite3_shutdown() in order to make it legal to call sqlite3_config() may undo certain JS-side library initialization. Move sqlite3_(de)serialize() into the int64-mode-only bindings because of their int64 args.
FossilOrigin-Name: 62e0c931ac952219f68e22d64e20836781bf330b4581e4662266172a97c9289b
This commit is contained in:
@@ -344,6 +344,38 @@ self.sqlite3InitModule = sqlite3InitModule;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
T.g('Basic sanity checks')
|
||||
.t({
|
||||
name:'sqlite3_config()',
|
||||
test:function(sqlite3){
|
||||
for(const k of [
|
||||
'SQLITE_CONFIG_GETMALLOC', 'SQLITE_CONFIG_URI'
|
||||
]){
|
||||
T.assert(capi[k] > 0);
|
||||
}
|
||||
T.assert(capi.SQLITE_MISUSE===capi.sqlite3_config(
|
||||
capi.SQLITE_CONFIG_URI, 1
|
||||
), "MISUSE because the library has already been initialized.");
|
||||
T.assert(capi.SQLITE_MISUSE === capi.sqlite3_config(
|
||||
// not enough args
|
||||
capi.SQLITE_CONFIG_GETMALLOC
|
||||
));
|
||||
T.assert(capi.SQLITE_NOTFOUND === capi.sqlite3_config(
|
||||
// unhandled-in-JS config option
|
||||
capi.SQLITE_CONFIG_GETMALLOC, 1
|
||||
));
|
||||
if(0){
|
||||
log("We cannot _fully_ test sqlite3_config() after the library",
|
||||
"has been initialized (which it necessarily has been to",
|
||||
"set up various bindings) and we cannot shut it down ",
|
||||
"without losing the VFS registrations.");
|
||||
T.assert(0 === capi.sqlite3_config(
|
||||
capi.SQLITE_CONFIG_URI, 1
|
||||
));
|
||||
}
|
||||
}
|
||||
})/*sqlite3_config()*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
.t({
|
||||
name: "JS wasm-side allocator",
|
||||
test: function(sqlite3){
|
||||
@@ -422,6 +454,7 @@ self.sqlite3InitModule = sqlite3InitModule;
|
||||
assert(0===capi.sqlite3_strlike("%.txt", "foo.txt", 0)).
|
||||
assert(0!==capi.sqlite3_strlike("%.txt", "foo.xtx", 0));
|
||||
})
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
;/*end of basic sanity checks*/
|
||||
|
||||
|
Reference in New Issue
Block a user