1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Move the sqlite3.capi.wasm namespace to sqlite3.wasm. This causes a tiny bit of naming confusion with the sqlite3.wasm *file*, but seems to make more sense than having it as a sub-namespace of capi.

FossilOrigin-Name: 3f16eb18d6186ca972fca952ccac18649e7a905213f589e53c0c9333e695448d
This commit is contained in:
stephan
2022-10-29 07:54:10 +00:00
parent 053bb22f35
commit 8948fbee29
19 changed files with 227 additions and 211 deletions

View File

@ -586,3 +586,18 @@ push:
$(wasm-testing.include) $(wasm-testing.dest) $(wasm-testing.include) $(wasm-testing.dest)
ssh wasm-testing 'cd $(wasm-testing.dir) && bash .gzip' || \ ssh wasm-testing 'cd $(wasm-testing.dir) && bash .gzip' || \
echo "SSH failed: it's likely that stale content will be served via old gzip files." echo "SSH failed: it's likely that stale content will be served via old gzip files."
WDOCS.home := $(wildcard ../../../wdoc)
ifneq (,$(WDOCS.home))
WDOCS.jswasm += $(WDOCS.home)/jswasm
update-docs:
cp $(sqlite3.wasm) $(WDOCS.jswasm)/.
$(bin.stripccomments) -k -k < $(sqlite3.js) > $(WDOCS.jswasm)/sqlite3.js
cp demo-123.js demo-123.html demo-123-worker.html $(WDOCS.home)
sed -n -e '/EXTRACT_BEGIN/,/EXTRACT_END/p' \
module-symbols.html > $(WDOCS.home)/module-symbols.html
else
update-docs:
@echo "Cannot find wasm docs checkout."
endif

View File

