const jKey = wasm.cstrToJs(zXKey);
const jV = kvvfsStorage(zClass).getItem(jKey);
if(!jV) return -1;
- const nV = jV.length /* Note that we are relying 100% on v being
- ASCII so that jV.length is equal to the
- C-string's byte length. */;
+ const nV = jV.length /* We are relying 100% on v being
+ ASCII so that jV.length is equal
+ to the C-string's byte length. */;
if(nBuf<=0) return nV;
else if(1===nBuf){
wasm.poke(zBuf, 0);
}
const zV = wasm.scopedAllocCString(jV);
if(nBuf > nV + 1) nBuf = nV + 1;
- wasm.heap8u().copyWithin(zBuf, zV, zV + nBuf - 1);
- wasm.poke(zBuf + nBuf - 1, 0);
+ wasm.heap8u().copyWithin(
+ Number(zBuf), Number(zV), Number(wasm.ptrAdd(zV, nBuf,- 1))
+ );
+ wasm.poke(wasm.ptrAdd(zBuf, nBuf, -1), 0);
return nBuf - 1;
}catch(e){
- console.error("kvstorageRead()",e);
+ sqlite3.config.error("kvstorageRead()",e);
return -2;
}finally{
pstack.restore(stack);
kvvfsStorage(zClass).setItem(jKey, wasm.cstrToJs(zData));
return 0;
}catch(e){
- console.error("kvstorageWrite()",e);
+ sqlite3.config.error("kvstorageWrite()",e);
return capi.SQLITE_IOERR;
}finally{
pstack.restore(stack);
kvvfsStorage(zClass).removeItem(wasm.cstrToJs(zXKey));
return 0;
}catch(e){
- console.error("kvstorageDelete()",e);
+ sqlite3.config.error("kvstorageDelete()",e);
return capi.SQLITE_IOERR;
}finally{
pstack.restore(stack);
&& navigator?.storage?.getDirectory;
};
+ const skipIn64BitBuild = function(){
+//#if sMEMORY64=1
+ error("Skipping known-broken tests for 64-bit build"); return true;
+//#else
+ return false;
+//#endif
+ };
+
{
const mapToString = (v)=>{
switch(typeof v){
////////////////////////////////////////////////////////////////////////
.t({
name: 'virtual table #1: eponymous w/ manual exception handling',
- predicate: (sqlite3)=>!!sqlite3.capi.sqlite3_vtab || "Missing vtab support",
+ predicate: (sqlite3)=>(!!sqlite3.capi.sqlite3_vtab || "Missing vtab support"),
test: function(sqlite3){
+ if( skipIn64BitBuild() ) return;
const VT = sqlite3.vtab;
const tmplCols = Object.assign(Object.create(null),{
A: 0, B: 1
*/
const tmplMod = new sqlite3.capi.sqlite3_module();
T.assert(!tmplMod.$xUpdate);
+ const dbg = 1 ? ()=>{} : sqlite3.config.debug;
tmplMod.setupModule({
catchExceptions: false,
methods: {
xConnect: function(pDb, pAux, argc, argv, ppVtab, pzErr){
+ dbg("xConnect",...arguments);
try{
const args = wasm.cArgvToJs(argc, argv);
T.assert(args.length>=3)
.assert(args[0] === 'testvtab')
.assert(args[1] === 'main')
.assert(args[2] === 'testvtab');
- //console.debug("xConnect() args =",args);
const rc = capi.sqlite3_declare_vtab(
pDb, "CREATE TABLE ignored(a,b)"
);
},
xCreate: true /* just for testing. Will be removed afterwards. */,
xDisconnect: function(pVtab){
+ dbg("xDisconnect",...arguments);
try {
VT.xVtab.unget(pVtab).dispose();
return 0;
}
},
xOpen: function(pVtab, ppCursor){
+ dbg("xOpen",...arguments);
try{
const t = VT.xVtab.get(pVtab),
c = VT.xCursor.create(ppCursor);
}
},
xClose: function(pCursor){
+ dbg("xClose",...arguments);
try{
const c = VT.xCursor.unget(pCursor);
T.assert(c instanceof capi.sqlite3_vtab_cursor)
}
},
xNext: function(pCursor){
+ dbg("xNext",...arguments);
try{
const c = VT.xCursor.get(pCursor);
++c._rowId;
}
},
xColumn: function(pCursor, pCtx, iCol){
+ dbg("xColumn",...arguments);
try{
const c = VT.xCursor.get(pCursor);
switch(iCol){
}
},
xRowid: function(pCursor, ppRowid64){
+ dbg("xRowid",...arguments);
try{
const c = VT.xCursor.get(pCursor);
VT.xRowid(ppRowid64, c._rowId);
}
},
xEof: function(pCursor){
+ dbg("xEof",...arguments);
const c = VT.xCursor.get(pCursor),
rc = c._rowId>=10;
return rc;
},
xFilter: function(pCursor, idxNum, idxCStr,
argc, argv/* [sqlite3_value* ...] */){
+ dbg("xFilter",...arguments);
try{
const c = VT.xCursor.get(pCursor);
c._rowId = 0;
}
},
xBestIndex: function(pVtab, pIdxInfo){
+ dbg("xBestIndex",...arguments);
try{
//const t = VT.xVtab.get(pVtab);
const sii = capi.sqlite3_index_info;
});
this.db.onclose.disposeAfter.push(tmplMod);
T.assert(!tmplMod.$xUpdate)
- .assert(tmplMod.$xCreate)
+ .assert(wasm.isPtr(tmplMod.$xRowid))
+ .assert(wasm.isPtr(tmplMod.$xCreate))
.assert(tmplMod.$xCreate === tmplMod.$xConnect,
"setup() must make these equivalent and "+
"installMethods() must avoid re-compiling identical functions");
name: 'virtual table #2: non-eponymous w/ automated exception wrapping',
predicate: (sqlite3)=>!!sqlite3.capi.sqlite3_vtab || "Missing vtab support",
test: function(sqlite3){
+ if( skipIn64BitBuild() ) return;
const VT = sqlite3.vtab;
const tmplCols = Object.assign(Object.create(null),{
A: 0, B: 1
test: function(sqlite3){
const filename = this.kvvfsDbFile = 'session';
const pVfs = capi.sqlite3_vfs_find('kvvfs');
- T.assert(pVfs);
+ T.assert(looksLikePtr(pVfs));
const JDb = this.JDb = sqlite3.oo1.JsStorageDb;
const unlink = this.kvvfsUnlink = ()=>JDb.clearStorage(this.kvvfsDbFile);
unlink();
name: "sqlite3_commit/rollback/update_hook()",
predicate: ()=>wasm.bigIntEnabled || "Update hook requires int64",
test: function(sqlite3){
+ if( skipIn64BitBuild() ) return;
let countCommit = 0, countRollback = 0;;
const db = new sqlite3.oo1.DB(':memory:',1 ? 'c' : 'ct');
let rc = capi.sqlite3_commit_hook(db, (p)=>{
+ //console.debug("commit hook",arguments);
++countCommit;
- return (1 === p) ? 0 : capi.SQLITE_ERROR;
- }, 1);
- T.assert( 0 === rc /*void pointer*/ );
+ return (17 == p) ? 0 : capi.SQLITE_ERROR;
+ }, 17);
+ T.assert( wasm.NullPtr === rc );
// Commit hook...
T.assert( 0!=capi.sqlite3_get_autocommit(db) );
// Rollback hook:
rc = capi.sqlite3_rollback_hook(db, (p)=>{
++countRollback;
- T.assert( 2 === p );
- }, 2);
- T.assert( 0 === rc /*void pointer*/ );
+ T.assert( 21 == p );
+ }, 21);
+ T.assert( wasm.NullPtr===rc );
T.mustThrowMatching(()=>{
db.transaction('drop table t',()=>{})
}, (e)=>{
sqlite3.SQLite3Error.toss(capi.SQLITE_FULL,'testing rollback hook');
});
}, (e)=>{
+ //console.error("transaction error:",e);
return capi.SQLITE_FULL === e.resultCode
});
T.assert(1 === countRollback);
default: toss("Unexpected hook operator:",op);
}
}, 3);
+ //wasm.xWrap.debug = true;
db.transaction((d)=>{
d.exec([
"insert into t(a) values(1);",
const countHook = Object.create(null);
let rc = capi.sqlite3_preupdate_hook(
db, function(p, pDb, op, zDb, zTbl, iKey1, iKey2){
- T.assert(9 === p)
+ T.assert(9 == p)
.assert(db.pointer === pDb)
.assert(1 === capi.sqlite3_preupdate_count(pDb))
.assert( 0 > capi.sqlite3_preupdate_blobwrite(pDb) );
-C Get\sseveral\shundred\smore\slines\sof\stester1.js\srunning\sin\s64-bit\smode.
-D 2025-09-20T17:11:57.424
+C Get\sall\sbut\s3\sof\sthe\stester1.js\stest\sgroups\srunning\sin\s64-bit\sbuilds.\sThe\soutliers\sare\svirtual\stables\sand\scommit/rollback/update\shooks.
+D 2025-09-20T18:51:10.168
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/wasm/api/post-js-header.js 53740d824e5d9027eb1e6fd59e216abbd2136740ce260ea5f0699ff2acb0a701
F ext/wasm/api/pre-js.c-pp.js 58f823de197e2c10d76179aa05410a593b7ae03e1ece983bb42ffd818e8857e1
F ext/wasm/api/sqlite3-api-cleanup.js 6341cb85c931044647ad4b12654a178c81f5a8fbeccdf4dc4f258e5a390d2241
-F ext/wasm/api/sqlite3-api-glue.c-pp.js a122488b81054d85c744f20ae0447aa0676b14adcb6f6f9c47ec6344327afbde
-F ext/wasm/api/sqlite3-api-oo1.c-pp.js b926a070fbe9db3ac4f3b0bc5f006aa28350c62e1ec0949643e21f2db191ce5a
+F ext/wasm/api/sqlite3-api-glue.c-pp.js 9efbe88f71835a01469d494533d0df434bc5e21fad8b23c260aa3d22b7a226b6
+F ext/wasm/api/sqlite3-api-oo1.c-pp.js 38839c45ddef480d5407f95a31299f59b8d662b48851469dd2d66cfad478141d
F ext/wasm/api/sqlite3-api-prologue.js 99a5c4a48d26bf3ae6210fe789c1ba9a01106da28b29cd57a03760fd2aef7fdc
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 760191cd13416e6f5adfd9fcc8a97fed5645c9e0a5fbac213a2d4ce2d79a4334
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 0f68a64e508598910e7c01214ae27d603dfc8baec6a184506fafac603a901931
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 4ab0704ee198de7d1059eccedc7703c931510b588d10af0ee36ea5b3ebbac284
-F ext/wasm/api/sqlite3-vtab-helper.c-pp.js fb8335229cf14ef5649f1e0b54c0196854c992441846565fecb75023412f36cd
+F ext/wasm/api/sqlite3-vtab-helper.c-pp.js dbe7f773126ded5e641157410e6a2e218888e53e3fb115f35d748ea5257e9a9c
F ext/wasm/api/sqlite3-wasm.c 75c50e7721136b60e2132537e039f6b85991449c761090709c2d920c4b82f420
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 4ad256b4ff7f839ad18931ed35d46cced544207bd2209665ec552e193f7f4544
F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5
F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
-F ext/wasm/tester1.c-pp.js 72bd2ed5b356ca18adb2e5bb2aa40f10c088d41dead68679c4c7bc54d38f1422
+F ext/wasm/tester1.c-pp.js f06d528fa04618e649068811d1d73335bf40731915ba7575ee40b20b2683e81b
F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P c8deed31365898e1379d577298fc80ef08a5531999d5b54a9f14337febed0260
-R 81c442e049a311dffb6931b46cc3b75c
+P f5105ee5defa042508a68a1f4e23b9fff46a1697b1a727e01c3edea3030fbcb5
+R 05e8870f66fba3b944f4c6b8b4e801e3
U stephan
-Z 133106b4a0e2f429661a21a8027537f6
+Z ed564202b3f648d03089569656f69c54
# Remove this line to create a well-formed Fossil manifest.