objects as storage.
It uses a bespoke ASCII encoding to store each db page as a
- separate record and stores some metadata, like the db's encoded
+ separate record and stores some metadata, like the db's unencoded
size and its journal, as individual records.
kvvfs is significantly less efficient than a plain in-memory db but
xOpen: function(pProtoVfs,zName,pProtoFile,flags,pOutFlags){
try{
//cache.zReadBuf ??= wasm.malloc(kvvfsMethods.$nBufferSize);
+ if( !zName ){
+ zName = (cache.zEmpty ??= wasm.allocCString(""));
+ }
const n = wasm.cstrlen(zName);
if( n > kvvfsMethods.$nKeySize - 8 /*"-journal"*/ - 1 ){
warn("file name is too long:", wasm.cstrToJs(zName));
return capi.SQLITE_RANGE;
}
- //wasm.poke32(pOutFlags, flags | sqlite3.SQLITE_OPEN_CREATE);
+ const jzClass = wasm.cstrToJs(zName);
+ if( jzClass?.length != n ){
+ warn("kvvfs file name must be ASCII-only");
+ /* This limitation is to avoide any issues with
+ truncating multi-byte characters in kvvfs's key-size
+ limit. */
+ return capi.SQLITE_RANGE;
+ }
const rc = originalMethods.vfs.xOpen(pProtoVfs, zName, pProtoFile,
flags, pOutFlags);
if( rc ) return rc;
const f = new KVVfsFile(pProtoFile);
util.assert(f.$zClass, "Missing f.$zClass");
- const jzClass = wasm.cstrToJs(zName);
let s = storageForZClass(jzClass);
//debug("xOpen", jzClass, s);
if( s ){
around forever so that future xOpen()s get the same
Storage-ish objects. We can accomplish that by
simply increasing the refcount once more. */
+ wasm.poke32(pOutFlags, flags | sqlite3.SQLITE_OPEN_CREATE);
util.assert( !f.$isJournal, "Opening a journal before its db? "+jzClass );
+ /* Map both zName and zName-journal to the same storage. */
const other = f.$isJournal
? jzClass.replace(cache.rxJournalSuffix,'')
: jzClass + '-journal';
s.setItem(keyPrefix+'sz', exp.size);
if( exp.journal ) s.setItem(keyPrefix+'jrnl', exp.journal);
exp.pages.forEach((v,ndx)=>s.setItem(keyPrefix+(ndx+1), v));
- s.getItem("")/*kludge: for KVVfsStorage to reset its keys*/;
+ //s.getItem("")/*kludge: for KVVfsStorage to reset its keys*/;
}catch(e){
capi.sqlite3_js_kvvfs_clear(exp.name);
throw e;
-C Get\skvvfs\sv2\sstorage\simport\sworking\sby\sdisallowing\sit\swhen\sthere\sare\sopened\sdb/journal\shandles.\sMove\simport/export\sout\sof\sthe\sJsStorageDb\sclass\sand\sinto\ssqlite3_js_kvvfs_import/export_storage().
-D 2025-11-24T15:17:52.331
+C Have\skvvfs\senforce\sASCII-only\snames\sto\savoid\struncating\smultibyte\scharacters\sin\skvvfs's\skey\sbuffer.
+D 2025-11-24T18:08:25.957
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
-F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js efe13bc4196b02a87d6a472c7c7826c335c82cd5a844381f017813d4f78e1397
+F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js 71e9e242c52ae883cb01513dee99f8cfa4b5baab938006dc36e0dfade37107c7
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 26cb41d5a62f46a106b6371eb00fef02de3cdbfaa51338ba087a45f53028e0d0
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 88ce2078267a2d1af57525a32d896295f4a8db7664de0e17e82dc9ff006ed8d3
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 9097074724172e31e56ce20ccd7482259cf72a76124213cbc9469d757676da86
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 4857c9d2fe428c19319244bf0589eaf93c124f020a633d6b7d40d35aaf969d24
-R f6b4509896384b2525280dbe96143648
+P c9e0b32278290baf987b5a46bd47358439e3d0f190b2879a965d6e4262ea7baf
+R 1c382103cfb0141648b7dd4e5588803c
U stephan
-Z 5db1ea489dc4ed416d893c241ae0c76d
+Z 4eeb1eaa667084f54349e0f6be023c0d
# Remove this line to create a well-formed Fossil manifest.