@ -59,7 +59,7 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
} }
/* Clean up temporary references to our APIs... */ /* Clean up temporary references to our APIs... */
delete sqlite3.capi.util /* arguable, but these are (currently) internal-use APIs */; delete sqlite3.util /* arguable, but these are (currently) internal-use APIs */;
Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
pass the sqlite3 object off to the client. */; pass the sqlite3 object off to the client. */;
}else{ }else{

View File

@ -20,8 +20,8 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
'use strict'; 'use strict';
const toss = (...args)=>{throw new Error(args.join(' '))}; const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = sqlite3.SQLite3Error.toss; const toss3 = sqlite3.SQLite3Error.toss;
const capi = sqlite3.capi, wasm = capi.wasm, util = capi.util; const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
self.WhWasmUtilInstaller(capi.wasm); self.WhWasmUtilInstaller(wasm);
delete self.WhWasmUtilInstaller; delete self.WhWasmUtilInstaller;
/** /**
@ -88,7 +88,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
capi[e[0]] = wasm.xWrap.apply(null, e); capi[e[0]] = wasm.xWrap.apply(null, e);
} }
for(const e of wasm.bindingSignatures.wasm){ for(const e of wasm.bindingSignatures.wasm){
capi.wasm[e[0]] = wasm.xWrap.apply(null, e); wasm[e[0]] = wasm.xWrap.apply(null, e);
} }
/* For C API functions which cannot work properly unless /* For C API functions which cannot work properly unless
@ -109,7 +109,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
delete wasm.bindingSignatures; delete wasm.bindingSignatures;
if(wasm.exports.sqlite3_wasm_db_error){ if(wasm.exports.sqlite3_wasm_db_error){
util.sqlite3_wasm_db_error = capi.wasm.xWrap( util.sqlite3_wasm_db_error = wasm.xWrap(
'sqlite3_wasm_db_error', 'int', 'sqlite3*', 'int', 'string' 'sqlite3_wasm_db_error', 'int', 'sqlite3*', 'int', 'string'
); );
}else{ }else{
@ -176,7 +176,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
} }
/* Wrap the callback in a WASM-bound function and convert the callback's /* Wrap the callback in a WASM-bound function and convert the callback's
`(char**)` arguments to arrays of strings... */ `(char**)` arguments to arrays of strings... */
const wasm = capi.wasm;
const cbwrap = function(pVoid, nCols, pColVals, pColNames){ const cbwrap = function(pVoid, nCols, pColVals, pColNames){
let rc = capi.SQLITE_ERROR; let rc = capi.SQLITE_ERROR;
try { try {
@ -399,7 +398,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
return __dbArgcMismatch(pDb,"sqlite3_create_function_v2",f.length); return __dbArgcMismatch(pDb,"sqlite3_create_function_v2",f.length);
} }
/* Wrap the callbacks in a WASM-bound functions... */ /* Wrap the callbacks in a WASM-bound functions... */
const wasm = capi.wasm;
const uninstall = [/*funcs to uninstall on error*/]; const uninstall = [/*funcs to uninstall on error*/];
let rc; let rc;
try{ try{
@ -441,7 +439,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
return __dbArgcMismatch(pDb,"sqlite3_create_window_function",f.length); return __dbArgcMismatch(pDb,"sqlite3_create_window_function",f.length);
} }
/* Wrap the callbacks in a WASM-bound functions... */ /* Wrap the callbacks in a WASM-bound functions... */
const wasm = capi.wasm;
const uninstall = [/*funcs to uninstall on error*/]; const uninstall = [/*funcs to uninstall on error*/];
let rc; let rc;
try{ try{

View File

@ -18,7 +18,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const toss = (...args)=>{throw new Error(args.join(' '))}; const toss = (...args)=>{throw new Error(args.join(' '))};
const toss3 = (...args)=>{throw new sqlite3.SQLite3Error(...args)}; const toss3 = (...args)=>{throw new sqlite3.SQLite3Error(...args)};
const capi = sqlite3.capi, wasm = capi.wasm, util = capi.util; const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
/* What follows is colloquially known as "OO API #1". It is a /* What follows is colloquially known as "OO API #1". It is a
binding of the sqlite3 API which is designed to be run within binding of the sqlite3 API which is designed to be run within
the same thread (main or worker) as the one in which the the same thread (main or worker) as the one in which the
@ -694,7 +694,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
*/ */
exec: function(/*(sql [,obj]) || (obj)*/){ exec: function(/*(sql [,obj]) || (obj)*/){
affirmDbOpen(this); affirmDbOpen(this);
const wasm = capi.wasm;
const arg = parseExecArgs(arguments); const arg = parseExecArgs(arguments);
if(!arg.sql){ if(!arg.sql){
return (''===arg.sql) ? this : toss3("exec() requires an SQL string."); return (''===arg.sql) ? this : toss3("exec() requires an SQL string.");
@ -925,7 +924,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const pApp = opt.pApp; const pApp = opt.pApp;
if(undefined!==pApp && if(undefined!==pApp &&
null!==pApp && null!==pApp &&
(('number'!==typeof pApp) || !capi.util.isInt32(pApp))){ (('number'!==typeof pApp) || !util.isInt32(pApp))){
toss3("Invalid value for pApp property. Must be a legal WASM pointer value."); toss3("Invalid value for pApp property. Must be a legal WASM pointer value.");
} }
const xDestroy = opt.xDestroy || 0; const xDestroy = opt.xDestroy || 0;

View File

@ -118,7 +118,7 @@ const installOpfsVfs = function callee(options){
const error = (...args)=>logImpl(0, ...args); const error = (...args)=>logImpl(0, ...args);
const toss = function(...args){throw new Error(args.join(' '))}; const toss = function(...args){throw new Error(args.join(' '))};
const capi = sqlite3.capi; const capi = sqlite3.capi;
const wasm = capi.wasm; const wasm = sqlite3.wasm;
const sqlite3_vfs = capi.sqlite3_vfs; const sqlite3_vfs = capi.sqlite3_vfs;
const sqlite3_file = capi.sqlite3_file; const sqlite3_file = capi.sqlite3_file;
const sqlite3_io_methods = capi.sqlite3_io_methods; const sqlite3_io_methods = capi.sqlite3_io_methods;
@ -924,7 +924,7 @@ const installOpfsVfs = function callee(options){
cannot add an after-initialize callback mechanism. cannot add an after-initialize callback mechanism.
*/ */
opfsUtil.registerVfs = (asDefault=false)=>{ opfsUtil.registerVfs = (asDefault=false)=>{
return capi.wasm.exports.sqlite3_vfs_register( return wasm.exports.sqlite3_vfs_register(
opfsVfs.pointer, asDefault ? 1 : 0 opfsVfs.pointer, asDefault ? 1 : 0
); );
}; };

View File

@ -557,110 +557,107 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
values. values.
*/ */
sqlite3_randomness: (n, outPtr)=>{/*installed later*/}, sqlite3_randomness: (n, outPtr)=>{/*installed later*/},
/**
Various internal-use utilities are added here as needed. They
are bound to an object only so that we have access to them in
the differently-scoped steps of the API bootstrapping
process. At the end of the API setup process, this object gets
removed. These are NOT part of the public API.
*/
util:{
affirmBindableTypedArray, flexibleString,
bigIntFits32, bigIntFits64, bigIntFitsDouble,
isBindableTypedArray,
isInt32, isSQLableTypedArray, isTypedArray,
typedArrayToString,
isUIThread: ()=>'undefined'===typeof WorkerGlobalScope,
isSharedTypedArray,
typedArrayPart
},
/**
Holds state which are specific to the WASM-related
infrastructure and glue code. It is not expected that client
code will normally need these, but they're exposed here in case
it does. These APIs are _not_ to be considered an
official/stable part of the sqlite3 WASM API. They may change
as the developers' experience suggests appropriate changes.
Note that a number of members of this object are injected
dynamically after the api object is fully constructed, so
not all are documented inline here.
*/
wasm: {
//^^^ TODO?: move wasm from sqlite3.capi.wasm to sqlite3.wasm
/**
Emscripten APIs have a deep-seated assumption that all pointers
are 32 bits. We'll remain optimistic that that won't always be
the case and will use this constant in places where we might
otherwise use a hard-coded 4.
*/
ptrSizeof: config.wasmPtrSizeof || 4,
/**
The WASM IR (Intermediate Representation) value for
pointer-type values. It MUST refer to a value type of the
size described by this.ptrSizeof _or_ it may be any value
which ends in '*', which Emscripten's glue code internally
translates to i32.
*/
ptrIR: config.wasmPtrIR || "i32",
/**
True if BigInt support was enabled via (e.g.) the
Emscripten -sWASM_BIGINT flag, else false. When
enabled, certain 64-bit sqlite3 APIs are enabled which
are not otherwise enabled due to JS/WASM int64
impedence mismatches.
*/
bigIntEnabled: !!config.bigIntEnabled,
/**
The symbols exported by the WASM environment.
*/
exports: config.exports
|| toss("Missing API config.exports (WASM module exports)."),
/**
When Emscripten compiles with `-sIMPORT_MEMORY`, it
initalizes the heap and imports it into wasm, as opposed to
the other way around. In this case, the memory is not
available via this.exports.memory.
*/
memory: config.memory || config.exports['memory']
|| toss("API config object requires a WebAssembly.Memory object",
"in either config.exports.memory (exported)",
"or config.memory (imported)."),
/**
The API's one single point of access to the WASM-side memory
allocator. Works like malloc(3) (and is likely bound to
malloc()) but throws an WasmAllocError if allocation fails. It is
important that any code which might pass through the sqlite3 C
API NOT throw and must instead return SQLITE_NOMEM (or
equivalent, depending on the context).
That said, very few cases in the API can result in
client-defined functions propagating exceptions via the C-style
API. Most notably, this applies ot User-defined SQL Functions
(UDFs) registered via sqlite3_create_function_v2(). For that
specific case it is recommended that all UDF creation be
funneled through a utility function and that a wrapper function
be added around the UDF which catches any exception and sets
the error state to OOM. (The overall complexity of registering
UDFs essentially requires a helper for doing so!)
*/
alloc: undefined/*installed later*/,
/**
The API's one single point of access to the WASM-side memory
deallocator. Works like free(3) (and is likely bound to
free()).
*/
dealloc: undefined/*installed later*/
/* Many more wasm-related APIs get installed later on. */
}/*wasm*/
}/*capi*/; }/*capi*/;
const wasm = capi.wasm, util = capi.util; /**
Various internal-use utilities are added here as needed. They
are bound to an object only so that we have access to them in
the differently-scoped steps of the API bootstrapping
process. At the end of the API setup process, this object gets
removed. These are NOT part of the public API.
*/
const util = {
affirmBindableTypedArray, flexibleString,
bigIntFits32, bigIntFits64, bigIntFitsDouble,
isBindableTypedArray,
isInt32, isSQLableTypedArray, isTypedArray,
typedArrayToString,
isUIThread: ()=>'undefined'===typeof WorkerGlobalScope,
isSharedTypedArray,
typedArrayPart
};
/**
Holds state which are specific to the WASM-related
infrastructure and glue code. It is not expected that client
code will normally need these, but they're exposed here in case
it does. These APIs are _not_ to be considered an
official/stable part of the sqlite3 WASM API. They may change
as the developers' experience suggests appropriate changes.
Note that a number of members of this object are injected
dynamically after the api object is fully constructed, so
not all are documented inline here.
*/
const wasm = {
/**
Emscripten APIs have a deep-seated assumption that all pointers
are 32 bits. We'll remain optimistic that that won't always be
the case and will use this constant in places where we might
otherwise use a hard-coded 4.
*/
ptrSizeof: config.wasmPtrSizeof || 4,
/**
The WASM IR (Intermediate Representation) value for
pointer-type values. It MUST refer to a value type of the
size described by this.ptrSizeof _or_ it may be any value
which ends in '*', which Emscripten's glue code internally
translates to i32.
*/
ptrIR: config.wasmPtrIR || "i32",
/**
True if BigInt support was enabled via (e.g.) the
Emscripten -sWASM_BIGINT flag, else false. When
enabled, certain 64-bit sqlite3 APIs are enabled which
are not otherwise enabled due to JS/WASM int64
impedence mismatches.
*/
bigIntEnabled: !!config.bigIntEnabled,
/**
The symbols exported by the WASM environment.
*/
exports: config.exports
|| toss("Missing API config.exports (WASM module exports)."),
/**
When Emscripten compiles with `-sIMPORT_MEMORY`, it
initalizes the heap and imports it into wasm, as opposed to
the other way around. In this case, the memory is not
available via this.exports.memory.
*/
memory: config.memory || config.exports['memory']
|| toss("API config object requires a WebAssembly.Memory object",
"in either config.exports.memory (exported)",
"or config.memory (imported)."),
/**
The API's one single point of access to the WASM-side memory
allocator. Works like malloc(3) (and is likely bound to
malloc()) but throws an WasmAllocError if allocation fails. It is
important that any code which might pass through the sqlite3 C
API NOT throw and must instead return SQLITE_NOMEM (or
equivalent, depending on the context).
That said, very few cases in the API can result in
client-defined functions propagating exceptions via the C-style
API. Most notably, this applies ot User-defined SQL Functions
(UDFs) registered via sqlite3_create_function_v2(). For that
specific case it is recommended that all UDF creation be
funneled through a utility function and that a wrapper function
be added around the UDF which catches any exception and sets
the error state to OOM. (The overall complexity of registering
UDFs essentially requires a helper for doing so!)
*/
alloc: undefined/*installed later*/,
/**
The API's one single point of access to the WASM-side memory
deallocator. Works like free(3) (and is likely bound to
free()).
*/
dealloc: undefined/*installed later*/
/* Many more wasm-related APIs get installed later on. */
}/*wasm*/;
/** /**
wasm.alloc()'s srcTypedArray.byteLength bytes, wasm.alloc()'s srcTypedArray.byteLength bytes,
@ -915,7 +912,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
/** /**
Functions which are intended solely for API-internal use by the Functions which are intended solely for API-internal use by the
WASM components, not client code. These get installed into WASM components, not client code. These get installed into
capi.wasm. sqlite3.wasm.
*/ */
wasm.bindingSignatures.wasm = [ wasm.bindingSignatures.wasm = [
["sqlite3_wasm_db_reset", "int", "sqlite3*"], ["sqlite3_wasm_db_reset", "int", "sqlite3*"],
@ -1127,7 +1124,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
} }
return ta; return ta;
} }
capi.wasm.exports.sqlite3_randomness(...args); wasm.exports.sqlite3_randomness(...args);
}; };
/** State for sqlite3_wasmfs_opfs_dir(). */ /** State for sqlite3_wasmfs_opfs_dir(). */
@ -1304,7 +1301,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
: 0); : 0);
}; };
if( capi.util.isUIThread() ){ if( util.isUIThread() ){
/* Features specific to the main window thread... */ /* Features specific to the main window thread... */
/** /**
@ -1390,6 +1387,8 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
WasmAllocError: WasmAllocError, WasmAllocError: WasmAllocError,
SQLite3Error: SQLite3Error, SQLite3Error: SQLite3Error,
capi, capi,
util,
wasm,
config, config,
/** /**
Holds the version info of the sqlite3 source tree from which Holds the version info of the sqlite3 source tree from which
@ -1489,7 +1488,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
this array is deleted. this array is deleted.
Note that the order of insertion into this array is significant for Note that the order of insertion into this array is significant for
some pieces. e.g. sqlite3.capi and sqlite3.capi.wasm cannot be fully some pieces. e.g. sqlite3.capi and sqlite3.wasm cannot be fully
utilized until the whwasmutil.js part is plugged in via utilized until the whwasmutil.js part is plugged in via
sqlite3-api-glue.js. sqlite3-api-glue.js.
*/ */

View File

@ -367,11 +367,11 @@ sqlite3.initWorker1API = function(){
if(db){ if(db){
delete this.dbs[getDbId(db)]; delete this.dbs[getDbId(db)];
const filename = db.filename; const filename = db.filename;
const pVfs = sqlite3.capi.wasm.sqlite3_wasm_db_vfs(db.pointer, 0); const pVfs = sqlite3.wasm.sqlite3_wasm_db_vfs(db.pointer, 0);
db.close(); db.close();
if(db===this.defaultDb) this.defaultDb = undefined; if(db===this.defaultDb) this.defaultDb = undefined;
if(alsoUnlink && filename && pVfs){ if(alsoUnlink && filename && pVfs){
sqlite3.capi.wasm.sqlite3_wasm_vfs_unlink(pVfs, filename); sqlite3.wasm.sqlite3_wasm_vfs_unlink(pVfs, filename);
} }
} }
}, },

View File

@ -30,8 +30,6 @@
- `sqlite3.dir`, if set, treats the given directory name as the - `sqlite3.dir`, if set, treats the given directory name as the
directory from which `sqlite3.js` will be loaded. directory from which `sqlite3.js` will be loaded.
By default is loads 'sqlite3.js'.
*/ */
"use strict"; "use strict";
(()=>{ (()=>{
@ -43,7 +41,9 @@
//console.warn("worker1 theJs =",theJs); //console.warn("worker1 theJs =",theJs);
importScripts(theJs); importScripts(theJs);
sqlite3InitModule().then((sqlite3)=>{ sqlite3InitModule().then((sqlite3)=>{
sqlite3.capi.sqlite3_wasmfs_opfs_dir(); if(sqlite3.capi.sqlite3_wasmfs_opfs_dir){
sqlite3.capi.sqlite3_wasmfs_opfs_dir();
}
sqlite3.initWorker1API(); sqlite3.initWorker1API();
}); });
})(); })();

View File

@ -68,7 +68,7 @@
// This would be SO much easier with the oo1 API, but we specifically want to // This would be SO much easier with the oo1 API, but we specifically want to
// inject metrics we can't get via that API, and we cannot reliably (OPFS) // inject metrics we can't get via that API, and we cannot reliably (OPFS)
// open the same DB twice to clear it using that API, so... // open the same DB twice to clear it using that API, so...
const rc = sqlite3.capi.wasm.exports.sqlite3_wasm_db_reset(db.handle); const rc = sqlite3.wasm.exports.sqlite3_wasm_db_reset(db.handle);
App.logHtml("reset db rc =",rc,db.id, db.filename); App.logHtml("reset db rc =",rc,db.id, db.filename);
}; };
@ -115,7 +115,7 @@
const banner = "========================================"; const banner = "========================================";
this.logHtml(banner, this.logHtml(banner,
"Running",name,'('+sql.length,'bytes) using',db.id); "Running",name,'('+sql.length,'bytes) using',db.id);
const capi = this.sqlite3.capi, wasm = capi.wasm; const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
let pStmt = 0, pSqlBegin; let pStmt = 0, pSqlBegin;
const stack = wasm.scopedAllocPush(); const stack = wasm.scopedAllocPush();
const metrics = db.metrics = Object.create(null); const metrics = db.metrics = Object.create(null);
@ -289,7 +289,7 @@
return; return;
} }
if(!db.handle) return; if(!db.handle) return;
const capi = this.sqlite3, wasm = capi.wasm; const capi = this.sqlite3, wasm = this.sqlite3.wasm;
//const scope = wasm.scopedAllocPush( //const scope = wasm.scopedAllocPush(
this.logErr("TODO: clear db"); this.logErr("TODO: clear db");
}, },
@ -488,7 +488,7 @@
App.logHtml(dbId,"cache_size =",cacheSize); App.logHtml(dbId,"cache_size =",cacheSize);
}); });
}else{ }else{
const capi = this.sqlite3.capi, wasm = capi.wasm; const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
const stack = wasm.scopedAllocPush(); const stack = wasm.scopedAllocPush();
let pDb = 0; let pDb = 0;
try{ try{
@ -516,7 +516,7 @@
run: function(sqlite3){ run: function(sqlite3){
delete this.run; delete this.run;
this.sqlite3 = sqlite3; this.sqlite3 = sqlite3;
const capi = sqlite3.capi, wasm = capi.wasm; const capi = sqlite3.capi, wasm = sqlite3.wasm;
this.logHtml("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid()); this.logHtml("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
this.logHtml("WASM heap size =",wasm.heap8().length); this.logHtml("WASM heap size =",wasm.heap8().length);
this.loadSqlList(); this.loadSqlList();

View File

@ -44,7 +44,7 @@
const runTests = function(sqlite3){ const runTests = function(sqlite3){
const capi = sqlite3.capi, const capi = sqlite3.capi,
oo = sqlite3.oo1, oo = sqlite3.oo1,
wasm = capi.wasm; wasm = sqlite3.wasm;
log("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid()); log("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
T.assert( 0 !== capi.sqlite3_vfs_find(null) ); T.assert( 0 !== capi.sqlite3_vfs_find(null) );
if(!capi.sqlite3_vfs_find('kvvfs')){ if(!capi.sqlite3_vfs_find('kvvfs')){

View File

@ -122,11 +122,11 @@
const Sqlite3Shell = { const Sqlite3Shell = {
/** Returns the name of the currently-opened db. */ /** Returns the name of the currently-opened db. */
dbFilename: function f(){ dbFilename: function f(){
if(!f._) f._ = sqlite3.capi.wasm.xWrap('fiddle_db_filename', "string", ['string']); if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_db_filename', "string", ['string']);
return f._(0); return f._(0);
}, },
dbHandle: function f(){ dbHandle: function f(){
if(!f._) f._ = sqlite3.capi.wasm.xWrap("fiddle_db_handle", "sqlite3*"); if(!f._) f._ = sqlite3.wasm.xWrap("fiddle_db_handle", "sqlite3*");
return f._(); return f._();
}, },
dbIsOpfs: function f(){ dbIsOpfs: function f(){
@ -145,7 +145,7 @@
that any argv strings passed to its main() are valid until that any argv strings passed to its main() are valid until
the wasm environment shuts down. */ the wasm environment shuts down. */
]; ];
const capi = sqlite3.capi; const capi = sqlite3.capi, wasm = sqlite3.wasm;
/* We need to call sqlite3_shutdown() in order to avoid numerous /* We need to call sqlite3_shutdown() in order to avoid numerous
legitimate warnings from the shell about it being initialized legitimate warnings from the shell about it being initialized
after sqlite3_initialize() has been called. This means, after sqlite3_initialize() has been called. This means,
@ -154,8 +154,8 @@
VFSes). We need a more generic approach to running such VFSes). We need a more generic approach to running such
init-level code. */ init-level code. */
capi.sqlite3_shutdown(); capi.sqlite3_shutdown();
f.argv.pArgv = capi.wasm.allocMainArgv(f.argv); f.argv.pArgv = wasm.allocMainArgv(f.argv);
f.argv.rc = capi.wasm.exports.fiddle_main( f.argv.rc = wasm.exports.fiddle_main(
f.argv.length, f.argv.pArgv f.argv.length, f.argv.pArgv
); );
if(f.argv.rc){ if(f.argv.rc){
@ -187,7 +187,7 @@
exec: function f(sql){ exec: function f(sql){
if(!f._){ if(!f._){
if(!this.runMain()) return; if(!this.runMain()) return;
f._ = sqlite3.capi.wasm.xWrap('fiddle_exec', null, ['string']); f._ = sqlite3.wasm.xWrap('fiddle_exec', null, ['string']);
} }
if(fiddleModule.isDead){ if(fiddleModule.isDead){
stderr("shell module has exit()ed. Cannot run SQL."); stderr("shell module has exit()ed. Cannot run SQL.");
@ -208,7 +208,7 @@
} }
}, },
resetDb: function f(){ resetDb: function f(){
if(!f._) f._ = sqlite3.capi.wasm.xWrap('fiddle_reset_db', null); if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_reset_db', null);
stdout("Resetting database."); stdout("Resetting database.");
f._(); f._();
stdout("Reset",this.dbFilename()); stdout("Reset",this.dbFilename());
@ -216,7 +216,7 @@
/* Interrupt can't work: this Worker is tied up working, so won't get the /* Interrupt can't work: this Worker is tied up working, so won't get the
interrupt event which would be needed to perform the interrupt. */ interrupt event which would be needed to perform the interrupt. */
interrupt: function f(){ interrupt: function f(){
if(!f._) f._ = sqlite3.capi.wasm.xWrap('fiddle_interrupt', null); if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_interrupt', null);
stdout("Requesting interrupt."); stdout("Requesting interrupt.");
f._(); f._();
} }
@ -370,9 +370,9 @@
*/ */
sqlite3InitModule(fiddleModule).then((_sqlite3)=>{ sqlite3InitModule(fiddleModule).then((_sqlite3)=>{
sqlite3 = _sqlite3; sqlite3 = _sqlite3;
const dbVfs = sqlite3.capi.wasm.xWrap('fiddle_db_vfs', "*", ['string']); const dbVfs = sqlite3.wasm.xWrap('fiddle_db_vfs', "*", ['string']);
fiddleModule.fsUnlink = (fn)=>{ fiddleModule.fsUnlink = (fn)=>{
return sqlite3.capi.wasm.sqlite3_wasm_vfs_unlink(dbVfs(0), fn); return sqlite3.wasm.sqlite3_wasm_vfs_unlink(dbVfs(0), fn);
}; };
wMsg('fiddle-ready'); wMsg('fiddle-ready');
})/*then()*/; })/*then()*/;

View File

@ -4,11 +4,17 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<script src="jswasm/sqlite3.js"></script>
<title>sqlite3 Module Symbols</title> <title>sqlite3 Module Symbols</title>
</head> </head>
<body> <body>
<div class="fossil-doc" data-title="sqlite3 Module Symbols">
<div class="fossil-doc" data-title="sqlite3 Module Symbols"><!-- EXTRACT_BEGIN -->
<!--
The part of this doc wrapped in div.fossil-doc gets snipped out
from the canonical copy in the main tree (ext/wasm/module-symbols.html)
and added to the wasm docs repository, where it's served from
fossil.
-->
<style> <style>
.pseudolist { .pseudolist {
column-count: auto; column-count: auto;
@ -85,7 +91,7 @@
<p>Jump to...</p> <p>Jump to...</p>
<ul> <ul>
<li><a href='#sqlite3-namespace'><code>sqlite3</code> namespace</a></li> <li><a href='#sqlite3-namespace'><code>sqlite3</code> namespace</a></li>
<li><a href='#sqlite3-version'><code>sqlite3.version</code></a></li> <li><a href='#sqlite3-version'><code>sqlite3.version</code> object</a></li>
<li><a href='#sqlite3-functions'><code>sqlite3_...()</code> functions</a></li> <li><a href='#sqlite3-functions'><code>sqlite3_...()</code> functions</a></li>
<li><a href='#sqlite3-constants'><code>SQLITE_...</code> functions</a></li> <li><a href='#sqlite3-constants'><code>SQLITE_...</code> functions</a></li>
<li><a href='#sqlite3.oo1'><code>sqlite3.oo1</code></a> <li><a href='#sqlite3.oo1'><code>sqlite3.oo1</code></a>
@ -94,8 +100,8 @@
<li><a href='#sqlite3.oo1.Stmt'><code>sqlite3.oo1.Stmt</code></a></li> <li><a href='#sqlite3.oo1.Stmt'><code>sqlite3.oo1.Stmt</code></a></li>
</ul--> </ul-->
</li> </li>
<li><a href='#sqlite3.capi.wasm'><code>sqlite3.capi.wasm</code></a></li> <li><a href='#sqlite3.wasm'><code>sqlite3.wasm</code> namespace</a></li>
<li><a href='#sqlite3.capi.wasm.pstack'><code>sqlite3.capi.wasm.pstack</code></a></li> <li><a href='#sqlite3.wasm.pstack'><code>sqlite3.wasm.pstack</code> namespace</a></li>
<li><a href='#compile-options'>Compilation options used in this module build.</a></li> <li><a href='#compile-options'>Compilation options used in this module build.</a></li>
</ul> </ul>
@ -107,7 +113,7 @@
<div id='list-namespace' class='pseudolist'></div> <div id='list-namespace' class='pseudolist'></div>
<a id="sqlite3-version"></a> <a id="sqlite3-version"></a>
<h1><code>sqlite3.version</code></h1> <h1><code>sqlite3.version</code> Object</h1>
<p> <p>
The <code>sqlite3.version</code> object exposes the following... The <code>sqlite3.version</code> object exposes the following...
</p> </p>
@ -116,7 +122,7 @@
<a id="sqlite3-functions"></a> <a id="sqlite3-functions"></a>
<h1><code>sqlite3_...()</code> Function List</h1> <h1><code>sqlite3_...()</code> Function List</h1>
<p>The <code>sqlite3.capi</code> object exposes the following <p>The <code>sqlite3.capi</code> namespace exposes the following
<a href='https://sqlite.org/c3ref/funclist.html'><code>sqlite3_...()</code> <a href='https://sqlite.org/c3ref/funclist.html'><code>sqlite3_...()</code>
functions</a>... functions</a>...
</p> </p>
@ -129,31 +135,31 @@
<a id="sqlite3-constants"></a> <a id="sqlite3-constants"></a>
<h1><code>SQLITE_...</code> Constants</h1> <h1><code>SQLITE_...</code> Constants</h1>
<p>The <code>sqlite3.capi</code> object exposes the following <p>The <code>sqlite3.capi</code> namespace exposes the following
<a href='https://sqlite.org/c3ref/constlist.html'><code>SQLITE_...</code> <a href='https://sqlite.org/c3ref/constlist.html'><code>SQLITE_...</code>
constants</a>... constants</a>...
</p> </p>
<div id='list-constants' class='pseudolist'></div> <div id='list-constants' class='pseudolist'></div>
<a id="sqlite3.oo1"></a> <a id="sqlite3.oo1"></a>
<h1><code>sqlite3.oo1</code></h1> <h1><code>sqlite3.oo1</code> Namespace</h1>
<p> <p>
The <code>sqlite3.oo1</code> object exposes the following... The <code>sqlite3.oo1</code> namespace exposes the following...
</p> </p>
<div id='list-oo1' class='pseudolist'></div> <div id='list-oo1' class='pseudolist'></div>
<a id="sqlite3.capi.wasm"></a> <a id="sqlite3.wasm"></a>
<h1><code>sqlite3.capi.wasm</code></h1> <h1><code>sqlite3.wasm</code> Namespace</h1>
<p> <p>
The <code>sqlite3.capi.wasm</code> object exposes the The <code>sqlite3.wasm</code> namespace exposes the
following... following...
</p> </p>
<div id='list-wasm' class='pseudolist'></div> <div id='list-wasm' class='pseudolist'></div>
<a id="sqlite3.capi.wasm.pstack"></a> <a id="sqlite3.wasm.pstack"></a>
<h1><code>sqlite3.capi.wasm.pstack</code></h1> <h1><code>sqlite3.wasm.pstack</code> Namespace</h1>
<p> <p>
The <code>sqlite3.capi.wasm.pstack</code> object exposes the The <code>sqlite3.wasm.pstack</code> namespace exposes the
following... following...
</p> </p>
<div id='list-wasm-pstack' class='pseudolist'></div> <div id='list-wasm-pstack' class='pseudolist'></div>
@ -166,6 +172,9 @@
<div id='list-compile-options' class='pseudolist'></div> <div id='list-compile-options' class='pseudolist'></div>
</div><!-- .initially-hidden --> </div><!-- .initially-hidden -->
<script src="jswasm/sqlite3.js">/* This tag MUST be in side the
fossil-doc block so that this part can work without modification in
the wasm docs repo. */</script>
<script>(async function(){ <script>(async function(){
const eNew = (tag,parent)=>{ const eNew = (tag,parent)=>{
const e = document.createElement(tag); const e = document.createElement(tag);
@ -212,7 +221,7 @@
const renderIt = async function(sqlite3){ const renderIt = async function(sqlite3){
self.sqlite3 = sqlite3; self.sqlite3 = sqlite3;
console.warn("sqlite3 installed as global symbol self.sqlite3."); console.warn("sqlite3 installed as global symbol self.sqlite3.");
const capi = sqlite3.capi; const capi = sqlite3.capi, wasm = sqlite3.wasm;
const cmpIcase = (a,b)=>a.toLowerCase().localeCompare(b.toLowerCase()); const cmpIcase = (a,b)=>a.toLowerCase().localeCompare(b.toLowerCase());
const renderX = function(tgtElem, container, keys){ const renderX = function(tgtElem, container, keys){
for(const k of keys.sort(cmpIcase)){ for(const k of keys.sort(cmpIcase)){
@ -253,17 +262,15 @@
const excludeWasm = ['ctype']; const excludeWasm = ['ctype'];
renderX(E('#list-wasm'), renderX(E('#list-wasm'),
capi.wasm, wasm, Object.keys(wasm).filter((v)=>{
Object.keys(capi.wasm)
.filter((v)=>{
return !v.startsWith('sqlite3_wasm_') return !v.startsWith('sqlite3_wasm_')
&& excludeWasm.indexOf(v)<0; && excludeWasm.indexOf(v)<0;
})); }));
const psKeys = Object.keys(capi.wasm.pstack); const psKeys = Object.keys(wasm.pstack);
psKeys.push('pointer','quota','remaining'); psKeys.push('pointer','quota','remaining');
renderX(E('#list-wasm-pstack'), capi.wasm.pstack, psKeys); renderX(E('#list-wasm-pstack'), wasm.pstack, psKeys);
const cou = capi.wasm.compileOptionUsed(); const cou = wasm.compileOptionUsed();
renderX(E('#list-compile-options'), cou, Object.keys(cou)); renderX(E('#list-compile-options'), cou, Object.keys(cou));
}; };
@ -303,5 +310,5 @@
}/*myModule*/; }/*myModule*/;
self.sqlite3InitModule(myModule).then(renderIt); self.sqlite3InitModule(myModule).then(renderIt);
})();</script> })();</script>
</div><!-- .fossil-doc --> </div><!-- .fossil-doc EXTRACT_END -->
</body></html> </body></html>

View File

@ -37,7 +37,7 @@
const runTests = function(sqlite3){ const runTests = function(sqlite3){
const capi = sqlite3.capi, const capi = sqlite3.capi,
oo = sqlite3.oo1, oo = sqlite3.oo1,
wasm = capi.wasm; wasm = sqlite3.wasm;
stdout("Loaded sqlite3:",capi.sqlite3_libversion(), capi.sqlite3_sourceid()); stdout("Loaded sqlite3:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
const persistentDir = capi.sqlite3_wasmfs_opfs_dir(); const persistentDir = capi.sqlite3_wasmfs_opfs_dir();
if(persistentDir){ if(persistentDir){

View File

@ -31,7 +31,7 @@
<div id='toolbar-select'> <div id='toolbar-select'>
<select id='select-flags' size='10' multiple></select> <select id='select-flags' size='10' multiple></select>
<div>The following flags can be passed as URL parameters: <div>The following flags can be passed as URL parameters:
vfs=NAME, size=N, journal=MODE, cachesize=BYTES vfs=NAME, size=N, journal=MODE, cachesize=SIZE
</div> </div>
</div> </div>
<div class='toolbar-inner-vertical'> <div class='toolbar-inner-vertical'>

View File

@ -86,11 +86,11 @@
self.sqlite3InitModule(EmscriptenModule).then((sqlite3)=>{ self.sqlite3InitModule(EmscriptenModule).then((sqlite3)=>{
const S = sqlite3; const S = sqlite3;
App.vfsUnlink = function(pDb, fname){ App.vfsUnlink = function(pDb, fname){
const pVfs = S.capi.wasm.sqlite3_wasm_db_vfs(pDb, 0); const pVfs = S.wasm.sqlite3_wasm_db_vfs(pDb, 0);
if(pVfs) S.capi.wasm.sqlite3_wasm_vfs_unlink(pVfs, fname||0); if(pVfs) S.wasm.sqlite3_wasm_vfs_unlink(pVfs, fname||0);
}; };
App.pDir = wasmfsDir(S.wasm); App.pDir = wasmfsDir(S.wasm);
App.wasm = S.capi.wasm; App.wasm = S.wasm;
//if(App.pDir) log("Persistent storage:",pDir); //if(App.pDir) log("Persistent storage:",pDir);
//else log("Using transient storage."); //else log("Using transient storage.");
mPost('ready',true); mPost('ready',true);

View File

@ -92,7 +92,7 @@
}; };
const runTests = function(sqlite3){ const runTests = function(sqlite3){
const capi = sqlite3.capi, wasm = capi.wasm; const capi = sqlite3.capi, wasm = sqlite3.wasm;
//console.debug('sqlite3 =',sqlite3); //console.debug('sqlite3 =',sqlite3);
const pDir = wasmfsDir(wasm); const pDir = wasmfsDir(wasm);
if(pDir){ if(pDir){

View File

@ -44,7 +44,7 @@
/* Predicate for tests/groups. */ /* Predicate for tests/groups. */
const testIsTodo = ()=>false; const testIsTodo = ()=>false;
const haveWasmCTests = ()=>{ const haveWasmCTests = ()=>{
return !!wasm.exports.sqlite3_wasm_test_int64_max; return !!wasm.exports.sqlite3_wasm_test_intptr;
}; };
{ {
const mapToString = (v)=>{ const mapToString = (v)=>{
@ -358,7 +358,7 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
T.g('C/WASM Utilities') T.g('C/WASM Utilities')
.t('sqlite3.capi.wasm', function(sqlite3){ .t('sqlite3.wasm namespace', function(sqlite3){
const w = wasm; const w = wasm;
const chr = (x)=>x.charCodeAt(0); const chr = (x)=>x.charCodeAt(0);
//log("heap getters..."); //log("heap getters...");
@ -587,7 +587,7 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
.t('sqlite3.StructBinder (jaccwabyt)', function(sqlite3){ .t('sqlite3.StructBinder (jaccwabyt)', function(sqlite3){
const S = sqlite3, W = S.capi.wasm; const S = sqlite3, W = S.wasm;
const MyStructDef = { const MyStructDef = {
sizeof: 16, sizeof: 16,
members: { members: {
@ -766,7 +766,6 @@
.t('sqlite3.StructBinder part 2', function(sqlite3){ .t('sqlite3.StructBinder part 2', function(sqlite3){
// https://www.sqlite.org/c3ref/vfs.html // https://www.sqlite.org/c3ref/vfs.html
// https://www.sqlite.org/c3ref/io_methods.html // https://www.sqlite.org/c3ref/io_methods.html
const W = wasm;
const sqlite3_io_methods = capi.sqlite3_io_methods, const sqlite3_io_methods = capi.sqlite3_io_methods,
sqlite3_vfs = capi.sqlite3_vfs, sqlite3_vfs = capi.sqlite3_vfs,
sqlite3_file = capi.sqlite3_file; sqlite3_file = capi.sqlite3_file;
@ -792,7 +791,7 @@
this.__ondispose.forEach( this.__ondispose.forEach(
(v)=>{ (v)=>{
if('number'===typeof v){ if('number'===typeof v){
try{capi.wasm.uninstallFunction(v)} try{wasm.uninstallFunction(v)}
catch(e){/*ignore*/} catch(e){/*ignore*/}
}else{/*wasm function wrapper property*/ }else{/*wasm function wrapper property*/
delete who[v]; delete who[v];
@ -812,7 +811,7 @@
tgt.__ondispose = []; tgt.__ondispose = [];
} }
const fProxy = callee.argcProxy(func, sigN); const fProxy = callee.argcProxy(func, sigN);
const pFunc = capi.wasm.installFunction(fProxy, tgt.memberSignature(name, true)); const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name, true));
tgt[memKey] = pFunc; tgt[memKey] = pFunc;
/** /**
ACHTUNG: function pointer IDs are from a different pool than ACHTUNG: function pointer IDs are from a different pool than
@ -868,7 +867,7 @@
/* int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) */ /* int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) */
log("xRead(",arguments,")"); log("xRead(",arguments,")");
if(!(f = instm._requireFileArg(f))) return capi.SQLITE_MISUSE; if(!(f = instm._requireFileArg(f))) return capi.SQLITE_MISUSE;
capi.wasm.heap8().fill(0, dest + offset, n); wasm.heap8().fill(0, dest + offset, n);
return 0; return 0;
}, },
xWrite: /*i(Ppij)*/function(f,dest,n,offset){ xWrite: /*i(Ppij)*/function(f,dest,n,offset){
@ -893,7 +892,7 @@
/* int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize) */ /* int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize) */
log("xFileSize(",arguments,")"); log("xFileSize(",arguments,")");
if(!(f=instm._requireFileArg(f,'xFileSize'))) return capi.SQLITE_MISUSE; if(!(f=instm._requireFileArg(f,'xFileSize'))) return capi.SQLITE_MISUSE;
capi.wasm.setMemValue(pSz, 0/*file size*/); wasm.setMemValue(pSz, 0/*file size*/);
return 0; return 0;
}, },
xLock: /*i(Pi)*/function(f){ xLock: /*i(Pi)*/function(f){
@ -973,7 +972,7 @@
.assert(dVfs.$iVersion>0) .assert(dVfs.$iVersion>0)
.assert('number'===typeof dVfs.$zName) .assert('number'===typeof dVfs.$zName)
.assert('number'===typeof dVfs.$xSleep) .assert('number'===typeof dVfs.$xSleep)
.assert(capi.wasm.functionEntry(dVfs.$xOpen)) .assert(wasm.functionEntry(dVfs.$xOpen))
.assert(dVfs.memberIsString('zName')) .assert(dVfs.memberIsString('zName'))
.assert(dVfs.memberIsString('$zName')) .assert(dVfs.memberIsString('$zName'))
.assert(!dVfs.memberIsString('pAppData')) .assert(!dVfs.memberIsString('pAppData'))
@ -999,7 +998,7 @@
} }
//log(prefix, sep, val); //log(prefix, sep, val);
}else{ }else{
//log(prefix," = funcptr @",addr, capi.wasm.functionEntry(addr)); //log(prefix," = funcptr @",addr, wasm.functionEntry(addr));
} }
}); });
}finally{ }finally{
@ -1009,8 +1008,8 @@
}/*StructBinder part 2*/) }/*StructBinder part 2*/)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
.t('sqlite3.capi.wasm.pstack', function(sqlite3){ .t('sqlite3.wasm.pstack', function(sqlite3){
const w = sqlite3.capi.wasm, P = w.pstack; const P = wasm.pstack;
const isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError; const isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError;
const stack = P.pointer; const stack = P.pointer;
T.assert(0===stack % 8 /* must be 8-byte aligned */); T.assert(0===stack % 8 /* must be 8-byte aligned */);
@ -1116,7 +1115,7 @@
T.g('sqlite3.oo1') T.g('sqlite3.oo1')
.t('Create db', function(sqlite3){ .t('Create db', function(sqlite3){
const dbFile = '/tester1.db'; const dbFile = '/tester1.db';
sqlite3.capi.wasm.sqlite3_wasm_vfs_unlink(0, dbFile); wasm.sqlite3_wasm_vfs_unlink(0, dbFile);
const db = this.db = new sqlite3.oo1.DB(dbFile); const db = this.db = new sqlite3.oo1.DB(dbFile);
T.assert(Number.isInteger(db.pointer)). T.assert(Number.isInteger(db.pointer)).
mustThrowMatching(()=>db.pointer=1, /read-only/). mustThrowMatching(()=>db.pointer=1, /read-only/).
@ -1233,7 +1232,7 @@
T.assert(2 === list.length) T.assert(2 === list.length)
.assert('string'===typeof list[1]) .assert('string'===typeof list[1])
.assert(4===db.changes()); .assert(4===db.changes());
if(capi.wasm.bigIntEnabled){ if(wasm.bigIntEnabled){
T.assert(4n===db.changes(false,true)); T.assert(4n===db.changes(false,true));
} }
let blob = db.selectValue("select b from t where a='blob'"); let blob = db.selectValue("select b from t where a='blob'");
@ -1270,8 +1269,8 @@
db.selectValue("SELECT "+Number.MIN_SAFE_INTEGER)). db.selectValue("SELECT "+Number.MIN_SAFE_INTEGER)).
assert(Number.MAX_SAFE_INTEGER === assert(Number.MAX_SAFE_INTEGER ===
db.selectValue("SELECT "+Number.MAX_SAFE_INTEGER)); db.selectValue("SELECT "+Number.MAX_SAFE_INTEGER));
if(capi.wasm.bigIntEnabled && haveWasmCTests()){ if(wasm.bigIntEnabled && haveWasmCTests()){
const mI = capi.wasm.xCall('sqlite3_wasm_test_int64_max'); const mI = wasm.xCall('sqlite3_wasm_test_int64_max');
const b = BigInt(Number.MAX_SAFE_INTEGER * 2); const b = BigInt(Number.MAX_SAFE_INTEGER * 2);
T.assert(b === db.selectValue("SELECT "+b)). T.assert(b === db.selectValue("SELECT "+b)).
assert(b === db.selectValue("SELECT ?", b)). assert(b === db.selectValue("SELECT ?", b)).
@ -1742,7 +1741,7 @@
//console.log('sqlite3 =',sqlite3); //console.log('sqlite3 =',sqlite3);
log("Done initializing WASM/JS bits. Running tests..."); log("Done initializing WASM/JS bits. Running tests...");
capi = sqlite3.capi; capi = sqlite3.capi;
wasm = capi.wasm; wasm = sqlite3.wasm;
log("sqlite3 version:",capi.sqlite3_libversion(), log("sqlite3 version:",capi.sqlite3_libversion(),
capi.sqlite3_sourceid()); capi.sqlite3_sourceid());
if(wasm.bigIntEnabled){ if(wasm.bigIntEnabled){

View File

@ -1,5 +1,5 @@
C Fix\sharmless\scompiler\swarnings\sin\stesting\scode. C Move\sthe\ssqlite3.capi.wasm\snamespace\sto\ssqlite3.wasm.\sThis\scauses\sa\stiny\sbit\sof\snaming\sconfusion\swith\sthe\ssqlite3.wasm\s*file*,\sbut\sseems\sto\smake\smore\ssense\sthan\shaving\sit\sas\sa\ssub-namespace\sof\scapi.
D 2022-10-28T18:52:05.114 D 2022-10-29T07:54:10.497
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -487,7 +487,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 7a8c06f9bdbb791f8ef084ecd47e099da81e5797b9b1d60e33ac9a07eedd5dbd F ext/wasm/GNUmakefile 10fabfc07b7eba712dee566de7e62569b020ab11a4dfa5e9bea205fc28f47516
F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20 F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20
F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066 F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 9120c2f8f51fa85f46dcf4dcb6b12f4a807d428f6089b99cdb08d8ddfcfd88b2
@ -498,20 +498,20 @@ F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1 F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b
F ext/wasm/api/pre-js.js 151e0616614a49f3db19ed544fa13b38c87c108959fbcd4029ea8399a562d94f F ext/wasm/api/pre-js.js 151e0616614a49f3db19ed544fa13b38c87c108959fbcd4029ea8399a562d94f
F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588 F ext/wasm/api/sqlite3-api-cleanup.js ecdc69dbfccfe26146f04799fcfd4a6f5790d46e7e3b9b6e9b0491f92ed8ae34
F ext/wasm/api/sqlite3-api-glue.js c47e86a1b91917cf37de8386e4a94669612565df7f35a5ad7e04028330e5db54 F ext/wasm/api/sqlite3-api-glue.js b87543534821ecfa56fc0d0cd153a115fa974e70d6217964baf6e93ef8d25fb1
F ext/wasm/api/sqlite3-api-oo1.js 9ae79193d05712f9883a3e1a1a54f0620354aeb85fef5850fad5e4a9437a5b4d F ext/wasm/api/sqlite3-api-oo1.js 612063da9838286310712c5411f97b8b20759b1e31e75a9b25b6381541db79a8
F ext/wasm/api/sqlite3-api-opfs.js a4316c04b2eb6ae69fc9a8b33f1d0ff22a0398665d98e6504ee13221cbf5cc5b F ext/wasm/api/sqlite3-api-opfs.js c67cbe0b1451ec43bc6b3199e13453e1ca56d718a75c0498253b0d479c336256
F ext/wasm/api/sqlite3-api-prologue.js 9ca7f1636cc401354e12c13b1f537a1ad9e024c6c0fddfa216f4aabf00bf206b F ext/wasm/api/sqlite3-api-prologue.js a218dda5e5ced8894f65760131371e4cabd31062af58803af8952cc00ea778d2
F ext/wasm/api/sqlite3-api-worker1.js b2d650514ccc75f80dff666fd3ee68dc8fb4137bcd01caac2c62ff93a7ebf638 F ext/wasm/api/sqlite3-api-worker1.js efdca1b42299d80b54f366d15a8fc5343f3b3e9e3647e5c1fd6f3ee1015e501b
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js f04cb1eb483c92bc61fe02749f7afcf17ec803968171aedd7d96faf428c26bcb F ext/wasm/api/sqlite3-opfs-async-proxy.js f04cb1eb483c92bc61fe02749f7afcf17ec803968171aedd7d96faf428c26bcb
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c 940d576bda7068ba60492e206d06a3567b8a89a3770700aa88690a6e246a0c78 F ext/wasm/api/sqlite3-wasm.c 940d576bda7068ba60492e206d06a3567b8a89a3770700aa88690a6e246a0c78
F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
F ext/wasm/api/sqlite3-worker1.js dbe54b69c1520a2d25eae148cd2750ded2dd7f219ea4ee46f83e0a851dca5974 F ext/wasm/api/sqlite3-worker1.js 1e54ea3d540161bcfb2100368a2fc0cad871a207b8336afee1c445715851ec54
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 5bae81684728b6be157d1f92b39824153f0fd019345b39f2ab8930f7ee2a57d8 F ext/wasm/batch-runner.js 49609e89aaac9989d6c1ad3fae268e4878e1ad7bc5fd3e5c2f44959660780b2e
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
F ext/wasm/common/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/common/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/common/testing.css 739b58c44511f642f16f57b701c84dc9ee412d8bc47b3d8a99d947babfa69d9d F ext/wasm/common/testing.css 739b58c44511f642f16f57b701c84dc9ee412d8bc47b3d8a99d947babfa69d9d
@ -520,7 +520,7 @@ F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba9455
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508 F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6 F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e
F ext/wasm/demo-jsstorage.js 105596bd2ccd0b1deb5fde8e99b536e8242d4bb5932fac0c8403ff3a6bc547e8 F ext/wasm/demo-jsstorage.js 44e3ae7ec2483b6c511384c3c290beb6f305c721186bcf5398ca4e00004a06b8
F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98ab22f5786620b3354ed15f F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98ab22f5786620b3354ed15f
F ext/wasm/demo-worker1-promiser.js f68ffbbe1c6086e18ce7961b8fc2b40dd88db174f59052e228c06b07484945ca F ext/wasm/demo-worker1-promiser.js f68ffbbe1c6086e18ce7961b8fc2b40dd88db174f59052e228c06b07484945ca
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
@ -528,20 +528,20 @@ F ext/wasm/demo-worker1.js 8ba51d94c4601fa5c313d9e59b63b238f5305b5d5739ad21f4782
F ext/wasm/dist.make b687dc07db2dc9669369f126ac42c4ff6539dce2531063a0e75405c74a3cee1d F ext/wasm/dist.make b687dc07db2dc9669369f126ac42c4ff6539dce2531063a0e75405c74a3cee1d
F ext/wasm/fiddle.make 68abe5dcfdd6fdf8dc1b715b94b96fae771b5b28bc1843997b9b1ec79407f2c9 F ext/wasm/fiddle.make 68abe5dcfdd6fdf8dc1b715b94b96fae771b5b28bc1843997b9b1ec79407f2c9
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/fiddle/fiddle-worker.js 41b9796d689fabbef1ad9447496d14645eeb4101b534e54951fa5259c877c341 F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d
F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715
F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
F ext/wasm/index-dist.html cb0da16cba0f21cda2c25724c5869102d48eb0af04446acd3cd0ca031f80ed19 F ext/wasm/index-dist.html cb0da16cba0f21cda2c25724c5869102d48eb0af04446acd3cd0ca031f80ed19
F ext/wasm/index.html ce6a68a75532b47e3c0adb83381a06d15de8c0ac0331fb7bf31d33f8e7c77dc4 F ext/wasm/index.html ce6a68a75532b47e3c0adb83381a06d15de8c0ac0331fb7bf31d33f8e7c77dc4
F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215 F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215
F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e
F ext/wasm/module-symbols.html e521cf07f8d136748e60d91e49b7b956e8bd56c58fc52acbe5ad58eaeaacf719 F ext/wasm/module-symbols.html 25f6d585ef1d5034447701f18e972c2f3b98785250c9036cef93a4e36648d178
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06 F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
F ext/wasm/scratchpad-wasmfs-main.js 1841c124a58e3f9e7ee580a0868d6e1834c5a01dbb47c8fdd565eda5db362437 F ext/wasm/scratchpad-wasmfs-main.js 4c140457f4d6da9d646a49addd91edb6e9ad1643c6c48e3258b5bce24725dc18
F ext/wasm/speedtest1-wasmfs.html bc28eb29b69a73864b8d7aae428448f8b7e1de81d8bfb9bba99541322054dbd0 F ext/wasm/speedtest1-wasmfs.html bc28eb29b69a73864b8d7aae428448f8b7e1de81d8bfb9bba99541322054dbd0
F ext/wasm/speedtest1-worker.html 7b0cceab6a68b2883738e19f61d21620fe1244ba36c1b2e38d0efde57ecce86d F ext/wasm/speedtest1-worker.html 94246488e10af9daa1ebd0979b1b8d7a22a579e5a983fa2a5ad94591ecf55f2c
F ext/wasm/speedtest1-worker.js 942af0909dee6e6a43af85d3e4a5e6aa74956290ca4b78fd4e753be13673ccd6 F ext/wasm/speedtest1-worker.js 13b57c4a41729678a1194014afec2bd5b94435dcfc8d1039dfa9a533ac819ee1
F ext/wasm/speedtest1.html 3b3321eee32b6becf0b2134fd8f17db5802b400b8233c3537527d3c46e4e17b9 F ext/wasm/speedtest1.html e4c4e5c1c8ec1ad13c995e346e4216a1df152fd2c5cd17e0793b865b2f3c5000
F ext/wasm/split-speedtest1-script.sh a3e271938d4d14ee49105eb05567c6a69ba4c1f1293583ad5af0cd3a3779e205 x F ext/wasm/split-speedtest1-script.sh a3e271938d4d14ee49105eb05567c6a69ba4c1f1293583ad5af0cd3a3779e205 x
F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d82675bd63d9c2d97a15f0 F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d82675bd63d9c2d97a15f0
F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5 F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5
@ -549,7 +549,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js 48fc59110e8775bb43c9be25b6d634fc07ebadab7da8fbd44889e8129c6e2548 F ext/wasm/test-opfs-vfs.js 48fc59110e8775bb43c9be25b6d634fc07ebadab7da8fbd44889e8129c6e2548
F ext/wasm/tester1-worker.html d02b9d38876b023854cf8955e77a40912f7e516956b4dbe1ec7f215faac273ee F ext/wasm/tester1-worker.html d02b9d38876b023854cf8955e77a40912f7e516956b4dbe1ec7f215faac273ee
F ext/wasm/tester1.html c6c47e5a8071eb09cb1301104435c8e44fbb5719c92411f5b2384a461f9793c5 F ext/wasm/tester1.html c6c47e5a8071eb09cb1301104435c8e44fbb5719c92411f5b2384a461f9793c5
F ext/wasm/tester1.js 2b971e6dd291513685f38552340adc1d2e09f7b0a5bccf21c81f8037d6242bf3 F ext/wasm/tester1.js 679013b874152427d302e56f78bf542c47a090a85c8ca010bb4002859431cf61
F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5 F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5
F ext/wasm/wasmfs.make ee0004813e16c283ff633e08b482008d56adf9b7d42f6c5612f7ab002b924f69 F ext/wasm/wasmfs.make ee0004813e16c283ff633e08b482008d56adf9b7d42f6c5612f7ab002b924f69
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
@ -2054,8 +2054,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P e65c5bdc5bd6e1989c3de59798ff0a761125fc490fdec8c7671ca70ed688c4f8 P 2f53612388507f9b1ecbec3c15281825beab54b8062d97d0ab6f009c5fed347b
R 2092bbb0212ed06397996f6b20b31c55 R d0f4845aee84bee01e10da61e480927d
U drh U stephan
Z 91f846334499b4960f1a923dbe22c496 Z c420db9475e5b45210b3c19ba7dfb33a
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
2f53612388507f9b1ecbec3c15281825beab54b8062d97d0ab6f009c5fed347b 3f16eb18d6186ca972fca952ccac18649e7a905213f589e53c0c9333e695448d