Sync w/trunk, pickup fts3corrupt6.test change.

FossilOrigin-Name: 268072f636b25c24ec47e34f2a8356f466ec200b80487b1041e89e0ae909c8bd
This commit is contained in:
larrybr 2022-06-06 14:00:41 +00:00
commit 0dbb3db431
8 changed files with 72 additions and 23 deletions

View File

@ -209,8 +209,8 @@
<label for='opt-cb-autoclear'>Auto-clear output</label>
</span>
<span class='labeled-input'>
<input type='file' id='load-db'/>
<label>Load DB</label>
<input type='file' id='load-db' class='hidden'/>
<button id='btn-load-db'>Load DB...</button>
</span>
<span class='labeled-input'>
<button id='btn-export'>Download DB</button>

View File

@ -526,6 +526,8 @@
/** Initiate a download of the db. */
const btnExport = E('#btn-export');
const eLoadDb = E('#load-db');
const btnLoadDb = E('#btn-load-db');
btnLoadDb.addEventListener('click', ()=>eLoadDb.click());
/**
Enables (if passed true) or disables all UI elements which
"might," if timed "just right," interfere with an

View File

@ -222,11 +222,10 @@ Module.postRun.push(function(namespace/*the module object, the target for
["sqlite3_prepare_v2", "number", ["number", "string", "number", "number", "number"]],
["sqlite3_prepare_v2_sqlptr", "sqlite3_prepare_v2",
/* Impl which requires that the 2nd argument be a pointer to
the SQL, instead of a string. This is used for cases where
we require a non-NULL value for the final argument. We may
or may not need this, depending on how our higher-level
API shapes up, but this code's spiritual guide (sql.js)
uses it we we'll include it. */
the SQL string, instead of being converted to a
string. This is used for cases where we require a non-NULL
value for the final argument (exec()'ing multiple
statements from one input string). */
"number", ["number", "number", "number", "number", "number"]],
["sqlite3_reset", "number", ["number"]],
["sqlite3_result_blob",null,["number", "number", "number", "number"]],
@ -1518,6 +1517,29 @@ Module.postRun.push(function(namespace/*the module object, the target for
be able to work with multi-hundred-meg (or larger) blobs, and
passing around arrays of those may quickly exhaust the JS
engine's memory.
TODOs include, but are not limited to:
- The ability to manage multiple DB handles. This can
potentially be done via a simple mapping of DB.filename or
DB._pDb (`sqlite3*` handle) to DB objects. The open()
interface would need to provide an ID (probably DB._pDb) back
to the user which can optionally be passed as an argument to
the other APIs (they'd default to the first-opened DB, for
ease of use). Client-side usability of this feature would
benefit from making another wrapper class (or a singleton)
available to the main thread, with that object proxying all(?)
communication with the worker.
- Revisit how virtual files are managed. We currently delete DBs
from the virtual filesystem when we close them, for the sake
of saving memory (the VFS lives in RAM). Supporting multiple
DBs may require that we give up that habit. Similarly, fully
supporting ATTACH, where a user can upload multiple DBs and
ATTACH them, also requires the that we manage the VFS entries
better. As of this writing, ATTACH will fail fatally in the
fiddle app (but not the lower-level APIs) because it runs in
safe mode, where ATTACH is disabled.
*/
/**

View File

@ -126,6 +126,21 @@ INSERT INTO t(a,b) VALUES(1,2),(3,4),(?,?);`,
assert(null === db.selectValue("select $a",{$a:null}));
};
const testAttach = function(db){
log("Testing ATTACH...");
db.exec({
sql:[
"attach 'foo.db' as foo",
"create table foo.bar(a)",
"insert into foo.bar(a) values(1),(2),(3)"
].join(';'),
multi: true
});
T.assert(2===db.selectValue('select a from foo.bar where a>1 order by a'));
db.exec("detach foo");
T.mustThrow(()=>db.exec("select * from foo.bar"));
};
const runTests = function(Module){
T.assert(Module._free instanceof Function).
assert(Module.allocate instanceof Function).
@ -141,8 +156,12 @@ INSERT INTO t(a,b) VALUES(1,2),(3,4),(?,?);`,
try {
log("DB:",db.filename);
[
test1, testUDF
].forEach((f)=>f(db, sqlite3));
test1, testUDF, testAttach
].forEach((f)=>{
const t = T.counter;
f(db, sqlite3);
log("Test count:",T.counter - t);
});
}finally{
db.close();
}

View File

@ -1,5 +1,5 @@
C In\sCLI,\sdrop\s.dbinfo\scommand\swhen\sbuild\soptions\sprevent\sit\sfrom\sworking.
D 2022-06-05T22:58:40.391
C Sync\sw/trunk,\spickup\sfts3corrupt6.test\schange.
D 2022-06-06T14:00:41.074
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -62,14 +62,14 @@ F ext/fiddle/Makefile e25d34a0e1324f771d64c09c592601b97219282011587e6ce410fa8acd
F ext/fiddle/SqliteTestUtil.js 559731c3e8e0de330ec7d292e6c1846566408caee6637acc8a119ac338a8781c
F ext/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/fiddle/fiddle-worker.js 88bc2193a6cb6a3f04d8911bed50a4401fe6f277de7a71ba833865ab64a1b4ae
F ext/fiddle/fiddle.html 724f1cd4126616bc87f5871f78d3f7aaaf41e45c9728724627baab87e6af35f0
F ext/fiddle/fiddle.js 2ce9a93aad55cbf64a16b607149847a64cc4dc4e13df8b6d2a0e964b4269dc6c
F ext/fiddle/fiddle.html c44f86abf286231fccfed9fd080fd17b200f5e5c05939e8080c810b6920a9326
F ext/fiddle/fiddle.js 6c20bf264cf26a570f9bf22e533adcc7250a6f183d482eaa725ccd0fa83a6d95
F ext/fiddle/index.md d9c1c308d8074341bc3b11d1d39073cd77754cb3ca9aeb949f23fdd8323d81cf
F ext/fiddle/sqlite3-api.js b32d23349cf32c54265d132387b5711a29d61c1fcf6159fbef72d1f04dda5e3c
F ext/fiddle/sqlite3-api.js ccf4bd0c1c5bbb3be3469573423d6c53991941bec497eac63e9f17ea13bf8952
F ext/fiddle/sqlite3-worker.js a9c2b614beca187dbdd8c053ec2770cc61ec1ac9c0ec6398ceb49a79f705a421
F ext/fiddle/testing.css 750572dded671d2cf142bbcb27af5542522ac08db128245d0b9fe410aa1d7f2a
F ext/fiddle/testing1.html ea1f3be727f78e420007f823912c1a03b337ecbb8e79449abc2244ad4fe15d9a
F ext/fiddle/testing1.js b5bf7e33b35f02f4208e4d68eaa41e5ed42eaefd57e0a1131e87cba96d4808dc
F ext/fiddle/testing1.js 68715f4716a30aa4dab0ce954d465f662486c8bc96a19a4fc8edbea4ac211fd2
F ext/fiddle/testing2.html 9063b2430ade2fe9da4e711addd1b51a2741cf0c7ebf6926472a5e5dd63c0bc4
F ext/fiddle/testing2.js 7b45b4e7fddbd51dbaf89b6722c02758051b34bac5a98c11b569a7e7572f88ee
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
@ -571,7 +571,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
F src/resolve.c a4eb3c617027fd049b07432f3b942ea7151fa793a332a11a7d0f58c9539e104f
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 8b98d3e5511d2789880ea4a12a4637803f69db5df04c81e1e93a5aac75c89b2a
F src/shell.c.in 865218b56e28f5d5939b82ef98a11a692c30c773f6cd86e04939605ecf824adc
F src/shell.c.in 5d5f27f88c4661b2b6e6859890e9c7fe00eac9a628743a12c44632705fc38309
F src/sqlite.h.in 172528c287399a34f188154017b7268bf82c6d5b780902e361958d2318c4e37c
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h a988810c9b21c0dc36dc7a62735012339dc76fc7ab448fb0792721d30eacb69d
@ -1008,7 +1008,7 @@ F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c788
F test/fts3corrupt3.test 0d5b69a0998b4adf868cc301fc78f3d0707745f1d984ce044c205cdb764b491f
F test/fts3corrupt4.test 799ff994b964fed7201be6b6b62c7ff2ef7bb3da6c02b9eaf0d96a5a4d9b6ca3
F test/fts3corrupt5.test 0549f85ec4bd22e992f645f13c59b99d652f2f5e643dac75568bfd23a6db7ed5
F test/fts3corrupt6.test 657b4b8e5791d8d4adc93c90588fb25f1c7346544dd877c6c298a0746749146d
F test/fts3corrupt6.test f417c910254f32c0bc9ead7affa991a1d5aec35b3b32a183ffb05eea78289525
F test/fts3cov.test 7eacdbefd756cfa4dc2241974e3db2834e9b372ca215880e00032222f32194cf
F test/fts3d.test 2bd8c97bcb9975f2334147173b4872505b6a41359a4f9068960a36afe07a679f
F test/fts3defer.test f4c20e4c7153d20a98ee49ee5f3faef624fefc9a067f8d8d629db380c4d9f1de
@ -1975,8 +1975,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 8d942ba72ea995d0e8d1f8694bb428e5f919fc75afd3e059a69547e27991d580
R 2f96e1736565174c18982a8437387e70
P 2512d2f68dfff4d74c881a4102b63ca528e690ad93ab2b4eb1f03ce1d9ac155c f7c17449ea0685e322f50abe7a59b7afcde0f7e38e03645ec5b13753a6d0dcf3
Q +04b2e47784238008ce9057e2761ded91d895dc16d3bc8a3a3508df98a4769602
R 9207d306b462962d71351cad5c380553
U larrybr
Z 9287eafb5d9d14c387b8d48b6146606a
Z bff0aa34a1a107fc43ee5c4bae4c5b52
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
2512d2f68dfff4d74c881a4102b63ca528e690ad93ab2b4eb1f03ce1d9ac155c
268072f636b25c24ec47e34f2a8356f466ec200b80487b1041e89e0ae909c8bd

View File

@ -1838,7 +1838,11 @@ static int safeModeAuth(
UNUSED_PARAMETER(zA4);
switch( op ){
case SQLITE_ATTACH: {
#ifndef SQLITE_SHELL_WASM_MODE
/* In WASM builds the filesystem is a virtual sandbox, so
** there's no harm in using ATTACH. */
failIfSafeMode(p, "cannot run ATTACH in safe mode");
#endif
break;
}
case SQLITE_FUNCTION: {

View File

@ -64,7 +64,8 @@ do_execsql_test 2.1 {
#-------------------------------------------------------------------------
reset_db
do_execsql_test 3.0 {
breakpoint
do_catchsql_test 3.0 {
CREATE VIRTUAL TABLE main.Table0 USING fts3();
INSERT INTO Table0 VALUES (1), (printf('%8.1280000X') ), (1), (printf('%8.1280000X') ), (1) ;
INSERT INTO Table0 VALUES (0), (printf('%8.1280000X%8.1280000X') ), (1), (printf('%1280000.1280000X%#1280000.1280000E%8.1280000X') ), (1) ;
@ -72,7 +73,7 @@ do_execsql_test 3.0 {
UPDATE Table0_segdir SET start_block = 1;
INSERT INTO Table0 VALUES (1) ;
INSERT INTO Table0(Table0) VALUES('merge=6,8');
}
} {1 {database disk image is malformed}}
set sqlite_fts3_enable_parentheses $saved_sqlite_fts3_enable_parentheses
finish_test