rc!=SQLITE_OK || pDoclist[iOff]==0x01 ){
iOff++;
continue;
diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c
index 0e6c1c806b..6d3153230c 100644
--- a/ext/session/sqlite3session.c
+++ b/ext/session/sqlite3session.c
@@ -2564,9 +2564,11 @@ static void sessionAppendIdent(
char *zOut = (char *)&p->aBuf[p->nBuf];
const char *zIn = zStr;
*zOut++ = '"';
- while( *zIn ){
- if( *zIn=='"' ) *zOut++ = '"';
- *zOut++ = *(zIn++);
+ if( zIn!=0 ){
+ while( *zIn ){
+ if( *zIn=='"' ) *zOut++ = '"';
+ *zOut++ = *(zIn++);
+ }
}
*zOut++ = '"';
p->nBuf = (int)((u8 *)zOut - p->aBuf);
diff --git a/ext/wasm/api/sqlite3-api-glue.c-pp.js b/ext/wasm/api/sqlite3-api-glue.c-pp.js
index bcaff7243d..a40b832824 100644
--- a/ext/wasm/api/sqlite3-api-glue.c-pp.js
+++ b/ext/wasm/api/sqlite3-api-glue.c-pp.js
@@ -229,14 +229,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
'*'
]],
/**
- 2025-02-03: We do not have a way to automatically clean up
- destructors which are automatically converted from JS functions
- via the final argument to sqlite3_set_auxdata(). Because of
- that, it is strongly recommended that clients use
- wasm.installFunction() to create such callbacks, then pass that
- pointer to sqlite3_set_auxdata(). Relying on automated
- conversions here will lead to leaks of JS/WASM proxy functions
- because sqlite3_set_auxdata() is frequently called in UDFs.
+ We do not have a way to automatically clean up destructors
+ which are automatically converted from JS functions via the
+ final argument to sqlite3_set_auxdata(). Because of that,
+ automatic function conversion is not supported for this
+ function. Clients should use wasm.installFunction() to create
+ such callbacks, then pass that pointer to
+ sqlite3_set_auxdata(). Relying on automated conversions here
+ would lead to leaks of JS/WASM proxy functions because
+ sqlite3_set_auxdata() is frequently called in UDFs.
The sqlite3.oo1.DB class's onclose handlers can be used for this
purpose. For example:
@@ -252,14 +253,24 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Then pass pAuxDtor as the final argument to appropriate
sqlite3_set_auxdata() calls.
+
+ Note that versions prior to 3.49.0 ostensibly had automatic
+ function conversion here but a typo prevented it from
+ working. Rather than fix it, it was removed because testing the
+ fix brought the huge potential for memory leaks to the
+ forefront.
*/
["sqlite3_set_auxdata", undefined, [
"sqlite3_context*", "int", "*",
- new wasm.xWrap.FuncPtrAdapter({
- name: 'xDestroyAuxData',
- signature: 'v(p)',
- contextKey: (argv, argIndex)=>argv[0/* sqlite3_context* */]
- })
+ true
+ ? "*"
+ : new wasm.xWrap.FuncPtrAdapter({
+ /* If we can find a way to automate their cleanup, JS functions can
+ be auto-converted with this. */
+ name: 'xDestroyAuxData',
+ signature: 'v(p)',
+ contextKey: (argv, argIndex)=>argv[0/* sqlite3_context* */]
+ })
]],
["sqlite3_shutdown", undefined],
["sqlite3_sourceid", "string"],
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index 880edcec1d..28d61de071 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -3445,7 +3445,6 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const stack = wasm.pstack.pointer;
const pAux = wasm.pstack.alloc(4);
let pAuxDestructed = 0;
- const args = [];
const pAuxDtor = wasm.installFunction('v(p)', function(ptr){
//log("freeing auxdata");
++pAuxDestructed;
@@ -3457,10 +3456,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
wasm.uninstallFunction(pAuxDtor);
}
};
+ let nAuxSet = 0 /* how many times we set aux data */;
+ let nAuxReused = 0 /* how many times we reused aux data */;
try{
db.createFunction("auxtest",{
xFunc: function(pCx, x, y){
- args.push(x);
T.assert(wasm.isPtr(pCx));
const localAux = capi.sqlite3_get_auxdata(pCx, 0);
if( !localAux ){
@@ -3469,23 +3469,20 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
We do not currently an automated way to clean up
auxdata finalizer functions (the 4th argument to
sqlite3_set_auxdata()) which get automatically
- converted from JS to WASM. Because of that, relying
- on automated conversions for those is not
- recommended. Instead, follow the pattern show in
+ converted from JS to WASM. Because of that, enabling
+ automated conversions here would lead to leaks more
+ often than not. Instead, follow the pattern show in
this function: use wasm.installFunction() to create
the function, then pass the resulting function
pointer this function, and cleanup (at some point)
using wasm.uninstallFunction().
*/
+ ++nAuxSet;
capi.sqlite3_set_auxdata(pCx, 0, pAux, pAuxDtor);
}else{
- /* This is never actually hit in this example and it's
- not entirely clear how to cause it to. The point of
- this test, however, is to demonstrate that the
- finalizer impl gets triggered, so we're not going to
- fret over this at the moment. */
- //log("seen auxdata",localAux);
+ //log("reusing auxdata",localAux);
T.assert(pAux===localAux);
+ ++nAuxReused;
}
return x;
}
@@ -3493,13 +3490,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
db.exec([
"create table t(a);",
"insert into t(a) values(1),(2),(3);",
- "select auxtest(a,a), auxtest(a,a) from t order by a"
+ "select auxtest(1,a), auxtest(1,a) from t order by a"
]);
}finally{
db.close();
wasm.pstack.restore(stack);
}
- T.assert(6===args.length);
+ T.assert(nAuxSet>0).assert(nAuxReused>0)
+ .assert(6===nAuxReused+nAuxSet);
T.assert(pAuxDestructed>0);
T.assert(pAuxDtorDestructed);
}
diff --git a/manifest b/manifest
index 54fa84686a..6d9f47b2c0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C If\sSQLite\sis\scompiled\swith\sSQLITE_ENABLE_WAL_BIGHASH\sdefined,\suse\nhash\stables\slarge\senough\sto\sfit\s128K,\sinstead\sof\s4K,\sentries\sin\sthe\s*-shm\sfile.
-D 2025-02-05T17:52:13.273
+C Merge\sversion\s3.49.0\sinto\sthe\sbedrock\sbranch.
+D 2025-02-06T12:46:51.870
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -37,7 +37,7 @@ F autoconf/tea/win/rules.vc 94a18c3e453535459b4a643983acca52fb8756e79055bd2ad4b0
F autoconf/tea/win/targets.vc 96a25a1fa6e9e9cfb348fd3760a5395b4ce8acafc8ed10f0412937ec200d5dbd
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
-F autosetup/README.md 2737c4eb44b022a694b1f93fb01c3b6c3a45b4f663e18490c2106643a77b39da
+F autosetup/README.md b306314e8a87ccf873cb5b2a360c4a27bbf841df5b76f3acbd65322cff165476
F autosetup/autosetup df8b53928b1fe3c67db5bc77c8e1eb8160c1b6a26c370e9a06c68748f803b7e4 x
F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x
F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x
@@ -47,7 +47,7 @@ F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034
F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f
-F autosetup/jimsh0.c d40e381ea4526a067590e7b91bd4b2efa6d4980d286f908054c647b3df4aee14
+F autosetup/jimsh0.c 5a74bdbf43c52289e3f482f3b9578db4bd657e88e8fe04b16c564d9fb710540a
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl 9adf1539673cef15bff862d9360b479e6920cc2c0d85de707b0ba31c04ce4531
F autosetup/sqlite-config.tcl 00af5b9d94d580367bf01984b86397e8d35b74090427def9591a54ded0e1a287
@@ -80,16 +80,16 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
-F ext/fts3/fts3.c 9f8ce82bbf4ec0636e6170e58f17b04817fa4c39b2d5126ac06f005d485f6d5e
+F ext/fts3/fts3.c b840ee915a6fb36571e3fe3c096e8a481a4a9cd8a35199a1b976b132b9f84ad3
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
-F ext/fts3/fts3Int.h 968f7d7cae541a6926146e9fd3fb2b2ccbd3845b7890a8ed03de0c06ac776682
+F ext/fts3/fts3Int.h 2fe7c76dfd7d46dff964d17d3f4c53bca2116cf5d6252552ebbc22e38afdf4e0
F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3
F ext/fts3/fts3_expr.c 365849a2a1185e19028a9db2d9f1ea63efe909a3a6aca7ec86fc26a13a60bd58
F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116
F ext/fts3/fts3_porter.c e19807ce0ae31c1c6e9898e89ecc93183d7ec224ea101af039722a4f49e5f2b8
-F ext/fts3/fts3_snippet.c c38117a2e4dcc9485a170a57a6134423955247b230fef7073c46fa9c51239540
+F ext/fts3/fts3_snippet.c 7a3d5e2cefbb1cb51fb9c65458670cc269647ede18e1ffd57b513f9b4ec10c3e
F ext/fts3/fts3_term.c 6a96027ad364001432545fe43322b6af04ed28bb5619ec51af1f59d0710d6d69
F ext/fts3/fts3_test.c 7a9cb3d61774134211bf4bfdf1adcb581a1a0377f2d050a121ae7ab44baef0e3
F ext/fts3/fts3_tokenize_vtab.c 7fd9ef364f257b97218b9c331f2378e307375c592f70fd541f714e747d944962
@@ -114,7 +114,7 @@ F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70
F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773c3384f7f8
F ext/fts5/fts5_expr.c 69b8d976058512c07dfe86e229521b7a871768157bd1607cedf1a5038dfd72c9
F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1
-F ext/fts5/fts5_index.c a59ccd06af157da2471f356198af14bc37d86e46231e4e1858b2af2f94c2c6e4
+F ext/fts5/fts5_index.c f1eec0931548b529ddd7ebd274eaef37de7461fe2b0ebdc9818f37324bdf9494
F ext/fts5/fts5_main.c 47e7a63a936b5573570be299c13e9eaf2651eb25dce41b3e16430142e682e2c8
F ext/fts5/fts5_storage.c 1ad05dab4830a4e2eaf2900bb143477f93bc17437093582f36f4b818809e88d8
F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329
@@ -623,7 +623,7 @@ F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
F ext/session/sqlite3changebatch.c d488b42d8fd49fb013a1e9c4535232680dabeb28ae8f9421b65ea0ccc3b430f7
F ext/session/sqlite3changebatch.h e72016998c9a22d439ddfd547b69e1ebac810c24
-F ext/session/sqlite3session.c 5a5c46168f4ac3155b422c23dd7299b7663e747cb9f34735e7a10e2146f07b0b
+F ext/session/sqlite3session.c e33ff7bed8537a2fa6913711fbd4f3defd24c56a400a10da379b8a172bb7fee5
F ext/session/sqlite3session.h 3376dbf372cb00cc0f4e960ca0a0125418638da8c55aad749c9fe7a58a770506
F ext/session/test_session.c 3e9a06d0840013d6411fd17bf7948282224d4c54626cda3a1faa39ac89f0c056
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
@@ -646,7 +646,7 @@ F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90a
F ext/wasm/api/post-js-header.js 54b2b4294501b3866245cc94315a16f5424c0e87729d0fb610fba151593c6d26
F ext/wasm/api/pre-js.c-pp.js a614a2c82b12c4d96d8e3ba77330329efc53c4d56a8a7e60ade900f341866cfb
F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b939540661f3e839515bb92f2e35359
-F ext/wasm/api/sqlite3-api-glue.c-pp.js 6e2f2eaf681e342fcb047fcdd01d6e3c1b466fb9b45c1acc38676164a8b60f45
+F ext/wasm/api/sqlite3-api-glue.c-pp.js 5c0209e6a28164b4c2c1a34b0bb4aee3b7b1a264988d7e71fac08b8ede5b7ae3
F ext/wasm/api/sqlite3-api-oo1.c-pp.js f3a8e2004c6625d17946c11f2fb32008be78bc5207bf746fc77d59848813225f
F ext/wasm/api/sqlite3-api-prologue.js 5ff913355b3144f1c9719d0406667fa6e13eb813c71ed7ce29440e2e65363e82
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 5cc22a3c0d52828cb32aad8691488719f47d27567e63e8bc8b832d74371c352d
@@ -704,7 +704,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
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 fb8d0761daaa69bd40c8253cc2d6c8c37ada97e1751b7f07af7369842ba2aeae
+F ext/wasm/tester1.c-pp.js 05a0143c44a4114aad0ed40ce73c528febc3e0d6b69f48a51c895d7030015b74
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
@@ -741,7 +741,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c 8705be31ee713aaa43c97d91399db09f16ee41b88250406eb99de6b47f550a98
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
-F src/func.c 624f4bd5004e3dbd07f97f0e82288798942e4c54c01bbc2aceacca1d08f9caea
+F src/func.c a0130a089bb8aa8dd642975b0c1713e2684404c3ec8228616e786331ede74217
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
@@ -790,10 +790,10 @@ F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 96b4e6ed50ec65a372f0beb5d782dbe4776541d6974f80ff8a2538a46d2cae03
F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237
-F src/sqlite.h.in df148bd964f83e6953b7c6c03023d7db951422ee66a34b07ece6e57b4bb535f8
+F src/sqlite.h.in 9ca533745bfbeef8ea40dda62d7054a1dc14bbe6f3067d13729f247f5c54faa4
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
-F src/sqliteInt.h 2545f879e1c97992c2acc0029632ab41c53b706211b1e599879da7a5b26534ad
+F src/sqliteInt.h 48e947626cbdfc7d7e0aa0062e9760bd83f57c56c2348efcec37d49350690e71
F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523
F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -1298,7 +1298,7 @@ F test/fuzz3.test 70ba57260364b83e964707b9d4b5625284239768ab907dd387c740c0370ce3
F test/fuzz4.test c229bcdb45518a89e1d208a21343e061503460ac69fae1539320a89f572eb634
F test/fuzz_common.tcl b7197de6ed1ee8250a4f82d67876f4561b42ee8cbbfc6160dcb66331bad3f830
F test/fuzz_malloc.test f348276e732e814802e39f042b1f6da6362a610af73a528d8f76898fde6b22f2
-F test/fuzzcheck.c 1671559091b3e134ec807490f624d306b24bd9a8f03b12aa97e292f4b31e5d96
+F test/fuzzcheck.c 6fc952750a69168dd5fea38b9d35cb38475bfda15c8acfd156ac09cd03ddbd3e
F test/fuzzdata1.db 3e86d9cf5aea68ddb8e27c02d7dfdaa226347426c7eb814918e4d95475bf8517
F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@@ -1306,7 +1306,7 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4
F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5
F test/fuzzdata6.db b8725a5f5cf7a3b7241a9038e57ca7e7cc8c3f4d86b44bd770617bda245ab2b0
F test/fuzzdata7.db 0166b56fd7a6b9636a1d60ef0a060f86ddaecf99400a666bb6e5bbd7199ad1f2
-F test/fuzzdata8.db 4a53b6d077c6a5c23b609d8d3ac66996fa55ba3f8d02f9b6efdd0214a767a35a
+F test/fuzzdata8.db c6f9cb7d2b808fb10894afe53ef00f51e73e43baa7aabdba7e9af4713fc5b186
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
@@ -2191,9 +2191,9 @@ F tool/mkpragmatab.tcl d03737ad2ac48928d8225d1c571e487b9b7e73e8c1bdcabd61d69b244
F tool/mkshellc.tcl 9ce74de0fa904a2c56a96f8d8b5261246bacb0eaa8d7e184f9e18ff94145ebbc
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
-F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
-F tool/mksqlite3c.tcl 1b24a4388f544a7f42fc2d03f34422182d3b2263453f65f642890259566369c1
-F tool/mksqlite3h.tcl 3cc8f3fbb3eca38c899549385622637667254067d865a70ad16e0996c2fd3214
+F tool/mksqlite3c-noext.tcl 351c55256213154cabb051a3c870ef9f4487de905015141ae50dc7578a901b84
+F tool/mksqlite3c.tcl ba13086555b3cb835eba5e47a9250300ab85304d23fd1081abd3f29d8ab71a2b
+F tool/mksqlite3h.tcl b05b85c32295bad3fe64807729693d1f19faed3c464c5faac6c53bb6b972ac2f
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
F tool/mksrczip.tcl 81efd9974dbb36005383f2cd655520057a2ae5aa85ac2441a80c7c28f803ac52
F tool/mktoolzip.tcl 34b4e92be544f820e2cc26f143f7d5aec511e826ec394cc82969a5dcf7c7a27c
@@ -2222,7 +2222,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 7ce07da76b5e745783e703a834417d725b7d45fd
F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d40618 x
-F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60
+F tool/split-sqlite3c.tcl 07e18a1d8cc3f6b3a4a1f3528e63c9b29a5c8a7bca0b8d394b231da464ce1247
F tool/sqldiff.c 2a0987d183027c795ced13d6749061c1d2f38e24eddb428f56fa64c3a8f51e4b
F tool/sqlite3_analyzer.c.in fc7735c499d226a49d843d8209b2543e4e5229eeb71a674c331323a2217b65b4
F tool/sqlite3_rsync.c 9a1cca2ab1271c59b37a6493c15dc1bcd0ab9149197a9125926bc08dd26b83fb
@@ -2246,9 +2246,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 1cef92de5059e468e0b1282425f50b089629c4f74671763bcefcb835798a9124
-Q +6e800b7035f55a211917d28cacf829b1681f37cbd2e6989c4cc20d4027a4192d
-R c6b4176b37f2b5dbb7d04a0902a128c8
-U dan
-Z e6bf5e2637d4942fcd140ab770336bc1
+P 581efc34624c55832afbf7b691d768d6ddbf2b23d6a190d2fa0dde1b00251454 e194c8e8c75fcfda263fbf3f51e5236e66221bd245805af95afbf6a60506d247
+R 56992fcbb164b5791fdc1f26b911a816
+U drh
+Z 986ba5a503a9219d62c05c57f7a79dae
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 12f0238e94..5ccf793894 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-581efc34624c55832afbf7b691d768d6ddbf2b23d6a190d2fa0dde1b00251454
+cc3ce784b0feea2f7e86960d262a04c555df817192695d5760c2a83fb804a212
diff --git a/src/func.c b/src/func.c
index a64ada8d9c..cfe23805f9 100644
--- a/src/func.c
+++ b/src/func.c
@@ -1871,7 +1871,10 @@ static void sumInverse(sqlite3_context *context, int argc, sqlite3_value**argv){
assert( p->cnt>0 );
p->cnt--;
if( !p->approx ){
- p->iSum -= sqlite3_value_int64(argv[0]);
+ if( sqlite3SubInt64(&p->iSum, sqlite3_value_int64(argv[0])) ){
+ p->ovrfl = 1;
+ p->approx = 1;
+ }
}else if( type==SQLITE_INTEGER ){
i64 iVal = sqlite3_value_int64(argv[0]);
if( iVal!=SMALLEST_INT64 ){
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index c931a7b14d..38edc9704f 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -2211,7 +2211,15 @@ struct sqlite3_mem_methods {
** CAPI3REF: Database Connection Configuration Options
**
** These constants are the available integer configuration options that
-** can be passed as the second argument to the [sqlite3_db_config()] interface.
+** can be passed as the second parameter to the [sqlite3_db_config()] interface.
+**
+** The [sqlite3_db_config()] interface is a var-args functions. It takes a
+** variable number of parameters, though always at least two. The number of
+** parameters passed into sqlite3_db_config() depends on which of these
+** constants is given as the second parameter. This documentation page
+** refers to parameters beyond the second as "arguments". Thus, when this
+** page says "the N-th argument" it means "the N-th parameter past the
+** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued. Applications
@@ -2228,7 +2236,9 @@ struct sqlite3_mem_methods {
** connection.
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not
** in the [DBCONFIG arguments|usual format].
-** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two.
+** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
+** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
+** should have a total of five parameters.
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
** pointer to a memory buffer to use for lookaside memory.
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
@@ -2330,12 +2340,13 @@ struct sqlite3_mem_methods {
** ^This option is used to change the name of the "main" database
** schema. This option does not follow the
** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
-** This option takes exactly one argument, which ust be a pointer
-** to a constant UTF8 string which will become the new schema name
-** in place of "main". ^SQLite does not make a copy of the new main
-** schema name string, so the application must ensure that the argument
-** passed into SQLITE_DBCONFIG MAINDBNAME is unchanged
-** until after the database connection closes.
+** This option takes exactly one additional argument so that the
+** [sqlite3_db_config()] call has a total of three parameters. The
+** extra argument must be a pointer to a constant UTF8 string which
+** will become the new schema name in place of "main". ^SQLite does
+** not make a copy of the new main schema name string, so the application
+** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
+** is unchanged until after the database connection closes.
**
**
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
@@ -2346,10 +2357,11 @@ struct sqlite3_mem_methods {
** connection being closed is the last open connection to the database),
** then SQLite performs a [checkpoint] before closing the connection and
** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
-** be used to override that behavior. The first parameter passed to this
-** operation is an integer - positive to disable checkpoints-on-close, or
-** zero (the default) to enable them, and negative to leave the setting unchanged.
-** The second parameter is a pointer to an integer
+** be used to override that behavior. The first argument passed to this
+** operation (the third parameter to [sqlite3_db_config()]) is an integer
+** which is positive to disable checkpoints-on-close, or zero (the default)
+** to enable them, and negative to leave the setting unchanged.
+** The second argument (the fourth parameter) is a pointer to an integer
** into which is written 0 or 1 to indicate whether checkpoints-on-close
** have been disabled - 0 if they are not disabled, 1 if they are.
**
@@ -2587,9 +2599,11 @@ struct sqlite3_mem_methods {
**
** [[DBCONFIG arguments]] Arguments To SQLITE_DBCONFIG Options
**
-** Most of the SQLITE_DBCONFIG options take two arguments: an integer
-** and a pointer to an integer. If the first integer argument is 1, then
-** the option becomes enabled. If the first integer argument is 0, then the
+**
Most of the SQLITE_DBCONFIG options take two arguments, so that the
+** overall call to [sqlite3_db_config()] has a total of four parameters.
+** The first argument (the third parameter to sqlite3_db_config()) is a integer.
+** The second argument is a pointer to an integer. If the first argument is 1,
+** then the option becomes enabled. If the first integer argument is 0, then the
** option is disabled. If the first argument is -1, then the option setting
** is unchanged. The second argument, the pointer to an integer, may be NULL.
** If the second argument is not NULL, then a value of 0 or 1 is written into
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index dc02b17844..8c07c9840c 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3942,9 +3942,7 @@ struct Parse {
int nVtabLock; /* Number of virtual tables to lock */
#endif
int nHeight; /* Expression tree height of current sub-select */
-#ifndef SQLITE_OMIT_EXPLAIN
int addrExplain; /* Address of current OP_Explain opcode */
-#endif
VList *pVList; /* Mapping between variable names and numbers */
Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
const char *zTail; /* All SQL text past the last semicolon parsed */
diff --git a/test/fuzzcheck.c b/test/fuzzcheck.c
index 390d804df1..84e3f32895 100644
--- a/test/fuzzcheck.c
+++ b/test/fuzzcheck.c
@@ -507,7 +507,8 @@ static void writefileFunc(
static void blobListLoadFromDb(
sqlite3 *db, /* Read from this database */
const char *zSql, /* Query used to extract the blobs */
- int onlyId, /* Only load where id is this value */
+ int firstId, /* First sqlid to load */
+ int lastId, /* Last sqlid to load */
int *pN, /* OUT: Write number of blobs loaded here */
Blob **ppList /* OUT: Write the head of the blob list here */
){
@@ -518,8 +519,9 @@ static void blobListLoadFromDb(
int rc;
char *z2;
- if( onlyId>0 ){
- z2 = sqlite3_mprintf("%s WHERE rowid=%d", zSql, onlyId);
+ if( firstId>0 ){
+ z2 = sqlite3_mprintf("%s WHERE rowid BETWEEN %d AND %d", zSql,
+ firstId, lastId);
}else{
z2 = sqlite3_mprintf("%s", zSql);
}
@@ -1836,7 +1838,8 @@ static void showHelp(void){
"each database, checking for crashes and memory leaks.\n"
"Options:\n"
" --cell-size-check Set the PRAGMA cell_size_check=ON\n"
-" --dbid N Use only the database where dbid=N\n"
+" --dbid M..N Use only the databases where dbid between M and N\n"
+" \"M..\" for M and afterwards. Just \"M\" for M only\n"
" --export-db DIR Write databases to files(s) in DIR. Works with --dbid\n"
" --export-sql DIR Write SQL to file(s) in DIR. Also works with --sqlid\n"
" --help Show this help text\n"
@@ -1861,7 +1864,8 @@ static void showHelp(void){
" --script Output CLI script instead of running tests\n"
" --skip N Skip the first N test cases\n"
" --spinner Use a spinner to show progress\n"
-" --sqlid N Use only SQL where sqlid=N\n"
+" --sqlid M..N Use only SQL where sqlid between M..N\n"
+" \"M..\" for M and afterwards. Just \"M\" for M only\n"
" --timeout N Maximum time for any one test in N millseconds\n"
" -v|--verbose Increased output. Repeat for more output.\n"
" --vdbe-debug Activate VDBE debugging.\n"
@@ -1883,8 +1887,10 @@ int main(int argc, char **argv){
Blob *pDb; /* For looping over template databases */
int i; /* Loop index for the argv[] loop */
int dbSqlOnly = 0; /* Only use scripts that are dbsqlfuzz */
- int onlySqlid = -1; /* --sqlid */
- int onlyDbid = -1; /* --dbid */
+ int firstSqlid = -1; /* First --sqlid range */
+ int lastSqlid = 0x7fffffff; /* Last --sqlid range */
+ int firstDbid = -1; /* --dbid */
+ int lastDbid = 0x7fffffff; /* --dbid end */
int nativeFlag = 0; /* --native-vfs */
int rebuildFlag = 0; /* --rebuild */
int vdbeLimitFlag = 0; /* --limit-vdbe */
@@ -1942,8 +1948,18 @@ int main(int argc, char **argv){
cellSzCkFlag = 1;
}else
if( strcmp(z,"dbid")==0 ){
+ const char *zDotDot;
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
- onlyDbid = integerValue(argv[++i]);
+ i++;
+ zDotDot = strstr(argv[i], "..");
+ if( zDotDot ){
+ firstDbid = atoi(argv[i]);
+ if( zDotDot[2] ){
+ lastDbid = atoi(&zDotDot[2]);
+ }
+ }else{
+ lastDbid = firstDbid = integerValue(argv[i]);
+ }
}else
if( strcmp(z,"export-db")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
@@ -2043,8 +2059,19 @@ int main(int argc, char **argv){
bTimer = 1;
}else
if( strcmp(z,"sqlid")==0 ){
+ const char *zDotDot;
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
- onlySqlid = integerValue(argv[++i]);
+ i++;
+ zDotDot = strstr(argv[i], "..");
+ if( zDotDot ){
+ firstSqlid = atoi(argv[i]);
+ if( zDotDot[2] ){
+ lastSqlid = atoi(&zDotDot[2]);
+ }
+ }else{
+ firstSqlid = integerValue(argv[i]);
+ lastSqlid = firstSqlid;
+ }
}else
if( strcmp(z,"timeout")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
@@ -2292,13 +2319,14 @@ int main(int argc, char **argv){
const char *zExDb =
"SELECT writefile(printf('%s/db%06d.db',?1,dbid),dbcontent),"
" dbid, printf('%s/db%06d.db',?1,dbid), length(dbcontent)"
- " FROM db WHERE ?2<0 OR dbid=?2;";
+ " FROM db WHERE dbid BETWEEN ?2 AND ?3;";
rc = sqlite3_prepare_v2(db, zExDb, -1, &pStmt, 0);
if( rc ) fatalError("cannot prepare statement [%s]: %s",
zExDb, sqlite3_errmsg(db));
sqlite3_bind_text64(pStmt, 1, zExpDb, strlen(zExpDb),
SQLITE_STATIC, SQLITE_UTF8);
- sqlite3_bind_int(pStmt, 2, onlyDbid);
+ sqlite3_bind_int(pStmt, 2, firstDbid);
+ sqlite3_bind_int(pStmt, 3, lastDbid);
while( sqlite3_step(pStmt)==SQLITE_ROW ){
printf("write db-%d (%d bytes) into %s\n",
sqlite3_column_int(pStmt,1),
@@ -2311,13 +2339,14 @@ int main(int argc, char **argv){
const char *zExSql =
"SELECT writefile(printf('%s/sql%06d.txt',?1,sqlid),sqltext),"
" sqlid, printf('%s/sql%06d.txt',?1,sqlid), length(sqltext)"
- " FROM xsql WHERE ?2<0 OR sqlid=?2;";
+ " FROM xsql WHERE sqlid BETWEEN ?2 AND ?3;";
rc = sqlite3_prepare_v2(db, zExSql, -1, &pStmt, 0);
if( rc ) fatalError("cannot prepare statement [%s]: %s",
zExSql, sqlite3_errmsg(db));
sqlite3_bind_text64(pStmt, 1, zExpSql, strlen(zExpSql),
SQLITE_STATIC, SQLITE_UTF8);
- sqlite3_bind_int(pStmt, 2, onlySqlid);
+ sqlite3_bind_int(pStmt, 2, firstSqlid);
+ sqlite3_bind_int(pStmt, 3, lastSqlid);
while( sqlite3_step(pStmt)==SQLITE_ROW ){
printf("write sql-%d (%d bytes) into %s\n",
sqlite3_column_int(pStmt,1),
@@ -2333,11 +2362,11 @@ int main(int argc, char **argv){
/* Load all SQL script content and all initial database images from the
** source db
*/
- blobListLoadFromDb(db, "SELECT sqlid, sqltext FROM xsql", onlySqlid,
- &g.nSql, &g.pFirstSql);
+ blobListLoadFromDb(db, "SELECT sqlid, sqltext FROM xsql", firstSqlid,
+ lastSqlid, &g.nSql, &g.pFirstSql);
if( g.nSql==0 ) fatalError("need at least one SQL script");
- blobListLoadFromDb(db, "SELECT dbid, dbcontent FROM db", onlyDbid,
- &g.nDb, &g.pFirstDb);
+ blobListLoadFromDb(db, "SELECT dbid, dbcontent FROM db", firstDbid,
+ lastDbid, &g.nDb, &g.pFirstDb);
if( g.nDb==0 ){
g.pFirstDb = safe_realloc(0, sizeof(Blob));
memset(g.pFirstDb, 0, sizeof(Blob));
diff --git a/test/fuzzdata8.db b/test/fuzzdata8.db
index 3e34180071..469df2c681 100644
Binary files a/test/fuzzdata8.db and b/test/fuzzdata8.db differ
diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl
index 8452072564..1148b1c0d5 100644
--- a/tool/mksqlite3c-noext.tcl
+++ b/tool/mksqlite3c-noext.tcl
@@ -57,7 +57,7 @@ close $in
#
set out [open sqlite3.c w]
# Force the output to use unix line endings, even on Windows.
-fconfigure $out -translation lf
+fconfigure $out -translation binary
set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
puts $out [subst \
{/******************************************************************************
diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl
index ddc1e58776..1d0f892363 100644
--- a/tool/mksqlite3c.tcl
+++ b/tool/mksqlite3c.tcl
@@ -88,7 +88,7 @@ set fname sqlite3.c
if {$enable_recover} { set fname sqlite3r.c }
set out [open $fname wb]
# Force the output to use unix line endings, even on Windows.
-fconfigure $out -translation lf
+fconfigure $out -translation binary
set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
puts $out [subst \
{/******************************************************************************
diff --git a/tool/mksqlite3h.tcl b/tool/mksqlite3h.tcl
index 8ef123bc72..b1d5ecdcd3 100644
--- a/tool/mksqlite3h.tcl
+++ b/tool/mksqlite3h.tcl
@@ -107,7 +107,7 @@ set declpattern5 \
{^ *([a-zA-Z][a-zA-Z_0-9 ]+ \**)(sqlite3rebaser_[_a-zA-Z0-9]+)(\(.*)$}
# Force the output to use unix line endings, even on Windows.
-fconfigure stdout -translation lf
+fconfigure stdout -translation binary
set filelist [subst {
$TOP/src/sqlite.h.in
diff --git a/tool/split-sqlite3c.tcl b/tool/split-sqlite3c.tcl
index 0308431dab..de4db55a1b 100644
--- a/tool/split-sqlite3c.tcl
+++ b/tool/split-sqlite3c.tcl
@@ -15,7 +15,7 @@ set END {^/\*+ End of %s \*+/}
set in [open sqlite3.c]
set out1 [open sqlite3-all.c w]
-fconfigure $out1 -translation lf
+fconfigure $out1 -translation binary
# Copy the header from sqlite3.c into sqlite3-all.c
#