Compare commits

...

348 Commits

Author SHA1 Message Date
drh ba76c160c7 Version 3.51.2
FossilOrigin-Name: b270f8339eb13b504d0b2ba154ebca966b7dde08e40c3ed7d559749818cb2075
2026-01-09 17:27:48 +00:00
dan f3e0993b9d To ensure that the sqlite3_hard_heap_limit() call it makes is effective, add "sqlite3_config(SQLITE_CONFIG_MEMSTATUS, 1);" to fuzzcheck.c.
FossilOrigin-Name: 10e11b9c539a8be50fd93bdf7cf5afe97d9757ce8577cac58426a1b218063e47
2026-01-09 16:21:26 +00:00
drh c51f318f6a Avoid signed integer overflow when an fts5 'merge' command is passed -2147483648 as a parameter.
FossilOrigin-Name: 127b3270f8716e0eda06ea6979def88283e15aecdceb5d56c82105b300c98bdc
2026-01-09 16:01:51 +00:00
drh 3a621d8a58 Fix potential OOB read on the undocumented test function rtreenode() in
the RTREE extension.

FossilOrigin-Name: f567ea96905ec58bb073b675e820ba505d3306338fdefd64bdd5cf965a3a9e88
2026-01-09 00:45:41 +00:00
drh b8c49d6f62 Fix yet another bug in the EXISTS-to-JOIN optimization.
FossilOrigin-Name: a23d3b50fd7c2013d83f868a3a4114880887ec8fb6e9917b43c243607caab67c
2026-01-03 15:22:08 +00:00
drh a303f7914d Ensure that loops created by the exists-to-join optimization use unique cursor numbers, even if the EXISTS expression in the WHERE clause is a copy of an expression from the result-set of the SELECT.
FossilOrigin-Name: d485e8fccc7cae338bd4cfe3e23d488926cf09a8c0ccc68b70446bbd8ceda652
2026-01-02 18:53:50 +00:00
drh 632632ced3 Use 64-bit integers to track memory allocation sizes in the CSV extension.
FossilOrigin-Name: 54398a2504a8a2ac47a461518df51406b29e63f1688f6ec108a41ac7b4b346f9
2025-12-31 18:46:13 +00:00
drh f8cae0b149 Update the autoconf tarball Makefile.msc to align with the canonical makefile.
FossilOrigin-Name: 390dfd6366a7e9a9b4c6454c0b281279d8fcf8ffdb14b8b4d945591cb37812bc
2025-12-31 11:00:51 +00:00
drh bc9cebcd1d Use sqlite3_malloc64() in all places in the compress.c extension to avoid
integer overflow.

FossilOrigin-Name: 15400ce39b83ebc384b5eb17eba87452b937c0b00117c1575a51c6e6139fe3b1
2025-12-31 10:59:40 +00:00
drh 2b0579b06b Fix a typo in check-in 0819fe670f9ceec7 that lead to incomplete protection against
buffer overflow in the zipfile extension.

FossilOrigin-Name: a3f135c0709b2ed2953d2e449107abc53b538b384bcd9bae5e370e3c9de8618a
2025-12-31 01:11:36 +00:00
drh 323199b57e Fix a memory leak in the fileio extension on windows. Other changes to
makefiles and similar to get zipfile testing working on Windows.

FossilOrigin-Name: 121b327f1f3941a9a44ab2d98e60f6e25b928ca9b54bbaa109239ba9012b3c3c
2025-12-19 23:47:07 +00:00
dan 67767084b6 Enhance the unixIsSharingShmNode() code (check-in [6385a1962c69c69c]) to avoid
possible deadlocks with threads in findResuableFd().

FossilOrigin-Name: f65aa46796068800905f6ff25efcb6338f864ce5bf8dcf6c7b9f5613b3973ab2
2025-12-15 14:56:57 +00:00
drh 55385fb79c Fix an incorrect answer that might arise if a scalar query is both
DISTINCT and contains an OFFSET clause.

FossilOrigin-Name: 35b306565a10c16737ee433728ca188852f01c12dfae0cc9212d21db932486fb
2025-12-09 13:29:08 +00:00
drh fced18af1a Increase the patch number to 3.51.2
FossilOrigin-Name: 58a2a8417f2e0baade43e4da1c74893ab991cfbb34e5e5767d82f201c0b0b389
2025-12-05 01:43:23 +00:00
drh 334fa0eb5a Ensure that the EXISTS-to-JOIN break happens even if the inner loop is
a "no-op" loop that never executes more than once because it is controlled
by a UNIQUE index.

FossilOrigin-Name: 0cf6211f0994474dc23ba5f38d2e6d0984360039798293eca757047e66d00c58
2025-12-05 01:38:59 +00:00
stephan e20e6f59c2 Fix a potential UAF in sqlite3.oo1.DB.exec()'s teardown pieces.
FossilOrigin-Name: 59e0b8a2812f9969402a719174506a20a231a66a15818e6e8830956de2d365e6
2025-12-01 19:20:20 +00:00
drh a1de06a4c6 Version 3.51.1
FossilOrigin-Name: 281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88
2025-11-28 17:28:25 +00:00
drh 158436f53d A better fix for the issue with RETURNING triggers on eponymous
virtual tables and SQLITE_SCHEMA errors.

FossilOrigin-Name: 40ddaca3fb752425c26570365a9f31820786d21d043c1c0a4b49746ff9bc0782
2025-11-28 13:04:31 +00:00
drh d261437615 Fix a buffer overread in fts5 that might occur while processing a corrupt db.
FossilOrigin-Name: 712e31c59254f82e62a19e41d3b6ac15391dd6e9df966cacadfa9ae79415b243
2025-11-28 12:36:04 +00:00
drh 8c7f142470 Fix a problem in the xFilter() method of the fts5_vocab virtual table causing it to omit some result rows in some cases where a virtual cursor is used more than once by SQLite.
FossilOrigin-Name: 0c836387518dee719eaac8992c63da955630ac073a5e4ba4d887160dff42b898
2025-11-28 12:00:14 +00:00
drh 525d297450 CLI shell: ensure that .dump propagates its error code on error.
FossilOrigin-Name: 61222410c503916b832c1b76b028f1c73f4839a2067902f5db1d6a4a4459cb2b
2025-11-13 12:22:14 +00:00
drh 2605119d14 Fix a problem in the EXISTS-to-JOIN optimization so
that it works with nested WHERE and EXISTS statements.

FossilOrigin-Name: 728fac52017de1309c84c96e33ed99d6472d6b4831587312944b8d85a68d3343
2025-11-13 11:42:16 +00:00
drh de223ffbbd Merge various minor code and documentation fixes from trunk into the
patch branch for 3.51.

FossilOrigin-Name: 9a00fe5eb69050ddc569d2a857309c2779a48414135f0967531999b7afd84283
2025-11-13 11:34:38 +00:00
stephan ea0cda00d6 Kick off branch-3.51: bump version to 3.51.1 and cherrypick [0f712b6b0516dc151d].
FossilOrigin-Name: 1b908c439a4d2614cb6a4cec36d8d876eec68b1e2e80d6aad7e21d61d159df7d
2025-11-09 06:38:48 +00:00
drh c2aa8e3875 Version 3.51.0
FossilOrigin-Name: fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744ae4bfa8e74527b
2025-11-04 19:38:17 +00:00
drh 1bf7eb3d49 Use the same compile-time options for the CLI in the auto-setup tarball
as are used in the canonical source tree.
[forum:/forumpost/8975130218|Forum post 8975130218].

FossilOrigin-Name: ccabbe06d4e0650eecc91296d6a3040ed7fef06b47e4d63393a2367c8c8f55cf
2025-11-03 15:34:25 +00:00
dan f1c37a357e Add new column "cwd" to the jobs table in testrunner.db. For recording the directory in which the test ran or is running.
FossilOrigin-Name: 334305a469a51ef0d768ba8443d8cab217f45394cc9f720748a489b10703193d
2025-11-03 15:29:51 +00:00
drh d95fffc9af Adjust the dbstatus2.test module so that it works on 32-bit builds in
addition to 64-bit builds.

FossilOrigin-Name: dcaaa71e750d56afde3e905aaf10729ec95e0ede00522e1b12af6b6345e744ac
2025-11-03 12:36:52 +00:00
drh 4733884eae Update test result output from test/dbstatus2.test module so that it
reports the actual value of nTmpSpill when that value is out of range.

FossilOrigin-Name: 382c8440d7a16eae49fa1644513ae045bfceb072d9b4005963f57f1a57fe94b2
2025-11-03 11:35:13 +00:00
drh 0dfa31d279 Fix the test/speedtest.tcl script so that the CC= command-line option works.
FossilOrigin-Name: 0de0ba878b9ec572d76d47112a0124df9f234fbb7a69c5f5a76ce8c439b11f6f
2025-11-03 10:40:06 +00:00
drh 15c6d88381 Fix a harmless memory leak in the CLI caused by the --cmd option generating
an error message.

FossilOrigin-Name: ab916bad188b150321e420ec0009d909c287e3790b5d6ec683e2df9ed457ff15
2025-11-03 10:14:20 +00:00
drh eaacb4ac37 Add pedantic OOM detection logic to some disused diagnostic and test code.
No changes to any deliverables.

FossilOrigin-Name: abb6945fc62a1855786bda1f473edef0e937a791c453387a0859a6ce0451635a
2025-11-02 22:57:26 +00:00
drh 0c747e1653 Update the test/walthread.test testing script so that it uses a random
database name.

FossilOrigin-Name: ce25a758d4cea1741cb3db6384720f17faef61b352d494ab410a83a41f1721d3
2025-11-01 20:14:43 +00:00
stephan e5c8467a8e Fix ext/wasm/mkdist.sh to use ./version-info instead of ../../version-info (a recent build change made to ensure that builds with a custom sqlite3.c embed that version info).
FossilOrigin-Name: d25a92d88923f880d6477a99f2a35528faea83e7db245f2b07db80613b4aeb8e
2025-11-01 14:49:05 +00:00
drh b2b8ab6bc8 Updates to the compile-for-windows.md document. No changes to code.
FossilOrigin-Name: 652310a9f0ef2a870b5033029278b1fbef28c2ec15405d1b32bf1d51df28266c
2025-10-31 17:45:59 +00:00
dan 7f70085071 Detect some cases of ambiguous column references in USING clauses that can come up with nested joins.
FossilOrigin-Name: 38c993c8b7137d6d5623d387292639634297c17da11befec9029f12a16a472f8
2025-10-31 16:07:31 +00:00
drh a183595edd Change the name of a file-scope constant array in carray.c so that it does
not conflict with other variables names in other files when carray.c is
amalgamated.  This is down to resolve a harmless compiler warning.

FossilOrigin-Name: 5afd815ada94d55c9c56efe339235d23ffbf1fb64511a5e460927a2c8deaaaf0
2025-10-31 15:18:29 +00:00
drh 63ab7c625c Update the main README.md file to use the robot-safe /rchvdwnld page on the
server for downloads.

FossilOrigin-Name: c1aa52361b8ede611f64b96f2394174389ce531b1d86b9cfec91d3b03c94f6ea
2025-10-31 13:44:51 +00:00
drh 1c19c06246 Fix the output of ".dump" in the CLI so that the sqlite_sequence table
is created using correct syntax.

FossilOrigin-Name: 4b9f2e1d4485ad3baf9285aa09b468469be929b18cb308f19af471d7aac66076
2025-10-31 11:23:44 +00:00
drh da17de532f New assert() statements to help out static analyzers.
FossilOrigin-Name: ba0c4bf072ed721a507855d68bde7f1c388396a19b69814b6e257b934f8b0fd9
2025-10-30 22:10:41 +00:00
stephan 1ed6441bb1 Add SQLITE_OMIT_WAL checks around some functions to avoid defining unused statics in such builds. Fixes OMIT_WAL builds on msys2 and passes tool/omittest-msvc.tcl.
FossilOrigin-Name: f9b89535dc279acf617f274b6edbad0610fc8e5c76d402fc8b5b9dc656e95caa
2025-10-30 21:11:01 +00:00
drh 139ec38ac8 Further improvements the ".dump" command to handle corner cases.
FossilOrigin-Name: cd0c77934ff32050380c2143bba7d4e6c07d5f08187cb5d5e8e7602854d1cda8
2025-10-30 18:52:48 +00:00
stephan 41fda52f3c Another (void), as per [dd6edfc09434].
FossilOrigin-Name: 7a822cfd388d7ac5765cffd5bd3d6e5b31abc6a360f9d5e27c0223f83a84237e
2025-10-30 18:48:19 +00:00
stephan 7fb2545905 Add (void) to two places for the sake of SQLITE_OMIT_WAL builds. Why these do not complain on tests in this tree, but do on a downstream tree (same machine, same compiler), is a mystery.
FossilOrigin-Name: dd6edfc09434b0d170d5ab462053497043016a4ec6b91a46db565ccf646aee20
2025-10-30 18:46:03 +00:00
stephan 3a61466a2f wasm: re-add SQLITE_OMIT_WAL to the c-pp-lite build flags.
FossilOrigin-Name: 617f8ac40e073c3fdc1144639b78617ad61113f4e873fc20c99399d2b60e1ceb
2025-10-30 18:39:28 +00:00
stephan 916fc1129c Macro tweaks to get SQLITE_OMIT_WAL building. Remove some nearby stray EOL whitespace.
FossilOrigin-Name: c31a944680f18a799c763238dbb0561f8b039905ce442533258905219b33b743
2025-10-30 18:38:14 +00:00
drh a8a99becb5 Fix a typo and improve wording in README.md
FossilOrigin-Name: 34a662ce24930a5e1a142f0b3ce427c4b1b61a306537820dc5e72996f8080d86
2025-10-30 18:33:58 +00:00
drh f3b396494f Updates to the tool/warnings.sh script for better compiler warnings.
FossilOrigin-Name: c9c64892c76cb9f2efb58428b349d43b075e7595b6a391d4818a7e9fb68b85fd
2025-10-30 18:32:32 +00:00
drh 4ebf49168a Fix a harmless compiler warning associated with flexarrays.
FossilOrigin-Name: f02cdf1d3ea8da8a09d115721845afeff5d6169dd7532ab486d3ed6db69cde2d
2025-10-30 17:23:17 +00:00
drh c6b86ba2ab Updates to the main README.md file.
FossilOrigin-Name: ab10c4cd9f9314bc62aa310ee796f63c82710c35659debe347e8ebcbf34d9e86
2025-10-30 15:43:57 +00:00
drh c5ff2aa7cf Fix the CLI ".dump" command so that it does not make duplicate
sqlite_sequence table entries as described in
[forum:/forumpost/b1674b56ad|forum thread b1674b56ad].

FossilOrigin-Name: c833f26a6780f919551e50c67d308e96293cec8481899354411d805617481f24
2025-10-30 11:39:49 +00:00
drh cb36dc3f3e Prevent a harmless signed integer overflow in the CLI if the argument
to the --skip option of the ".inport" command is -9223372036854775808.

FossilOrigin-Name: 247277d9373cb2614a1bc4c1e08b904315e5e8c0c2a7fbe9c2ac651481601642
2025-10-30 10:36:10 +00:00
stephan 7c86a0321e Remove an OMIT_WAL from the wasm build because it breaks with the current amalgamation (and isn't strictly needed here anyway).
FossilOrigin-Name: a7be7d155aa6f02075f939ab6d26cfdfe2d0832b59da39c8bf4a74fc4845bd05
2025-10-30 01:43:30 +00:00
drh d443f0a95f Fix a logic error introduced by [cea8bf79e18d55a8] which caused
"0 OR 2" to be evaluated as "2" instead of as "1".  Problem reported at
[forum:/forumpost/d5f32040c5d50d2d|forum post d5f32040c].

FossilOrigin-Name: 095cc4f22e63c98cbb2acabdbcaf02e59e67ec6d3cc219b5f42a714e3d53a264
2025-10-29 20:47:01 +00:00
stephan 34b1bf16ec Tiny cosmetic tweak to configure script output. No functional changes.
FossilOrigin-Name: e2c20aa5929e5b79aabca8a51fb3e32e0533526d64d7576d3caf1c847fff58b4
2025-10-28 22:09:43 +00:00
stephan 74cd3c53f9 Typo fixes in LICENSE.md from BrickViking.
FossilOrigin-Name: 26ddec291696dd99c7f84a21b2dd272ce9bf32598ca38413ac89432d45527f8d
2025-10-28 19:57:15 +00:00
drh ffbfc27fab Fix an signed integer overflow problem that can occur when using an oversize
value for the SQLITE_MAX_LENGTH compile-time option together with
multi-gigabyte operands to the OP_Concat operator.

FossilOrigin-Name: 724f2299f206cc9e7f830f984c50a8fc4ac1c17210d71d9affe657b45252b060
2025-10-28 13:24:50 +00:00
drh 5a9ada593f Add enhanced resistance to corruption after posix advisory locks on the
database file been unintentionally broken on unix by running
close(open(DBFILE)) from a separate thread.

FossilOrigin-Name: 6385a1962c69c69ca4775888f034a4eb892aa013689c000f3de6422da7c3c695
2025-10-28 10:50:55 +00:00
drh 9c0770537f Enhance the CLI so that it can handle inputs larger than 2 billion lines.
FossilOrigin-Name: 5daebf2d6013e73d89c9feb796e15b67c39577e5a9e9c86fa260995f4118f04b
2025-10-28 10:44:26 +00:00
drh 6cc222c3be Additional comments explaining what unixIsSharingShmNode() does. No
changes to code.

FossilOrigin-Name: 819fc87385fd5be8a847492478f4c4f247f64edf7c7161b641bfbac6b658bec5
2025-10-28 01:28:20 +00:00
drh db0d47b749 Omit unnecessary branches from the unixIsSharingShmNode() implementation.
FossilOrigin-Name: 2d5623bc27073c407ec63e401f095d12f0025dd276a0bdc26d8b94b1f13c9a36
2025-10-27 23:57:57 +00:00
drh e34f35c833 The unixIsSharingShmNode() function should always return false for the
unix-excl VFS.

FossilOrigin-Name: 770f35dae47a98554b18f8a7aa9f6b6e39ae2b3aa8dce8d75b5bed0c6f0f9c21
2025-10-27 15:44:16 +00:00
drh 626351d444 Implement an experimental defensive measure to try to prevent the -wal and
-shm files of an active WAL-mode database connection from being deleted out
from under the database connection in the case where the database SHARED
lock has been released by an accidental call to close() in a different
thread, or similar.

FossilOrigin-Name: ed1b9206640f66cb8abff444809ccab8a4a5157b5c90e9aacddc422210e63423
2025-10-27 14:24:02 +00:00
dan 6e27846323 Fix a minor over-allocation of heap memory in wal.c.
FossilOrigin-Name: 1803cb9bb6a13fb66956f729066b6eae64c3a1c0715102fb1a9994e395c12ba9
2025-10-27 11:39:07 +00:00
dan 8ce786f173 Fix sanitizer complaints in the regexp extension.
FossilOrigin-Name: 6ff9ecb89d769bc2a27f8a57130f28ec7478979d3e35ba765c16017b5bdf775d
2025-10-27 11:20:47 +00:00
stephan 6b9230d2a1 Merge the OPFS/SEE tests into trunk (where they should have been committed).
FossilOrigin-Name: f8a4d7abf0d1c9c92fa102165d08aed76fd766d49615e3d347b5547580355574
2025-10-26 21:58:41 +00:00
stephan d4ead9b9e4 A better/cleaner fix for [1c80ff88c0ce].
FossilOrigin-Name: 6138043bdde09224a764b5d5f18a9e2776c761c424f41b0d69427d92d47ec41c
2025-10-26 18:36:57 +00:00
stephan f57d368078 c-pp-lite: Fix another newline-related off-by-one which could cause newlines to get lost in @token@ filtering. Problem found in out-of-tree testing.
FossilOrigin-Name: 1c80ff88c0ce3d1c168c9bda734cf52114c35efdcf46a6da78f0ed9adc794eb8
2025-10-26 17:59:30 +00:00
stephan 3fceae3b95 Doc typo fix reported in the forum. No code changes.
FossilOrigin-Name: 6e065b6aa099f31493cfea22a729f92bb312147d8584f663fb75630a25772e43
2025-10-26 12:34:13 +00:00
drh 38113d392d Add the SQLITE_FCNTL_FILESTAT file control and the sqlite_filestat() SQL
function.

FossilOrigin-Name: 9870afcb2a360dff83e211009710bc85db238d9a6993afcc1eb38ca7699fb4a5
2025-10-25 22:22:58 +00:00
drh a105989856 Rename the file control to SQLITE_FCNTL_FILESTAT. Rename the SQL function
to sqlite_filestat().  Rename the enable macro to SQLITE_ENABLE_FILESTAT.

FossilOrigin-Name: ee797fec4eeace78caa2c5e463108bf1a6568db7c33d94d9fe6624cfc6b0d4fe
2025-10-25 20:46:09 +00:00
drh ecbeefecd0 Fix a bug in sqlite_file_info() output: It was showing the "pal" for
the main file descriptor when traversing other unused file descriptors
for the same inode.

FossilOrigin-Name: 3c4020d76e29c39483f6b92857ea470245afcd514870c63bd3373e0e213cd355
2025-10-25 19:51:16 +00:00
drh 2b24d8957e New --normal option for the ".open" command in the CLI. Also, when opening
the database for deduceDatabaseType(), use the same open-flags that will
be used subsequently for the official open, to avoid creating unusable
file descriptors that need to be held until all database instances close.

FossilOrigin-Name: 5e20a0435b1bd84d90c9a419219afe794fdf8ea73213f4c7ae5612c0375bed55
2025-10-25 19:36:12 +00:00
drh 726e836108 Add additional information about unix file descriptors to the same database file
in the sqlite_file_info() output.

FossilOrigin-Name: 64045f0a4d71ef068d64f2f25799cf1ae79c3cdb94039c73f1066290e3dbc943
2025-10-25 19:26:16 +00:00
drh 7be565f0cc Adjust unixPosixAdvisorLocks() to use redirectable system calls so that
it can be tested.

FossilOrigin-Name: eafe88b782875cd839fc27da509830e3e1d95781c686e27242a2844910203a42
2025-10-25 18:40:18 +00:00
drh c053b57716 Merge the CLI deduceDatabaseType fix from trunk.
FossilOrigin-Name: 82f907016ee75ca288d8ac0664d5c147fbfad42c5f8222211acc3220bd0eb609
2025-10-25 18:36:14 +00:00
drh 0d859b4828 Fix the CLI so that it does not try to open what might be an SQLite
database using open() in the deduceDatabaseType() routine, as this can
lead to broken posix advisory locks.

FossilOrigin-Name: 2a3a02715fa53673531575fa13aee056711139b409367cccc18654e82720c4e6
2025-10-25 18:35:29 +00:00
drh ab29c24dc3 Additional information about the unixShm shown.
FossilOrigin-Name: 85846c7fbeeaf5fccfcbe11a4b87c4ee49781456ccb4da1d090b7823d7b456d6
2025-10-25 14:06:36 +00:00
drh dcc07d3ca6 Do not attempt to show posix-advisory-locking status on journal files.
FossilOrigin-Name: 7f8baf64bb722d7dfdfca22d4f11a72113d5ed2b36d6cc6020fb0acf8185b3e7
2025-10-25 13:55:49 +00:00
drh 234c6c4bf0 The sqlite_file_info() function should always return JSON, unless there
is an OOM.

FossilOrigin-Name: 65aed79c29bf1aac0934475c02b358b916f413b20d2475ec7b631011f21f4e2b
2025-10-25 13:16:41 +00:00
drh 86319b841a New symbolic representation of posix advisory locking information
FossilOrigin-Name: b7d991ae04da1d6731b67fbdca65df996ec1c14a9530880fb7dbeeaef2575d14
2025-10-25 12:53:03 +00:00
drh f4e66056ac Merge trunk enhancements into the file-info branch.
FossilOrigin-Name: 73e1e081e9f7fc0ece98222669d13abde16197f0befc3343246a9e7da7856f02
2025-10-25 11:47:04 +00:00
drh 76db3a6e66 Stricter assert() statements on unixShmSystemLock().
FossilOrigin-Name: ed01ed337c04cce4cdbb6e80628b6f716d537e072b80067bd2bd6c5d18a1454f
2025-10-25 11:37:54 +00:00
drh 003737d1dc Improvements to the design of the /proc lock analysis.
FossilOrigin-Name: f2809dd3b266c0a6a6eb4ed62812a907493fb4006d26f8905df7ff2b1ca01a5e
2025-10-24 23:12:33 +00:00
stephan be4d0c2e2f Make it particularly clear in the wasm build output that unsupported builds are exactly that. Cosmetic tweak only, no functional changes.
FossilOrigin-Name: 86f53a2eb37d8ec98bc9d4c6b00253cc00d798e79c7d409e65d608354a556e19
2025-10-24 20:29:12 +00:00
drh aeb886bc53 Easier to read /proc lock interpretation.
FossilOrigin-Name: d7bcc54beb6463501c0559333455bd2a378798b58cb48f35590e9026d07acd2f
2025-10-24 20:26:13 +00:00
drh 2f9311c5cb Flesh out the sqlite_file_info() function further, and in particular
show locks based in /proc/PID/fdinfo/FD, when that information is
available.

FossilOrigin-Name: ce75111cced8a03f05cf47ef809b9f017f2dac3c64c6008d595f28dbfec32057
2025-10-24 20:04:16 +00:00
drh 093b26e8e0 New diagnostic SQL function "sqlite_file_info()" and its associated
file-control SQLITE_FCNTL_GET_INFO.

FossilOrigin-Name: 56ab9692583d5b64e1ab727e08a01c0a65b4e318b455c94397663ef8d3d7b6b8
2025-10-24 17:42:03 +00:00
stephan 63ee854264 Fix a duplicate SQLITE_API on sqlite3_carray_bind(), as reported in [forum:7499e8a19edc8908|forum post 7499e8a19e].
FossilOrigin-Name: 62917cd4297e734477d3201481548ddb7f79ec977b9da7d9313bc7f1c0091187
2025-10-24 17:16:00 +00:00
stephan 3ba506d9cc ext/wasm: dependencies fix for parallel builds attempted immediately after a distclean. Add version-info to the distclean rules.
FossilOrigin-Name: b99233fe3d901714c4369ba25c510050fb7a8a85c1168780108595e9639a6d15
2025-10-24 16:39:58 +00:00
stephan 67fa337744 ext/wasm/GNUmakefile: (A) When using a custom sqlite3.c, use sqlite3.h from the same directory instead of the top of this tree. (B) Re-add preprocessor flags for SEE which were misplaced during recent build refactoring.
FossilOrigin-Name: 1b1e530a9149ce62d3d53f5c558e358d4e6d1b00e0cce8bb04cb6b13d1841538
2025-10-24 16:25:23 +00:00
drh 033dbac510 Fix [4e713558f6c6ea3d] so that it supports separate builds of rtree.
FossilOrigin-Name: d030e955d703772e1637ef2c07d29816fc869ead0a15a85ec8b4633e5ca08e0a
2025-10-24 16:01:55 +00:00
stephan 9af334f54a Document minor discrepancies in how sqlite3_bind_pointer() and sqlite3_carray_bind() react to the SQLITE_TRANSIENT and SQLITE_STATIC finalizers.
FossilOrigin-Name: b92478c389a9ff57302c021444ced09aef067ab55394dcda38cde97a3f2628d4
2025-10-24 15:18:13 +00:00
stephan 4bb53ab2e4 Make explicit that sqlite3_bind_pointer() and sqlite3_carray_bind() call the provided destructor even if those routines fail, per [forum:6d81b10952|forum feedback].
FossilOrigin-Name: 1fcb0b60798c708fec53d9d69a65cca2e37a9af7a5fa654c7b2bba97056cd461
2025-10-24 14:30:42 +00:00
drh 7adc9a5978 Update the MSVC makefile for the amalgamation distribution.
FossilOrigin-Name: 440ce1cff2b7519912fec87f440894592e901d730bf74cf99479e7b1d047bf02
2025-10-24 13:23:43 +00:00
drh acdda1075d Enhance the tokenizer so that it is able to deal with individual tokens
larger than 2GiB.

FossilOrigin-Name: 4e713558f6c6ea3dfbc97d2eb0a328955ef6ad6f2ad05517efe9ed4a60181440
2025-10-24 13:18:31 +00:00
drh bc2691d5c1 In the CLI, improved error messages on input errors. Limit the size of a
single SQL statement to a little more than 2GB.

FossilOrigin-Name: 0b50e7e10aae3d57f1cbd38d02be50cfbd2d5148ab4a9be712afd8678787b7bd
2025-10-24 12:32:32 +00:00
drh 95c188d557 Limit the size of --hexdb files in the CLI to 2 billion lines, to avoid
overflowing the line number counter.

FossilOrigin-Name: 2adfd0f47b028b8378e6cc08dc22abf1606036bbd285a7bc3a0de0eaf6feeb8f
2025-10-24 09:24:56 +00:00
drh 4043096408 Additional defenses against over-sized inputs in the (unused) amatch.c
demonstration code.

FossilOrigin-Name: b9f6ae0767ce5d9cbc6fca6d63c929f919473fa669e50a0a460627e5fde2628c
2025-10-23 14:05:58 +00:00
drh d06a0be514 Fix a faulty error message in the ext/misc/fileio.c extension.
FossilOrigin-Name: 1fdef271cd15d0960a7933253a10f288e26771cdcf34b5cd22adbc49d6341bc5
2025-10-23 13:10:34 +00:00
drh 984e446891 Adjust some of the markdown in the LICENSE.md file so that it will hopefully
work better on GitHub.

FossilOrigin-Name: 773f9d3dcf1ac7a9ce7f0911f46301f3e0e01d699f73a264cab692299a8d615e
2025-10-22 00:38:28 +00:00
stephan 774ce0ba43 Back out [b144f875d6bddce6] and remove the former check for strchrnul() from the configure script.
FossilOrigin-Name: f4e059b2243c6db37b4dd201b03f0c1916baec5e9e1a660815fcd7eeaf530367
2025-10-21 16:15:53 +00:00
drh d41f5ef7e6 Reduce the maximum size of LIKE and GLOB patterns in the ossfuzz.c test
module to avoid false-positive infinite loop reports from OSS-Fuzz based
on long and complex fuzzer-generated LIKE/GLOB patterns that are not actually
infinite loops, but which do take a long time to resolve.

FossilOrigin-Name: 53edea286b0a38f4f9c7017276f3a826037919144d517f8c89ef0f35b65af5f1
2025-10-19 17:30:07 +00:00
drh efe8ae567c Use 64-bit memory allocations everywhere in the expert extension.
FossilOrigin-Name: 6caf793b8f406f5089e3811591bc69384646df16ee18d63bd63760eaaa95d122
2025-10-18 11:19:02 +00:00
drh 21c57abc53 Increase the range of integer indexes in the the merge() family of
SQL functions.

FossilOrigin-Name: 8d3943890ef3b533df35c4784c2a42c52503a4d9c3dbe67241510d8b70669b48
2025-10-18 11:04:03 +00:00
drh 31c86ca0a8 Fix a minor memory leak in the CLI that can occur following an error
in the ".output" dot-command.

FossilOrigin-Name: d1044bc0616fd20c63ca3b627ad0a116256870a082a72da26f98fb0f59ca44fd
2025-10-17 10:06:44 +00:00
stephan 9f36870a77 Resolve the MacOS-specific build issue reported in [forum:95edc7a8d7d1de59|forum post 95edc7a8d7d1de59], with help from Bo Lindbergh.
FossilOrigin-Name: b144f875d6bddce62e8f2ad42bfe5dfa6c2434f2ef3edb86847fb4c23aa46814
2025-10-16 23:42:39 +00:00
dan 9c3fcd932d Improve performance of the shell tool ".ar" command when it is given a large number of arguments.
FossilOrigin-Name: 8fed9de84bce01e88e0e8237e245c0ff9fe9f46394c603887e360658f5ef1ac1
2025-10-16 14:17:30 +00:00
drh 0a585a64d2 In dbpage.c, disable truncation on any update error, including errors
in sqlite3PagerWrite().

FossilOrigin-Name: eee5ba5d8a9d01000345185731c531eb84d3cb8e81bf429506c449d962aad843
2025-10-16 12:43:36 +00:00
stephan 6eaeea0a3b Fix an off-by-one in c-pp-lite.c which could cause @token@-processed output to get one duplicated byte.
FossilOrigin-Name: aa2f4c51604f4d4286c8a1ec7eaa6251892471e32087af695712513ee620ea46
2025-10-16 01:44:03 +00:00
stephan e826aa8e00 Minor JS doc updates. No code changes.
FossilOrigin-Name: fc2a026901b1a12526b92fff36d7acc226e554c9f351e6261c7ffd4887bcc337
2025-10-15 23:28:31 +00:00
stephan ff5d4c348c Resolve a valgrind-reported error in ext/wasm/c-pp-lite.c caused by successful exit colliding with the atexit() handler. Add -e SCRIPT support to c-pp-lite to facilitate testing.
FossilOrigin-Name: 7801c7225a18ccb2216b01663b30e3eb90a961e3d165af73f964c515b74fe745
2025-10-15 23:13:50 +00:00
dan f66a0600d8 Improve performance of the shell tool ".ar" command when it is given a large number of arguments.
FossilOrigin-Name: 0398897067ca5cdedfef0ce7a034ba6d5a2ce6104605ef4ed1c7549499435b44
2025-10-15 15:54:38 +00:00
drh 34c1e04cbf Fix memory allocation in the ".table" command of the .cli when the number
of tables in the database file approaches 2 billion.

FossilOrigin-Name: 5cbccab499bc3983aac1f57355552db607dee6c7ef4eb00d794dbee89c18db70
2025-10-15 10:52:45 +00:00
drh f83df5b150 Reestablish APIARMOR for the sqlite3_db_status() interface.
FossilOrigin-Name: 1738f0bdf5941a70684c82d2040561e53a272595026a837a9f9bab8508a46480
2025-10-14 19:21:46 +00:00
stephan d6cb2ccee6 JS/WASM: Expose sqlite3_db_status64(), sqlite3changeset_apply_v3(), sqlite3changeset_apply_v3_strm(), and SQLITE_DBSTATUS_TEMPBUF_SPILL.
FossilOrigin-Name: b13eafc9b6820517b450041a7e2be573a896b5b9e88b2b28df9f15e3cb91e23d
2025-10-14 18:23:32 +00:00
drh e7cf3fe4c8 Add the test/testloadext.c loadable extension to test the ability to use
the latest APIs using the loadable extension mechanism.

FossilOrigin-Name: a9bd7ed6f77c5e53f9130eac7eb999c662e9158fb229a462d29f18653284d6d0
2025-10-14 17:50:55 +00:00
drh efde2f6059 Add the sqlite3_db_status64() interface and the
SQLITE_DBSTATUS_TEMPSTORE_SPILL option for use in that interface.

FossilOrigin-Name: 9f8739ddea6ec6d8890d0e8f6a0143773a008e4f96bd02a48d4bfebb3f9b72fe
2025-10-14 17:09:06 +00:00
drh 53a6b7d138 Make the new sqlite3_db_status64() API accessible to extensions.
FossilOrigin-Name: 2ebd7330312f3ee4674c343b7a19b703f1f89611a6846a0e2be39867f9895522
2025-10-14 16:57:50 +00:00
stephan 4472c967a6 Fix two links in ext/wasm/README.md.
FossilOrigin-Name: 0f96eaeaa8c51c20f8d389bfd6d0d6371e8bb29ff7e8eaf3a0bcb35cb2b73338
2025-10-14 14:07:58 +00:00
drh abe709be8d Extra defenses against integer overflow in the decimal extension.
FossilOrigin-Name: 1a7414d9b5be7ce18b23c357fd98cd0e96d78ac626abfa6e4e0dee494b6a1efc
2025-10-14 14:03:09 +00:00
stephan 5dbbe50758 Add a section to ext/wasm/README.md about the dependency on wabt/wasm-strip for release builds.
FossilOrigin-Name: 0dbb13863b3ff1da1be664967ac05c79cf34f7a78def05fe4f6407c06cb4322a
2025-10-14 13:47:40 +00:00
stephan 9f136fc5ed Fix a makefile typo which caused a build directory to not get mkdir'd for the fiddle build.
FossilOrigin-Name: d98d5abf6d27c5359ff8c797ad57394b96074e47010bc4c24120ba69a967dc3c
2025-10-14 13:25:02 +00:00
drh 898ac77f55 Merge all the latest trunk enhancements into the dbstatus-spill branch.
FossilOrigin-Name: 55f2613c1bacddb05902d4d5dac3d2b49b91053e6249dd926bb953c763eafeb0
2025-10-14 11:18:45 +00:00
dan 264bcad69a Avoid integer overflows (a) when dealing with zeroblob(N) calls when 2*N is larger than 2^31, and (b) in fts5 when a corrupt record is close to 2^31 bytes in size. Both of these require special builds with SQLITE_MAX_LENGTH set to a non-default value.
FossilOrigin-Name: 27927519696dcb78ff72e245158ea6d33a1b2c3d4da314d4d0283c47d847c3da
2025-10-13 16:07:28 +00:00
drh a8bb50ce95 Fix a bug in concat_ws() in which an initial empty string was treated as if
it was a NULL value.

FossilOrigin-Name: eb2e4e46171c12f59aa5d571eeb310534360b110c3e7bda6eaf68f0e25546264
2025-10-13 12:36:54 +00:00
drh c93270ebc7 Enable CLI documentation for .imposter
FossilOrigin-Name: c639c7be029f86defe6cb8cef094e1126ec8ab3968e12d4d2bf6e6ab23c39821
2025-10-13 10:35:59 +00:00
drh 94356039d0 Fix broken hyperlinks in the documentation.
FossilOrigin-Name: 62e6b120c43cd855349bf1b40ad2fb992e31a6e2567e5b145cf1849445849da7
2025-10-12 19:17:31 +00:00
drh ee4676b3f7 Fix order of operations in the OP_Concat operator of the byte-code engine
to avoid any possibility of an integer overflow.

FossilOrigin-Name: 765e6569824ccc34292d6df16a6cd682e6503f20adebe0a43cd2118d69072a63
2025-10-12 10:31:34 +00:00
drh e4eaf174a5 Remove an unused variable from the generate_series implementation.
FossilOrigin-Name: a523e4adbf8e60ea8c3351f33aff793c6e425c594038e8578d12564bf47aac03
2025-10-11 18:44:54 +00:00
dan 59e1ab5576 Fix an assert() that could fail when reading a blob or text value larger than 1GiB from the database (requires a non-default build configuration). This is an assert() fix only, production builds were functioning correctly.
FossilOrigin-Name: 3e5ec5731f0c8c5f7da357c63d315aae5a2aca5c1b3567bc8c9386ccc2a798cf
2025-10-11 16:23:22 +00:00
drh 11878165f6 Improvements to the (rarely used) home-grown varients of seriesCeil()
and seriesFloor() based on ideas from
[forum:/forumpost/2025-10-11T12:36:56z|forum post 2025-10-11T12:36:56z].

FossilOrigin-Name: e6b9bfdb6f8f86d4d2891d65fee4274dcbc61c9e998d81f90232153c05788cab
2025-10-11 15:45:47 +00:00
drh 5013fd1f81 Provide alternative implementations of ceil() and floor() to the
generate_series() function so that it will build even when SQLite is
compiled using --disable-math.
[forum:/forumpost/91690fa646|Forum post 91690fa646].

FossilOrigin-Name: 97d6fd2c99578adb6a1e9b879ba5ae5ad798a8ef8f0646bf0102747d52148bff
2025-10-10 19:43:03 +00:00
dan eeb2e03b7b Back out [8bf26c956e]. It is not required following [8e7da8cf50].
FossilOrigin-Name: ea29180797aa4bb25180432e75a372277a6f6e2262906a9e765a3bddf8ca79d7
2025-10-10 16:04:19 +00:00
drh 80f0fcd31d Fix harmless compiler warnings.
FossilOrigin-Name: 4966d7a1ce42af8b1c50fdd40e651e80d0eeb8cb62dd882950cab275f98aba88
2025-10-10 14:31:46 +00:00
drh 8c1670642d Makefile updates to suppose carray() and percentile(). Add Carray to
the CLI and fuzzcheck to support debugging.

FossilOrigin-Name: fe9cf68b513d1e8cfcde90f1982a7f4123f54e3ebb004d961a99bdf6bec03a32
2025-10-10 14:22:05 +00:00
stephan e33786f09a Regenerate autoconf/Makefile.msc to squelch a 'make test' warning.
FossilOrigin-Name: f7f55dce184c433b7774ab569caaeae5994c63421de01e9ea36aa1dbecb2d579
2025-10-10 14:00:27 +00:00
drh f9d511319b Fix the carrayfault.test script so that it works in configurations that
do not support virtual tables.

FossilOrigin-Name: 767a667b91caff2e789179231f13a0d260c9837020c0ce1553b86e88cf9aa352
2025-10-10 13:43:53 +00:00
drh ea0d2cebd9 Avoid (apparently harmless) undefined behavior in CARRAY if the rowid
is used as a constraint in the WHERE clause.

FossilOrigin-Name: 200b3c8f6cebf34428b0b41fc05f7361771dfee3592cfcdce512084abcc99713
2025-10-10 10:40:37 +00:00
drh 7b34ca9cc1 Fix the sqlite3_bind_blob() interface so that it sets the encoding of the
underlying sqlite3_value object to the database encoding.  Fix for the
problem reported by
[forum:/forumpost/2025-10-07T12:47:25z|forum post 2025-10-07T12:47:25z].

FossilOrigin-Name: 8e7da8cf506059dde98000db2731b8c47951344263df680a12b7c95aaece2568
2025-10-10 00:59:28 +00:00
drh 8080411752 Fix the xBestIndex method on carray so that it gives a coherient query plan
in a join when some of the arguments to carray() come from other table
in the join.

FossilOrigin-Name: c8417b3261b2c9f20dcc38c482b9fc43acb97d933eb723c2f6698a7435a192eb
2025-10-10 00:26:46 +00:00
drh 97fa2fe414 Fix carrayfault.test so that it works with the new built-in CARRAY.
FossilOrigin-Name: 22f694682107036e68b67e48123d606aeff8cd8b7fedc8ab8ed9cc1a9cccd73f
2025-10-09 19:23:01 +00:00
stephan b4fdfc2f9a Update c-pp.c and rename it to c-pp-lite.c to match its new upstream name. Adapt the JS files and mkwasmbuilds.c for c-pp syntactic changes.
FossilOrigin-Name: bb13e46ddfcd1d3ca73845430d9a91c0ea3913762d39bbd94127783d77e4f63b
2025-10-09 15:28:59 +00:00
dan 40d299ae32 Avoid corrupting the fts5 index if a value that was inserted via sqlite3_bind_blob() in a non-utf8 db is deleted.
FossilOrigin-Name: 8bf26c956e199762d55c159392c2e3813a9e12b914d3ca33000bf332cd946cb0
2025-10-09 14:50:27 +00:00
drh 0f5a3f16f3 In the CLI, limit column widths specified by the ".width" command to
have an absolute value not more than 30,000.

FossilOrigin-Name: b3741f1101d25eded57a62b4967ec1bcce532dc9937c4b7b74cb689861efb442
2025-10-09 14:01:52 +00:00
drh 3be9a9b984 Move the carray() extension and the percentile extension into the
amalgamation.  Both are still turned off by default and must be
enable using SQLITE_ENABLE_CARRAY and SQLITE_ENABLE_PERCENTILE compile-time
options, so there is no increase in object code size.  However, these
extensions are now more easily available.

FossilOrigin-Name: 2d40dc2173ac394024ae267419bd8d3621f15d4cd2449c9c2f7310acc3b190f0
2025-10-08 19:01:00 +00:00
drh 8f2f5e4963 Add the SQLITE_ prefix to the type constants used by sqlite3_carray_bind().
FossilOrigin-Name: e11e9913e56d42d2baa07f1b549f212b873fe7343a06825682d843471c4a3640
2025-10-08 18:51:15 +00:00
stephan 0df9db4921 Make use of the new SQLITE_ENABLE_PERCENTILE in the wasm build.
FossilOrigin-Name: 937c084c2d9b20fde2d54e48257cb7018bd8c36d6f00ed6f1659b5ecc2f48ed4
2025-10-08 18:17:19 +00:00
drh 01f5e6e757 Add ENABLE compile-time options to enable carray() and median(). Hence
there is no new code and no increase in library size without the ENABLE
macros.

FossilOrigin-Name: 7dec290b413ca1bc67694743d8b771e1634fd85251f1a23d60aaf36c63f0f366
2025-10-08 18:11:37 +00:00
drh ba5cce9f08 This is how the percentile() family of functions might be integrated into
the amalgamation, should we elect to do such a thing.

FossilOrigin-Name: c2cfc9c92e35105e26a4c0887b0401ace15a874fd18046135de4b375ba968795
2025-10-08 16:29:14 +00:00
drh cdaff852bf Were we to choose to integrate the carray() table-valued function into the
amalgamation, that integration might look something like this.

FossilOrigin-Name: 2b43d5d7dcc5aee14a050c824a5e09b6a38a9c78ddcc25a994eba5d4c5ad9ba2
2025-10-08 15:32:55 +00:00
drh e15ef5b756 Fix harmless integer overflow in the CLI when arguments to --lookaside are
ridiculously large.

FossilOrigin-Name: 8bf337e6e609dd38de6002f2d3d3ebf52dd0462ed98a50e4b002a7c6860d30c5
2025-10-08 12:37:01 +00:00
dan d3973778a1 Fix an uninitialized variable problem in test1.c.
FossilOrigin-Name: 059203f658273712597d45d9b4a9cf1aea20368fe51224b38e28797b045fb6b8
2025-10-08 11:00:04 +00:00
drh 55085a2cc2 The ".dbtotxt" command in the CLI should not fail if the database is
uninitialized.  It should instead be a no-op.

FossilOrigin-Name: 2818ef64d9233095b065101392768071fbd95729cde060b954f48ea821fc549a
2025-10-08 09:52:52 +00:00
stephan b8d2ca1513 Function name doc typo fixes for sqlite3_source_id() (sic.).
FossilOrigin-Name: 03c3f12853163ce542239a98bdf8e830db2fc7ccf1edb2f9c783fcfdca858879
2025-10-08 02:05:15 +00:00
dan 6147a0f6a1 Add test cases for the carray module.
FossilOrigin-Name: dcfc0164a95eddb5e924c606850fe2015e8f2f516d36b380cbb79d6bdfe034fc
2025-10-07 21:02:37 +00:00
drh 308831d1c7 Improve the invariant checker module so that so that it added "+" before
"column ISNULL" in queries where the base query contains a GROUP BY, to
prevent the ISNULL term from being pushed down into the subquery, since
that can cause ambiguities if column is UNIQUE.

FossilOrigin-Name: b4ff920fbeef9a8590219596d73c09976da3da53c08a685be56f6b2cd2cdc70c
2025-10-07 18:06:05 +00:00
dan 9b6bc61dbd Fix some integer overflow warnings in the base64 and base85 extensions.
FossilOrigin-Name: 06b4bd2aba22c57f5a5fed606c3bee225dee6fdc13bb16cc58194040ef0d7d85
2025-10-07 15:14:03 +00:00
dan 7aa5271c72 Fix a minor problem with building sqlite3.c without manifest.tags.
FossilOrigin-Name: 140f0f9fd389c99dc6ba1fdca7658c43d8dc3f3c128484fbafa7d67c33fe1001
2025-10-06 20:11:18 +00:00
dan 9804ed7021 Avoid attempting to delete a file that is still open in sessionnoop2.test.
FossilOrigin-Name: 56f6d6c538fd4e0da8a7c4e4c4d1bd0b8cd83ffd126ae24daaf30fdf808e1a78
2025-10-06 17:52:52 +00:00
dan 75ef68e385 Avoid using randomblob() in walckptnoop.test, as it produces different results for different test permutations.
FossilOrigin-Name: 94ceb0f0cfef1da89ea2a7420f508024897d9b7c19ef9be9af88d3e6f48c297c
2025-10-06 17:20:26 +00:00
drh 35299c9076 Change the testrunner.tcl option from "--case" (singular) to "--cases".
Allow the argument to be a glob pattern, to pick up multiple cases.

FossilOrigin-Name: e205f87f5cf97b82781af690da1a3fbf3dc75f590783074e5a72c1d7e3bebbad
2025-10-06 16:57:49 +00:00
drh 87f53152ed Fix typo in the previous check-in that prevented the script from running.
FossilOrigin-Name: 797664700701effefbf4d87a791febae3bb68544bac23470351a11bcb3a87651
2025-10-06 16:56:12 +00:00
stephan 6f7c977ed9 Add info from the SQLITE_SCM_... macros to tool/version-info.c's --json output, prompted by [forum:0c513ae3fca7d55c|forum post 0c513ae3fc].
FossilOrigin-Name: 951882aa4e1684b7b0f7e10590de81eae1ddb8c5ac21588e3f9b9cd4cb9f0f51
2025-10-06 16:54:45 +00:00
drh ad7118fa68 Update testrunner.tcl so that the new option is --cases rather than singular
--case, and so that it is a glob pattern.

FossilOrigin-Name: 9488b4f00c9278de8c03f4a3cbd4f54e48e71c1eff45de4454f8bd49c080a930
2025-10-06 16:50:37 +00:00
drh 0ab87fc9a7 Fix typo in the "testprefix" for walckptnoop.test
FossilOrigin-Name: ff205f29934417e8150b5243245fb70389717b219e35bd8d60791a8485b69b33
2025-10-06 16:23:31 +00:00
drh 0611aeeed4 New testrunner.tcl option "--case DISPLAYLNAME" only runs the single case
(and its build dependencies) that exactly matches DISPLAYNAME.

FossilOrigin-Name: 8ea2e097b731514c284f255f12b08e15f63c7f49641a698e61ee7e47cc9d3c45
2025-10-06 15:53:52 +00:00
drh 566348f68b Fix testrunner.tcl so that --help output goes to stdout, not stderr.
FossilOrigin-Name: 441a759c225d4e710a693339402624e7ba52852c08aa64439ed4568c193ad529
2025-10-06 14:30:22 +00:00
drh d357d9d1cd Fix a subtle problem with short-circuit evaluation introduced by
[cea8bf79e18d55a8] and detected by the dbsqlfuzz fuzzer.  Test cases
in TH3.

FossilOrigin-Name: d71cd722c478288601c70df8cec8c242cc623d2147b30f4f68dad57c75b3ee4a
2025-10-06 11:50:35 +00:00
drh 833fb1ef59 Another small performance increase in the text format by using strchr() to
search for '%'.

FossilOrigin-Name: 59ad89ba07dd7b127f03f62a647f7328f08dbc0aa1b88b2b4529eb5b4c677775
2025-10-05 22:41:32 +00:00
stephan 34775b696b Fix a syntax error in the tcl script part of [199b6567bb41cd].
FossilOrigin-Name: a7ed85f27066b74263dbd3dfcefe5d378e524cc56cd3abac4032bc23f83b5d21
2025-10-05 19:56:57 +00:00
drh d310393158 Performance optimization in text formatter by using a hash table to look up
the operator character that follows %-subsitutions.

FossilOrigin-Name: 199b6567bb41cd41977e28b3e06e8c26c3300b3873f226a4699ec251a7bf8883
2025-10-05 19:30:05 +00:00
drh 275d08ad62 Minor clarifications to the JSONB format documentation.
FossilOrigin-Name: 0fc708b41fe99b315b32e4a6ac8d48d8250195f7de1ab1d9f6eaf50290781286
2025-10-03 18:17:13 +00:00
drh 1d574d3d71 Remove the memvfs.c extension, to prevent it from being misused.
See [forum:/forumpost/91811439aa|forum post 91811439aa] for the complaint
that prompted me to take down this demonstration code.  I have other things
to do rather than argue about posts such as the foregoing, so it is easier
to just take the code down.  If you need this code, you can downloading older
check-ins.  The beauty of DAG-based version control systems like Fossil
(and Git) is that nothing is ever lost; it is just stops appearing on
trunk.

FossilOrigin-Name: eb79110dcac80dde3bcca0929d67a8f8f6d2eea5695184b2b7c6788283f06902
2025-10-02 22:48:08 +00:00
drh e2ebc364cd Fix typo in the previous check-in. Remove surplus end-of-line whitespace
from the ext/misc/fossildelta.c extension.

FossilOrigin-Name: cc87551805dc1fcb05598339e526b304401b64a4eaaa2148a9d837b1423484ce
2025-10-02 19:35:58 +00:00
drh 0d9ec8b2ee Harden the debugging vtab "delta_parse()" which is part of the
ext/misc/fossildelta.c extension against malicious inputs.
[forum:/forumpost/be139437c3|forum post be139437c3].

FossilOrigin-Name: 4be6deee646f2c0f591ba81f902182ca9302050a7fb2729c7f64981307058b8b
2025-10-02 19:19:40 +00:00
drh 4defad2f29 In the ".open" command of the CLI if using the --new option with a URI
filename, then decode the URI to extract the actual filename prior to
trying to delete that file.

FossilOrigin-Name: 14ee3c1f03de274e5fa1efb471816a0001762623614253c24d58f41ea6af0628
2025-10-02 18:31:19 +00:00
dan 7d973ac52f Fix -DSQLITE_OS_OTHER=0 builds.
FossilOrigin-Name: 2971d7470110fcd43bdc8ad5d09d1f2f63f5a3bccda41810948a683e310ad908
2025-10-02 14:48:27 +00:00
drh b9c23fa541 Correction to [ae303dab2f534e2c] to use the right loop over the solver.
FossilOrigin-Name: 22b2700ac20bb8e5883d484bfd0aee7a0fbc99b92696d8ca850cd129e2ccbb43
2025-10-02 11:28:27 +00:00
dan cbc3cd47f0 Fix a buffer overrun in the zipfile extension that could occur while processing zip archives with extremely long file-names and comment fields.
FossilOrigin-Name: c284fda848038a61972fd1df5796f608a24ead109170aafe562a5d5787c46488
2025-10-02 11:16:22 +00:00
drh fa563eff1d Add the --ifexists option to the CLI and to the ".open" command of the CLI.
Also the undocumented and unsupported --exclusive option on the same.

FossilOrigin-Name: 9a1947814d235d270dec265bb85db37e75cc077289e444d3d00f8345016c683e
2025-10-01 20:41:02 +00:00
drh 65ee59bb26 Prevent embedded 0x00 characters in the output strings from confusing
the completion extension and causing it to read past the end of an array.
[forum:/forumpost/88a08b3201|Forum post 88a08b3201].

FossilOrigin-Name: 26f6d41f9d3ab656129af333d54a8645c6890314919bcae90351ba0c2240ceef
2025-10-01 19:01:19 +00:00
dan a9af4102f1 Fix a buffer overread in demo code in ext/misc/memvfs.c.
FossilOrigin-Name: 90f7318308ca8372cbd9f183d88ff6cb884446f6df0695294c9a9955c5109f72
2025-10-01 14:28:48 +00:00
drh 4af7048aeb Enable the CLI to be compiled with SQLITE_OMIT_AUTHORIZATION.
FossilOrigin-Name: afb2feb38043fef3c286030f9d1238c132f338e54233f2e4655323b388455c72
2025-09-30 19:11:00 +00:00
drh 0f76b0a4d6 Fix various compiler warnings.
FossilOrigin-Name: 24ee6c25b4745c8fd671d845b48b9ab98a787ccb348d560ad70f19d035e7990e
2025-09-30 17:37:18 +00:00
drh c8e6f627b8 Fix the new generate_series() to correctly deal with an explicit 0 as the step.
FossilOrigin-Name: b059413c440d1b831c9a462f7165a350001ba7a8cc77ca2a0a8f2bb73c830aba
2025-09-30 17:12:39 +00:00
dan d05bf5aedf Fix another potential buffer overread in the zipfile extension.
FossilOrigin-Name: 0819fe670f9ceec79f84eb09c234dc29f6581332f86a53d6a0547697404efff1
2025-09-30 11:17:40 +00:00
drh 5b15123fba Strengthen the fts5_locale() function against integer overflow attacks,
even when SQLite is compiled with oversize values for
SQLITE_MAX_LENGTH.

FossilOrigin-Name: f0dbd9d22f558dd002e2132381de3c82d55a670399b3e527b5962b025141676a
2025-09-30 10:11:44 +00:00
drh 974b8d7df0 Fix a problem with the merge at [cb604efdb40da95a].
FossilOrigin-Name: ee6102d4fe35b7b914aa2dc7c7dd37460910efedc9b2d192c2fb8cb0e6a1fd4e
2025-09-29 20:40:50 +00:00
drh 8f6b797a1b Change the name to SQLITE_DBSTATUS_TEMPBUF_SPILL.
FossilOrigin-Name: 4a60a9c63534f5d2f16af2c3c6581abe7ecf7adfdb39f17e557e73997ae03396
2025-09-29 19:57:43 +00:00
dan 3eccaa7915 Fix a buffer overread in the zipfile extension code.
FossilOrigin-Name: 70c2c99b6f12a3467c23b44adcaf2d7d780ba8317b72de2f6730b1d892cf0c85
2025-09-29 18:55:05 +00:00
drh c49ff175ef Merge the latest trunk enhancements into the dbstatus-spill branch
FossilOrigin-Name: cb604efdb40da95a759e2eeb9d73608859a94acde9d9782ca82757d3a1c15303
2025-09-29 18:48:00 +00:00
drh e6197c0d1d Improve whereSolver() so that it always finds a unique solution.
FossilOrigin-Name: ae303dab2f534e2c5132112b61fa5a097e7010fd8b652badee669fbe9df5cf53
2025-09-29 18:17:19 +00:00
drh 7e38287da4 Fix JSONB logic so that it correctly interprets large JSON5 hexadecimal
integer literals as positive numbers.

FossilOrigin-Name: 0ad5d77fc0a9d205cc061ee4923d885f6f28f77c1efef3cc10297036ce164e6d
2025-09-29 14:09:43 +00:00
drh 381df874f0 Large JSON5 hexadecimal integer literals are positive unless preceded by
a negative sign.

FossilOrigin-Name: 5a93d9dce2d134ca450955bb272baba43dfc76beb540b643bf4bd31f7eb9e0b9
2025-09-29 13:43:10 +00:00
drh b7f5885b3e Back out check-in [9abaa0ac2b304934] as the code removed there is necessary
after all.

FossilOrigin-Name: 27ae98629406bbaee2857f75c069b2ccd4757b247f0742e51b9e619e96b6dc45
2025-09-28 23:10:54 +00:00
drh 36ba76010c Revamp the implementation of generate_series to simplify and improve
long-term maintainability.

FossilOrigin-Name: 9041ca8543ff3d2a617ce4df696aa53269a7803716caaf55a8e61e59ee667040
2025-09-28 18:25:59 +00:00
stephan 436c8e5026 Remove the long-defunct wasmfs build of speedtest1 from index.html and re-enable the wasmfs scratchpad app (which still works). Fix the CFLAGS for the wasmfs build and the path to the wasm file for one of the JS.
FossilOrigin-Name: acaaf8cce9e780bf937436b4c987ed284aa0bba6f5ca9508d9dbad598af2991d
2025-09-28 18:03:29 +00:00
drh 1bf80f2dce Minor bug fixes. Many new test cases.
FossilOrigin-Name: 86dcc68d1816d970d8d5fb158696c3fe6c5ddcac2c255823110d656372503885
2025-09-28 17:24:42 +00:00
stephan 39bffbcd32 Use new c-pp features to simplify generation of the tester1 family of files.
FossilOrigin-Name: f7cab028c97b2c9ac9b561a4c33475aadd3f71cbd48ec4dd6e09c1bb19ec00cb
2025-09-28 12:47:09 +00:00
drh d3cd2a25b4 All legacy tests are passing. Want to add new test cases before merging.
FossilOrigin-Name: adb80761d2319e16b6db2b5e35fedc239fad0ed5d26d629a5ea659c90881f76a
2025-09-28 11:01:05 +00:00
drh 9ffb344ed9 The generate_series rewrite is working better now, but is still not
completely correct.

FossilOrigin-Name: 6c41d14707e6890ca6d0460c72178ccb710d7f41dead76f222f1382c5cbd5a9a
2025-09-28 10:36:23 +00:00
drh 5b047a8ec6 Refactor the generate_series extension. Compiles but does not yet work.
FossilOrigin-Name: 25e395a82f14513bf23c1e913fe24be77ad74fec1540f524e709f9cdfeb3dc56
2025-09-28 09:25:07 +00:00
drh c2f7be11bb Fix harmless typo in a comment.
FossilOrigin-Name: 1f6deabfff2fc2fed5fbff48d2637b48245e5a946a442c4bcc9b9ecb7c4848b9
2025-09-28 08:59:16 +00:00
stephan 1d592e0d62 Internal js/wasm tooling doc updates.
FossilOrigin-Name: 0d6ed44278a513b062539f32da49fa43952fcdf0bc1bba7b24ef3749bc4525a5
2025-09-28 02:30:25 +00:00
stephan 0b0c8734f3 Improve #if support in, and add #assert to, c-pp. Rename target=... preprocessor symbols to target:... because changes in the semantics for symbols which have an '=' makes some of those #if blocks mutually exclusive (which we won't want in rare cases involving the bundler-friendly builds).
FossilOrigin-Name: 54287487793d48f6dde919446ab7476aea0cc0aba3835c80f060a7b84221881a
2025-09-28 00:53:00 +00:00
drh 54f296389c Rework the bounds calculations on generate_series() in an attempt to
avoid signed integer overflow when the bounds are ridiculous values.

FossilOrigin-Name: 3d9148c7d7379a34a0c2a33a1eb2562234868bc0b14c3d16990b33e52fd4ebc5
2025-09-27 15:03:11 +00:00
stephan 41549103ac ext/wasm/c-pp.c: add #savepoint support. Consolidate how the diverse sqlite3_stmt handles are managed.
FossilOrigin-Name: b44650f907e9cb4ec908bb7525488e309946fac9d84cdac4cdde730527a440a9
2025-09-27 13:34:02 +00:00
drh c090488133 Use sqlite3_malloc64() and sqlite3_realloc64() everywhere in the CLI.
FossilOrigin-Name: b05c47009120840f74955114082f3a9c1206a81bd935a503fc359b5bde61c996
2025-09-27 13:00:37 +00:00
drh 943324c80d Fix a bug in the ".dbtotxt" command of the CLI that causes a NULL pointer
dereference if run on an in-memory database.

FossilOrigin-Name: 865352499223c3bdc5cb01a2f984d6e3fe74a028ab6a0cf2d92fec49383633f6
2025-09-27 12:35:25 +00:00
drh 18af487597 Avoid integer overflow in memory allocation for the
".import --csv" command in the CLI.

FossilOrigin-Name: a8093d45e0f59fd55ea4cba515e9e2eb3683bb0a4f4c062747cfb4074ae3db73
2025-09-27 12:29:28 +00:00
drh 15e4074084 Additional cleanup and refinement of the regexp.c extension.
FossilOrigin-Name: 2b34b750b5528b6dda195bc1a3895dc3fe46e70cbf992a78111316e2726c1ade
2025-09-27 11:54:49 +00:00
stephan 4ac2118c5d Teach c-pp how to replace configure-script-like @tokens@, giving us a much simpler way to get the proper WASM file name injected into each JS build.
FossilOrigin-Name: ffd5c8eaa89250a043b573c3eb66693dfec087a5b5eef184ae6d7bfbcf61235a
2025-09-27 11:38:35 +00:00
stephan 4bdfae9d40 Remove and edit some comments.
FossilOrigin-Name: 1fa7e32d264f8329a8c9b0b5b469f1fc7ccadee86696d65e05df7fa3868af158
2025-09-27 00:07:25 +00:00
stephan 5d0d30ae2d Add wasm.ptr to the module-symbols.html output.
FossilOrigin-Name: dced5a7c434b83553ede533f71e3133450795c12fc67acd1a55fdedfa8fed76c
2025-09-27 00:05:13 +00:00
stephan 836e895f9e Latest upstream c-pp.c for the ability to process multiple inputs and outputs in a single invocation.
FossilOrigin-Name: c7633373046ceb94f293b8fbd4f436a1eb281c2744d97334c6e7e3a803d8eac2
2025-09-27 00:04:28 +00:00
stephan 879066a0a2 Delay replacing the wasm file name strings until they're needed. Add target b-all to run all known wasm builds.
FossilOrigin-Name: a4edaecc9b0b649df53a99e05d9abfbc5bdb40d45c7c6940a50b24fa30dca158
2025-09-26 19:41:07 +00:00
stephan e309de27f9 Consolidate some duplicate code in mkwasmbuilds.c.
FossilOrigin-Name: 1078aa4f1e5685d45e31eea622865ddd077f367f1cec90fc267e8ba50cbe2ee9
2025-09-26 19:30:34 +00:00
stephan a34f87d25a Clean up how the speedtest1 64-bit test/demo files are generated. Make log output very slightly less verbose.
FossilOrigin-Name: 64715e92708e4f8c5b82c1f4ed71b75f418bf741f7f05516eab309582fbfad2b
2025-09-26 19:19:35 +00:00
stephan 42f9273da2 Get 64-bit builds of speedtest1.wasm running in order to better compare 32-/64-bit performance (spoiler alert: the latter is consistently roughly 10% slower). Add WASM heap usage info to speedtest1.
FossilOrigin-Name: 70b944cc0189309c2265b184381f2f050bced7b83f204d57b912def6e203982a
2025-09-26 18:29:00 +00:00
stephan 96c753ec56 Reinstate the Module.instantiateWasm() override and simplify how the wasm filename gets injected into the JS files.
FossilOrigin-Name: e878ffd2eaa87e2978c44fcd03a1eb6114a9ae31e31101898d682f43cf81000f
2025-09-26 17:11:39 +00:00
drh b62c26d999 Limit the complexity of a REGEXP pattern using SQLITE_LIMIT_LIKE_PATTERN_LENGTH
FossilOrigin-Name: 869c968569b09d05a5b7d587d8fddb3b4611daf7467dc157701e5dc6c9608606
2025-09-26 15:38:52 +00:00
drh 80d74f0934 In the regexp extension, limit the maximum value of integers in the
"{p,q}" syntax, as performance of the NFA used to do pattern matching
is linear in the maximum such integer.  The limit is SQLITE_MAX_REGEXP_REPEAT
which defaults to 999.  This helps to prevent DoS attacks in systems that
make use of the regexp extension.

FossilOrigin-Name: 911c745f88c0ee8569e67bbcbbab034264f8c981b505aadac3ce7289486a1a68
2025-09-26 13:14:20 +00:00
stephan 3a94a00768 Get wasmfs build working in the new setup. Disable the custom wasm loader because its generated makefile code is currently broken.
FossilOrigin-Name: 36bc2514f70af5608aa20903d9c38b316603e2f78f2cbf4a20c7c79b60c5b8d5
2025-09-26 12:49:41 +00:00
drh 8d2f3a1f82 Fix harmless integer overflows caused by over-sized integer constants in
the "{m,n}" syntax of the regexp extension.

FossilOrigin-Name: 8f17e1d869685b51f3368feed03dc06543ec16bc8fd81b8daad2ac2dbf99c5d6
2025-09-26 11:53:54 +00:00
stephan c839ea5d94 Docs and dead code removal in mkwasmbuilds.c.
FossilOrigin-Name: d022ee167b90a7c32049a93d476e869270018017f60551185024409730d77640
2025-09-26 11:47:13 +00:00
dan 6553a5d6a6 Fix some integer overflow problems when handling corrupt hexdb dumps in the shell tool. [forum:/forumpost/82b513b116 | Forum post 82b513b116].
FossilOrigin-Name: 730323f95d126162fd2867dbee1e1f1fc1d6e05b8a905a6767c4ab1cb43dacff
2025-09-26 11:45:13 +00:00
drh c9f1759c94 Add new table-valued functions jsonb_each() and jsonb_tree() that work just
like json_each() and json_tree() except that the "value" column is JSONB
instead of JSON text when the "type" is 'object' or 'array'.

FossilOrigin-Name: dfc41cb3aad7fedd834baaaba0d8e3aeb55a249af4f0934397652ea9c59dc9fc
2025-09-26 11:36:10 +00:00
drh a7a8d7fa87 Fix a harmless compiler warning.
FossilOrigin-Name: c50a3c45a20e5b9d48e749818bea06dfa99b729535e0617347c6ece1d277a447
2025-09-26 11:28:01 +00:00
stephan e040128ecd In c-pp.c, use (void)x instead of an empty if(x){} to flag unused arguments.
FossilOrigin-Name: df9ab8a35517e3a2baf4b19d07d46ce3f8b48043ccdeadef22bffc12e80461c3
2025-09-26 11:14:15 +00:00
drh 92f93556e5 On-demand loading of JSON virtual tables.
FossilOrigin-Name: 118f97ddcd8f888715825a623c02d42b92a82737a316f7bee4cd66f570945346
2025-09-26 10:29:07 +00:00
stephan 5ace5e0a38 More build docs. Add a speedtest1 64-bit build but it's not hooked up to any test apps yet. Improve invalid-arg detection in c-pp.
FossilOrigin-Name: 69086be8a155d70d9dd7b655b66809250b24fe6d5bcdc6cb5e0275446a43f51d
2025-09-26 02:18:28 +00:00
stephan c1254430d8 Build cleanups and dead code removal.
FossilOrigin-Name: b516109e5accc885b71900402c800ae855407552648861334c895f0e5dea4ee5
2025-09-26 01:38:07 +00:00
drh 3574ec40a6 Add JSON table-valued functions jsonb_each() and jsonb_tree().
FossilOrigin-Name: 2f8b461c636ce2c0e7970c00d1e6ea62cdef72273150fea6aabe4e9292724977
2025-09-25 23:32:23 +00:00
dan 51e3a140c9 Include writes to temp files by sort operations in the SQLITE_DBSTATUS_SPILL values.
FossilOrigin-Name: 4c1118ba40172af61d9304dec7a9c7344566e6a5963a317880ad232bebb40176
2025-09-25 19:32:29 +00:00
stephan ae48a2463b wasm dist: add --snapshot flag, add -64 flag to include 64-bit builds, and add module-symbols.html to the dist.
FossilOrigin-Name: e9a6391b377b6964620285192262a4dc9fe1712799f7aa8a8b37c5f718544ed2
2025-09-25 18:53:28 +00:00
stephan 3e7fe489e2 Replace ext/wasm/dist.make with mkdist.sh and get dist working with the new build. Fix the preprocessing flags for tester1-esm.html.
FossilOrigin-Name: ab6eb4d3b723107da488770b1849b9f1d1c491348f1eaa544e0e07356b8fac7d
2025-09-25 17:29:12 +00:00
stephan a4476ea1fa Overhaul the wasm build to (A) support more coexisting variants, e.g. 32/64-bit of both vanilla and esm, and (B) build each variant to its own subdir so that they can build in parallel. It can, with make -j4, now build all new variants in half the time it previously took for just the 32-bit builds. The new build logging output, though unconventional, serves two purposes: (A) improve my build-time situational awareness and (B) it help demystify some of the build steps and output files.
FossilOrigin-Name: 2f4be98614b49def2c2951887796c736269ef3bb7ba5b045cae5f748ae165a83
2025-09-25 15:17:58 +00:00
drh 5ad6e7b0e0 Fix the translation of "\v" in JSON5.
[forum:/forumpost/28e21085f9c6a4e7|Forum post 28e21085f9].

FossilOrigin-Name: 2914e8fc7b10e8b42c9a0fbd0e71f495714cee3cae67b8c238d37b1e7ec22359
2025-09-25 15:06:57 +00:00
stephan 5dbbbf4923 Remove some superfluous tabs and add the mkwasmbuilds ability to emit just its prologue.
FossilOrigin-Name: 75079401753778e3bc2f7fa307de9217e8d1ec395079fc1009060f707be32943
2025-09-25 14:44:03 +00:00
stephan 96d39ce7d2 Minor logging fix for the wasm-opt build step.
FossilOrigin-Name: 918eca02d162cfa98613f9d8d9b0901f9f94ae1bcb53d811b09baec6c3f06bbe
2025-09-25 14:39:41 +00:00
stephan 653e32e9a1 Move fiddle.make into the main makefile. Various adjacent cleanups and docs.
FossilOrigin-Name: fabd6160d0c128592ce512b1160dfa0b89b1fbb03e11cd185c6a4888a85cc7fb
2025-09-25 14:29:47 +00:00
dan 31efe5a0f2 Avoid an integer overflow in the shell tool when outputing hex dumps of blobs greater than 1GB in size.
FossilOrigin-Name: 4a1bb874f12adda26e91970b64e700cb904c126412989be4debac9a5647d6f69
2025-09-25 11:10:55 +00:00
drh dc868ef879 Convert the ShellText object in the CLI to use sqlite3_malloc64() rather than
plain malloc().  Avoid unnecessary quoting of table names in .dump output
and similar.  Improved detection of OOM in set_table_name().

FossilOrigin-Name: 6ce4f6dc15a575c318669051fe6590ad114b52ff3f3e260cdf7accccdd922d63
2025-09-25 10:55:54 +00:00
dan 4d488bd341 Avoid an integer overflow ([forum:/forumpost/b3abe06121 | forum post b3abe06121]) and a compiler warning ([forum:/forumpost/3db6aa9ed6 | forum post 3db6aa9ed6]) in the shell tool code.
FossilOrigin-Name: 39925489b347ec3126389c6dba1ee719373e50c6cea6944384a212c3a3e163d2
2025-09-25 10:50:11 +00:00
stephan 3ed76ca35b Minor build cleanups.
FossilOrigin-Name: 05e7ea021388fcac975779cd2a70e341e25670e70d1d9f372f15b823b2466750
2025-09-25 02:30:55 +00:00
stephan 99cb0049ee Consolidate the speedtest1 wasm build into the new mkwasmbuilds.c model. Remove the long-unused batch-runner JS tools.
FossilOrigin-Name: 980c033c05bf37c0e8f5e82486ee99ba1294cc9c9e2087aaf83b64e5d0118b5f
2025-09-25 02:02:48 +00:00
stephan ef565295f5 Wasm build deps fixes.
FossilOrigin-Name: fd0c649047f4e444ea682138a3555a973839627150e1124bb9d9ced17880a9e5
2025-09-25 00:53:30 +00:00
stephan 9daf58ee8d Move the static makefile code from mkwamsbuilds.c into the makefile. Move util.make back into the main makefile. Remove a bunch of dead makefile code and docs.
FossilOrigin-Name: 18beeb26bfa48f806866e0e330024535adabcf668071abc4b6251eb39de2701d
2025-09-24 23:07:45 +00:00
stephan 3675a69f1d Cosmetic makefile tweaks.
FossilOrigin-Name: 4ec7e6800e090f7e17469a77bc37b57d3e1777171a5b354dfc68345416de504f
2025-09-24 20:53:19 +00:00
drh 9444c29094 Fix the makefile so that "<tt>test/testrunner.tcl release --buildonly</tt>"
works on mac.  Apparently broken by [b7751d144330593b].

FossilOrigin-Name: 023365228f3264c53263b649365e7c133d8633010baf6e050fdee044a40454dd
2025-09-24 20:44:33 +00:00
stephan 6d3ae03f1e Get the tester1 worker1/promiser demos building again. Show WASM heap usage in tester1 if.
FossilOrigin-Name: 6691a84872f823c95b0bdc3db8e12d21c9561aa1e1ce1d787a977f2c5ef8225a
2025-09-24 20:39:08 +00:00
drh b8a62d9da7 Add an assert() to fix a harmless compiler warning in the session extension.
FossilOrigin-Name: d77b8ad96c695594668cd7019c7f607fe5efa5474dde0ece8b621051cf88a0b5
2025-09-24 20:09:48 +00:00
drh 1ecc36a2b0 Fix a harmless compiler warning in FTS5.
FossilOrigin-Name: 89f8d02075a7b265b1f0226a0f878903e1dce27ff1ac2e8a2d62d450b9b4ec76
2025-09-24 19:51:07 +00:00
drh 2c88a2ffb5 Rework the set_table_name() function in the CLI to use modern APIs.
[forum:/forumpost/2baa4acd64|Forum post 2baa4acd64].

FossilOrigin-Name: 821cc0e421bc14a68ebaee507e38a900e0c84ff6ba7ee95bf796cad387755232
2025-09-24 19:10:58 +00:00
drh 96bb92e70c Special case the "decimal(-0.0)" output to show exactly 0.0, just as it
does for positive zero. 
[forum:/forumpost/adc719d88d56ab22|Forum post adc719d88].

FossilOrigin-Name: 9ca4163bd93d78be5e4daf2b5d2b920d54d038c6fa8217dd2add0be0da6cd6b0
2025-09-24 17:49:09 +00:00
stephan 892109542b Generate 64-bit variants of tester1.js/html. Enhance c-pp to accept multiple input files.
FossilOrigin-Name: ef6c55e4499957fb46b213540786e5d3928ec096eae1fe759066ed011518e7a2
2025-09-24 17:46:08 +00:00
drh 68353d0531 Fix a harmless compiler warning in IEEE754.
FossilOrigin-Name: 7f72308322cd1f238e6c725ec6bff44ed42fb2619f3f52afe38e2faad838a63f
2025-09-24 17:38:13 +00:00
drh 2abc502ebc Additional short-circuit optimizations for AND/OR operators. Also fix
bugs in prior implementations (such as [0083d5169a46104a]).

FossilOrigin-Name: 63b686fe4cb1d5d82dd3a399aaafd1dfcbda533ca83b46ed2bc2750baa7f251d
2025-09-24 17:07:15 +00:00
drh dc90d7055c Simplification to the AND/OR short-circuit logic.
FossilOrigin-Name: 7be555a3b8500c43c2f30171af26bcda9bcb68f41992b792228218a56315e7c4
2025-09-24 16:26:44 +00:00
dan 2364fe3b38 Improve performance of window function queries that use "BETWEEN :x FOLLOWING AND :y FOLLOWING" where :y is a very large number.
FossilOrigin-Name: 1f0b7143575634929c0f77bafa888f0be2dd83f0c6c3deadd8299ac4ab8a8c01
2025-09-24 16:10:46 +00:00
drh 1f030eac9f Fixes to short-circuit AND/OR evaluation.
FossilOrigin-Name: bc4cadbd60b97d000d2e8be843acab9d82ddf10a8125fd9cc0ae101bb9850091
2025-09-24 14:43:42 +00:00
stephan 36baed3e2e Add docs to mkwasmbuilds.c explaining the purpose of each of the builds. Remove some inadvertent copy/paste hard tabs in some C-side makefile code.
FossilOrigin-Name: a2bd965e103026ff5c722357ed9e3432172bbc19d267e718ebd4a876eca41742
2025-09-24 13:59:53 +00:00
drh ca574fa1d5 Factor out the code that handles AND and OR short-circuiting into a
separate subroutine, for performance and legibility.

FossilOrigin-Name: cab84a65c3825c59f3a7a750f4983563ce7ad007125cbcf35c187326289fea89
2025-09-24 13:10:55 +00:00
drh feeacfb897 Fix incorrect buffer size computation for the base64() extension function.
[forum:/forumpost/b1993c858f|Forum post b1993c858f].

FossilOrigin-Name: 603efcd404f0013559ca5bd936fc39481a3aa33a10340bac27b751b6b286d0b7
2025-09-24 12:01:50 +00:00
drh b927708437 Restrict the size of the LIMIT on a generate_series() query to avoid
an integer overflow when computing the final output value.
[forum:/forumpost/479bfb0d3b|Forum post 479bfb0d3b].

FossilOrigin-Name: 266aacb4759945f7cf7a258014620f21225261246edc08e6e71ff5292baf22f3
2025-09-24 11:12:26 +00:00
stephan 8d93e83461 Cosmetic build tweaks.
FossilOrigin-Name: 431725330d6c63575dbf3404664a7af33d4d87c569560e99c18de93eb4d73935
2025-09-24 07:31:19 +00:00
stephan 205257791c Fix the positioning of the wasm-bare-bones flag init.
FossilOrigin-Name: f5167fb3615efc180e69333f99d82d6afc1d190e7f37b6a701895de00502d8c8
2025-09-24 07:00:37 +00:00
stephan 4500a87c95 In speedtest1, always use fatal_error() to exit fatally, instead of an fprintf/exit() pair, so that stdout/stderr get flushed consistently (which is significant for the WASM build).
FossilOrigin-Name: 1bd15cb343f6ce57f108291a8ed0f3ee2046932591d44edec133fe3ea43a2ef0
2025-09-24 06:59:47 +00:00
stephan 5c01f3fb83 Further wasm build refactoring. Get speedtest1 building again.
FossilOrigin-Name: 5434307dcd927686ce827da22de55020c4b431f888ac81ae3634d458ad0b563d
2025-09-24 06:43:24 +00:00
stephan e779baa099 Move some of the generated wasm makefile utility code out of C and into util.make.
FossilOrigin-Name: a2935758f534b51cac3d2e5ece74b369c806e3a994781744708e1590b9c32542
2025-09-24 04:58:14 +00:00
stephan 3b56f296e9 Generic build simplifications.
FossilOrigin-Name: 61648610c3e454fce77b78e6f6be1b71e27bb9587af03ae5c0e083eac7158a64
2025-09-24 03:05:31 +00:00
stephan 0dee14a559 Get fiddle building properly again and fiddle/fiddle.debug building in parallel.
FossilOrigin-Name: 85fe9c6155f72583cea46d38bf5e040623d71fb5317ff9373421dbfdb179b2b0
2025-09-24 01:50:08 +00:00
drh 9300c4a13c Improved short-circuit evaluation of AND and OR. All appears to work, but
there are still testing and performance issues to be worked out.

FossilOrigin-Name: 0d4447aa61848deecf9170afce031f7b353b91d58474f3f094ce34e46be7f99e
2025-09-24 00:13:28 +00:00
stephan ac37661a16 Get fiddle/fiddle.debug building again but they're incomplete and don't run.
FossilOrigin-Name: d725a075bc3303c5a26c4014f57162235cebc6491425083b4d80936de8f07fb0
2025-09-23 23:22:31 +00:00
drh cac1ef709f Improvements to short-circuit evaluation of AND and OR operators.
This is a partial and incomplete response to
[forum:/forumpost/f5adeb59ff77c056|forum post f5adeb59ff77c056].

FossilOrigin-Name: cea8bf79e18d55a8658e48a967cd0b7970b6f88badb769cfbb1f66ab24fb9ec8
2025-09-23 17:00:53 +00:00
drh 611ffbc981 In the ieee754 extension, render -0.0 as 'ieee754(-1,-3071)' instead of
'ieee754(1,-3071)' as that makes the sign clearer.  Both strings still
convert back to -0.0.  Note that negative zero
and positive zero are distinct values in ieee754.
[forum:/forumpost/1eab7e4a08|Forum post 1eab7e4a08].

FossilOrigin-Name: 136188c161a8a2d5166798fcbd341bd1d3f81da7291011f806d6b2153544832c
2025-09-23 16:01:45 +00:00
stephan cfce9b6a11 Get most of the wasm build (re)working and much prettier.
FossilOrigin-Name: a5a7890c75003a637a227b700dc342f4f4a24bd368b216bdb168b4ddfbe8f015
2025-09-23 13:49:44 +00:00
stephan a07871d332 Cosmetic wasm build tweaks. Fixed wasm-opt use, broken by this branch's refactoring.
FossilOrigin-Name: 4d7eff2afbcf023291bc1133c4413d1ea44f4096bb515e4bcd40bc8fc8d2a591
2025-09-23 10:46:17 +00:00
stephan 5c0850f8b8 Make it easier to pick out which parallel build messages belong to which wasm build.
FossilOrigin-Name: 913af3dd6a8da577ef19b0d82c8afec0c626d7fa5fddbdf418d2eb16c3050ab1
2025-09-23 08:44:07 +00:00
stephan ebb99967c2 More build restructuring.
FossilOrigin-Name: 7bee8ee76380b2c1beb320b55042f149c22f872c70b58461652fa5bcbf6ad3c7
2025-09-23 08:23:23 +00:00
stephan aa5b8f9d47 Create each distinct wasm build into its own dir, instead of all going to in jswasm/sqlite3.wasm, so that the build can now run in parallel.
FossilOrigin-Name: 47526a75f2ad85100b1eae7ab1cf9a9dddd4430a99f7a30aa0c16548d1db9d33
2025-09-23 06:31:24 +00:00
stephan 91b1b0de2b Start reworking the wasm build (again) with an eye towards simplifying it. Currently only the canonical and esm builds work, not fiddle, speedtest, nor the bundler stuff.
FossilOrigin-Name: 102c4a35b86405273d1f7e9e34466c9deed7831099a8207b6f48746b998193f9
2025-09-23 05:10:19 +00:00
stephan 12f17d41f9 Add makefile target '64bit' to ext/wasm/GNUmakefile to build the 64-bit bundles. It does not yet generate copies of the test apps to load/test them, pending other reworking of the build.
FossilOrigin-Name: 3e2ea990ad76f9e68d514568f53eaa692a1eb11695fceb1bcc58cea00605fff9
2025-09-23 02:04:07 +00:00
stephan a8bddde325 Slight correction to the diagram in the previous checkin.
FossilOrigin-Name: 6455af2703e78fb9b6df19cf4b46873d98ec91c3302dc0093a362d03ac48da91
2025-09-23 00:24:58 +00:00
stephan b19c14742d Add a high-level diagram showing how sqlite3.js gets assembled.
FossilOrigin-Name: e0dfa1e62ba6d71abe1f48969eb6f53c83f2c28d47b996ee223587d923cc282f
2025-09-22 23:48:05 +00:00
stephan e55a29f5fd Refactor and simplify the JS API bootstrap steps.
FossilOrigin-Name: a4f36fd93738f985d2c757c69eddca092732ce6148af98eb2595f9abe0d4fa44
2025-09-22 21:04:24 +00:00
stephan cfa48c17f7 Update ext/wasm/api/README.md for recent changes.
FossilOrigin-Name: 03b70686939e5f9ad984220a31674c23a1beb19f040c6327f24e23f0378555da
2025-09-22 18:05:10 +00:00
stephan 1ab3d7eafd Cleanups and docs in the internal parts of the JS lib bootstrapping. More tinkering with the custom (but still disabled) wasm file loader.
FossilOrigin-Name: 35651d9ab5529da915500fc50ca3833a004d0b7a19d98e8fbf39234d94697aec
2025-09-22 17:29:52 +00:00
drh 6ba22a75f3 Revise [a4430d262b3e129d] to preserve legacy behavior of the imposter
test-control.  The control argument must be 2 now to get read-only behavior.
The control argument of 1 goes back to the prior read/write behavior.

FossilOrigin-Name: 3e7ede2e6dc9ac8e746dafe0ecb5379044631e753e951f9ab97ec84addbd830a
2025-09-22 17:28:08 +00:00
stephan 2ea861a245 In wasm.ptr.coerce(), treat the undefined value the same as 0 for Number-type pointers for consistency with the BigInt coercion. The bindings have long treated both null and undefined as === 0 for pointer operations.
FossilOrigin-Name: ef73bb1ddae28c6a0b462a2a840bfaaec3fc70d843e9ab6c53097281ffc85a78
2025-09-22 13:13:02 +00:00
stephan 34d92f4ac6 Minor doc updates. No functional changes.
FossilOrigin-Name: 9c67299b452a2b19b5f4285feb975b30864a9415ccf62b7c7ebb1587a6545b33
2025-09-22 11:52:06 +00:00
stephan 8eefa2725b Rework the JS/WASM pieces for compatibility with both 32-bit and 64-bit WASM environments. This affects only the browser-side components, not the --with-wasi-sdk build nor the core library.
FossilOrigin-Name: 8ac367686fecd2e3ff1f4b4565e9f206a64237744e381704693df2e6efbe235a
2025-09-22 11:41:15 +00:00
dan 65551b5456 Fix a problem with handling of 4-byte utf-8 characters in the shell tool (not the sqlite library). Forum post [forum:/forumpost/184b372388 | 184b372388].
FossilOrigin-Name: f3e845cf38fc364bfa3f8d433b668f884d11286c823d87ee0ed124a991c94e14
2025-09-22 10:48:10 +00:00
stephan 5a2e3c4af2 Experimenting with a custom wasm loader, but don't enable it without an explicit build flag. The goal here is to make the WebAssembly.Module object available internally (the default loader hides it from us).
FossilOrigin-Name: e5f0256feab95c30a8e3e1e69963fb3e25ed2da296aff5bc6646fe96a76c0b81
2025-09-22 02:40:06 +00:00
stephan 1d49644650 Minor internal optimizations in the wasm glue.
FossilOrigin-Name: fb053a27d94f9caedfddf28680e13836343745376e84c8008641df6bb517cd8b
2025-09-21 23:15:12 +00:00
stephan 1e01174ac3 A minor optimization in wasm.realloc().
FossilOrigin-Name: 6a070f450ac9ee3d4d6a3e05ef8fa2071a684181ea160805e236c3bba226510a
2025-09-21 22:17:13 +00:00
stephan 60633a852d Remove some stale makefile comments. Add a little widget to fiddle's toolbar which shows whether it's running in 32- or 64-bit mode. Reduce fiddle's starting memory to 8MB.
FossilOrigin-Name: e99730f96e13f7497a871fdcc5eaa4187835f005a759f0fc79bbfe982f454437
2025-09-21 22:08:05 +00:00
stephan 589855f40e Improve db-close-time cleanup in the face of WASM environments which wrap wasm.exports in nullary wrappers.
FossilOrigin-Name: fbb63634eab83fda0090fe2c38bda735b497fd6e57dd36344559962e396dbb17
2025-09-21 21:37:44 +00:00
stephan e6db55f0e2 Fix a Number/BigInt descrepancy in oo1.DB() when passed a WASM-string db filename. Consolidate some duplicated internal code and adjacent minor cleanups.
FossilOrigin-Name: d078aff7817ccd4f891024e55703519307a53815d472086bf3d42b2be28698b3
2025-09-21 21:17:41 +00:00
stephan 50815f8ba4 Fix a StructType.dispose()/ondispose() memleak in Jaccwabyt bindings in 64-bit builds and update its docs for 64-bit additions. Remove the parts of tester1.js related to skipping specific tests in 64-bit builds.
FossilOrigin-Name: 6baea1d719b0c345fee5f32a3917ce9c507a2d8cb029eaca675daca77f297eba
2025-09-21 20:26:47 +00:00
stephan b10548a7b0 General cleanups and dead code removal.
FossilOrigin-Name: 0336fa95e15c53ac6ab8152a840163a5aac64725874ffb848ce1d95e3af90586
2025-09-21 19:39:06 +00:00
stephan cf0f11ac18 Remove some dead code and stray debug output. Fix (again) the JS SQLTester for 64-bit (the previous build was set to 32-bit).
FossilOrigin-Name: a6b9567001dad0293dc6a7fe9a7ec1a220e41d9426448e2ab91dbd551948be15
2025-09-21 19:01:15 +00:00
stephan 334b15d8fc Update the JS SQLTester for recent sqlite3.wasm changes.
FossilOrigin-Name: 0fa1830540bcb86f5c59b1a6a9ffd8727c194a64a131d9d362023c84a3b820cb
2025-09-21 18:42:25 +00:00
stephan 5b71447e8e Generic cleanups and simplifications in JS code.
FossilOrigin-Name: 074cf4e6c1775900204bb0d920111ee19601d5c63690e79e988e7fe6b040a647
2025-09-21 17:55:23 +00:00
stephan 128ae8ea3f Rename wasm config entry pointerSizeof to pointerSize for consistency with wasm.ptr.size.
FossilOrigin-Name: 2cd8ba740f9b14dc1408b62632c603076b070dc412bf7cbfb3b525f0c4912371
2025-09-21 14:25:29 +00:00
stephan 1e2156e926 Restructure the interface for the sqlite3.wasm pointer-size-dependent details.
FossilOrigin-Name: 8ac12e1f5144380d4ecc8b27a1f62dcda0e5a86409ae7149f62c33caeea19a23
2025-09-21 13:53:59 +00:00
stephan d97c59e2bc Reduce sqlite3.js build size by about 30kb by stripping out Emscripten's makeInvalidEarlyAccess() wrappers.
FossilOrigin-Name: a65bd978cbc646ec687ebcfc736a968e0597062251b2155caab42bca2d36f1e9
2025-09-21 11:49:23 +00:00
stephan 72d81265ab Reduce sqlite3.js build size by about 30kb by stripping out Emscripten's makeInvalidEarlyAccess() wrappers.
FossilOrigin-Name: 9fafe075d6f4c49fca45963b142f3e0f0e60d79cb462b7e24f9ed0b9a9677f28
2025-09-21 11:47:06 +00:00
stephan 23203a407e Remove some dead code.
FossilOrigin-Name: 1c2cd58d1a86d85e79ac912270e762e22f43f1d41d81a19ecd0ae6b2656c71b4
2025-09-21 11:39:53 +00:00
stephan ba6527af04 Minor cleanup in sqlite3.wasm.ptrAdd().
FossilOrigin-Name: f659595d2e9e019a77d0c86803dbeb4bd728221a665825896ec29f7c0c0bdc65
2025-09-21 11:15:00 +00:00
stephan f568a2f1bf Remove some fiddle debug output.
FossilOrigin-Name: c7cc374ff5ccd8b8f0a6cd0acada2a713626b5447cf014db12e18327fccfd36b
2025-09-21 01:03:16 +00:00
stephan 51127416a4 Resolve the non-functional 64-bit JS vtabs and VFSes. All wasm tests now pass on a 64-bit build. Investigation of the fiddle failure on a second db import is still pending.
FossilOrigin-Name: 7c44b48b628d3d93b13031e9fd08ed39fec35c661aca9e813a89348d6c415663
2025-09-21 00:59:23 +00:00
stephan d1b64404b3 Determine the WASM environment's pointer size at runtime instead of baking it in at build-time via the preprocessor.
FossilOrigin-Name: 21ac6aaa03517841b637924720354b9800d6e8b7bd5f6ee54a99f5f45b2ccdec
2025-09-20 23:21:24 +00:00
stephan 2674a4fdcb Add missing sqlite3_vtab::xIntegrity wasm mapping. Correct signatures for the (unused) xDlOpen and xDlError bindings. Disable OPFS-related tests in tester1.js in 64-bit builds.
FossilOrigin-Name: dccfa7098975d8c09eb6e7d30cd2ae30bc8234ef9a24f4a2ad5e9ffd29df72c2
2025-09-20 22:11:19 +00:00
stephan 3e205eff8e Add missing sqlite3_vtab::xIntegrity wasm mapping. Correct signatures for the (unused) xDlOpen and xDlError bindings. Disable OPFS-related tests in tester1.js in 64-bit builds.
FossilOrigin-Name: a106be90a2dba7476e54dbb4bdf47d0999031dae0ca82d73e51a48dadd6bcdc0
2025-09-20 22:10:59 +00:00
stephan 25e416dc3a Reinstate the working-again commit/rollback/update hook tests. The bug breaking those was the one-letter change at the top of this diff.
FossilOrigin-Name: c582513a77cd1d1d9479e5a4518ddf15ef5a213bed1bfb6af9bd21bf3be41f8a
2025-09-20 21:03:28 +00:00
stephan 7462b3749a Further tweaks towards 64-bit wasm. Fiddle is failing intermittently from the C level when importing a db and it's not yet clear what's happening there.
FossilOrigin-Name: 9fd82ebe31993c11e61a47205b7fc17a28283ec96cf278df1b6ea8a196d1fcb1
2025-09-20 20:23:59 +00:00
stephan 043136276a Get speedtest1's wasm build working.
FossilOrigin-Name: 2a61e3f1ccb1c2f115377d33af7d84d158b06c462e482fbbddf35c56d1fb58d8
2025-09-20 20:19:18 +00:00
stephan 93cd069fdf Improve deps handling of fiddle's gzipped output files to help avoid stale gz files during development (althttpd will prefer those over the uncompressed ones). Only compress the larger files, not the small html/js pieces.
FossilOrigin-Name: bb945f52909caa2577de38711883a79ca918b3716e5e0c2fed6e6ef12e19aeef
2025-09-20 20:17:17 +00:00
stephan 832dfd97d1 Get all but 3 of the tester1.js test groups running in 64-bit builds. The outliers are virtual tables and commit/rollback/update hooks.
FossilOrigin-Name: c135d9743698b3331e56f72160e2b78840aa2c8fa1a70daea9d4a0952dbda186
2025-09-20 18:51:10 +00:00
stephan a8756afdbc Get several hundred more lines of tester1.js running in 64-bit mode.
FossilOrigin-Name: f5105ee5defa042508a68a1f4e23b9fff46a1697b1a727e01c3edea3030fbcb5
2025-09-20 17:11:57 +00:00
stephan a2daecfc8c Further work on 64-bit WASM builds. It now gets through just shy of half of tester1.js.
FossilOrigin-Name: c8deed31365898e1379d577298fc80ef08a5531999d5b54a9f14337febed0260
2025-09-20 15:16:55 +00:00
dan cbefdaad9e If the file-system supports f2fs style atomic-writes, sync the directory after deleting a journal file in journal_mode=DELETE mode in synchronous=NORMAL or synchronous=FULL modes (as well as synchronous=EXTRA).
FossilOrigin-Name: e24b21699644a5b49181f2e63961b6a3fccb85605d0b6d109a6043341c194d99
2025-09-20 14:48:08 +00:00
drh 65a445d750 Fix the decimal_cmp() extension function to give correct results in
corner cases such as negative zero and two equivalent values where one
has extra trailing zeros to the right of the decimal point.
[forum:/forumpost/367c770224|Forum post 367c770224].

FossilOrigin-Name: 25b3626a018fa5916d0e129ee057c3f709c6e4d0b84a1a3102cad127a39a3db9
2025-09-20 14:32:12 +00:00
stephan bd5d297fec Get the wasm tests running in a 64-bit build up through (but not including) the oo1 bits.
FossilOrigin-Name: a5af46174a05e1414370884d1a99827af9286a60eff1c8ae1551e7fad3903f7a
2025-09-20 11:09:20 +00:00
stephan 22f9ca64db Get about 1/3rd of the tests running with MEMORY64=1, but the code noise level added by the BigInt/Number discrepancy is making this very unattractive. There are apparently irreconcilable differences between MEMORY64=1 and 2, in that they have different argument type expectations for methods such as WebAssembly.Table.get(), where MEMORY64=1 requires a BigInt a MEMORY64=2 requires a Number. We have no way to make that distinction from the JS code, and don't know what other APIs are affected by that quirk.
FossilOrigin-Name: 1e3b003ff99d2788d93e179504b711cb78846605774bf472589440d0136f20fa
2025-09-20 03:02:36 +00:00
stephan 6a03f2029b Baby steps towards 64-bit pointers. Get it building and testing again in 32-bit builds.
FossilOrigin-Name: f35bb66e3eb939d321afb3545c184013633ce35fa4cbd67b6be17a64997ece9d
2025-09-20 00:43:47 +00:00
stephan d6403a2d2e Initial experimentation with a -sMEMORY64=1 wasm build (full 64-bit). This compiles but does not pass tests due to friction between BigInt and Number types (e.g. Number(null)===0 but BigInt(null) throws, many functions are fussy about which of those types they'll take, and we cannot simply mix and match the two types transparently (1n+1 is not legal (but 1n>=1 is), so we can no longer do pointer arithmatic without hoop-jumping)). The library bootstraps but it's failing early on in tests due to this friction.
FossilOrigin-Name: cfd5c746a6111f49c9c83a56c3ef65223456306f2de6e20b36b1ca0c98b593e9
2025-09-19 23:21:00 +00:00
stephan 78202b9a3b Add some comments describing the ways in which building sqlite3.wasm with -sMEMORY64=(non-zero) fails.
FossilOrigin-Name: 0b14fd35ca37075bb65b2ab398f3324dc851347b1c042566eac23724013653f8
2025-09-19 20:10:05 +00:00
stephan a09a8ffa62 Initial build-side tweaks to pave the way for a 64-bit WASM build. Such a build does not yet work for reasons given in the makefile comments, but is an eventual goal.
FossilOrigin-Name: fe2e1681b6dac81508ab67d1247e1f92018c9998386789846d1715c2cc13d6a8
2025-09-19 19:28:13 +00:00
drh 723e8c88fa Improve imposter tables: (1) Read-only unless writeable_schema=ON
(2) --unsafe-testing no longer required (3) Does not interfere with
PRAGMA integrity_check.

FossilOrigin-Name: a4430d262b3e129d7f00be1661af563907d7b2e98560a9847cd399129f91247b
2025-09-19 17:33:29 +00:00
stephan d4cc844a2b Diverse cleanups and docs in the JS and kvvfs pieces. Functional changes: (A) ensure that the 'i32' JS/WASM func arg/result conversion works properly with a 64-bit-memory WASM build (which we neither use nor test but [https://webassembly.org/news/2025-09-17-wasm-3.0/ | the newly-ratified WASM 3.0] brings within potential reach). (B) Fix sqlite3_js_posix_create_file() to not deallocate its input array if the client passes in raw memory (the library has never used it that way but the API permits it).
FossilOrigin-Name: 79af65a694fbbb3d501fb2ebd835c259ca644e0dafdd71eeb9f0a7c0e9128a1e
2025-09-19 17:24:47 +00:00
drh 49a37f333a Improvements to imposter tables: (1) They are read-only unless writable-schema
is enabled.  (2) Because they are now read-only, the ".imposter" command
in the CLI no longer requires the --unsafe-testing command-line option.
(3) Imposter tables do not participate in a PRAGMA integrity_check and hence
do not cause false-positive errors.  However, you can still do an
integrity_check on the the imposter table itself by naming the imposter
table as the argument to integrity_check.

FossilOrigin-Name: ad152ddc4bcf6cfe840b9a36ab76a5ec36afdb1dd96eb7697e4b3df1bf63b00d
2025-09-19 17:24:12 +00:00
stephan 194d6edeb6 Wasm: (A) diverse internal doc updates. (B) when generating automated JS-to-WASM function proxies for converters which require an additional middle-man proxy, e.g. sqlite3_exec(), use the client-provided function, not the proxy function, as the cache key, to keep from re-generating the conversion in some common use patterns.
FossilOrigin-Name: 5e5139c2a162562cee0071d03954ebc0b8938da0b045ec3f5eba32dc8e19604d
2025-09-19 14:21:09 +00:00
drh e7fe1d3b3e Fix typo in the name of the CursorHints optimization in the CLI.
FossilOrigin-Name: 468a11fd415710042b23880772f6c2c7771008208823fe3b554227a9244dbf92
2025-09-19 09:18:22 +00:00
drh f5dc671a57 Fix a harmless compiler warning.
FossilOrigin-Name: 42c225a2ed7fc95f9b01467c64ba2bf97bca216fdcd6ab1ba3fb49c068650de9
2025-09-19 01:17:44 +00:00
drh e7efe1e201 Fix the new walckptnoop.test test module so that it works in various
alignments.

FossilOrigin-Name: 08689dacc1237a2b90dff4d32186b28054214f709dbff9e07057d3175c1c423a
2025-09-18 23:23:50 +00:00
drh 8f5503861f Try to make the carray extension easier to compile on VxWorks.
FossilOrigin-Name: 1a34c3f49ec48b551098f6781a3a6355aa3c9fd47fd9ebaef01f254b1dcafc9d
2025-09-18 19:59:56 +00:00
drh 7cbfa5b0d1 Include I/O consumed by ephermeral cursors in the SQLITE_DBSTATUS_SPILL
values.  Still need to add sorter.

FossilOrigin-Name: 118905b26a96825433f79b47fd3e7c2bdb137d84292fb9419e4436a961a9833a
2025-09-18 18:56:55 +00:00
drh 3312564540 Fix harmless compiler warning in the CLI.
[forum:/forumpost/ffdcdaba19|Forum post ffdcdaba19].

FossilOrigin-Name: 1626b6082d06c6fd66ff0a6d9fb3641c936ee8db326275e4fddfecf172c5a6eb
2025-09-18 16:48:37 +00:00
drh 16eedfbdda Initial implementation of SQLITE_DBSTATUS_SPILL. Does not yet take into
account sorters or transient tables.

FossilOrigin-Name: 4e63ee20f80e486ecc4aa4523afa43f994c267e638f8f084f0d6df369aa74a1d
2025-09-18 14:51:23 +00:00
stephan 9290d70466 Improve the quote-stripping when importing a db into fiddle, as reported in [forum:264050a3f3 | forum post 264050a3f3].
FossilOrigin-Name: 1a87c16fddf174380deba9bbe58079328baf9f9ca95210f63bc628e3ef3eeb26
2025-09-17 20:05:12 +00:00
drh 3e17953beb Add the sqlite3_db_status64() interface.
FossilOrigin-Name: bb5b982dba774e6b8011e6c980d34131c378967fadc59a18fed1cefda596449a
2025-09-17 19:19:52 +00:00
drh ac28cc30c0 Remove newly unreachable code in the solver of the query planner.
FossilOrigin-Name: 9abaa0ac2b3049341f36ff683ff6eebb589698bd910624aa24f11398d557b3c2
2025-09-17 17:09:07 +00:00
drh 12ed2fea03 In the date/time functions, a timezone suffix of "+00:00" should work
the same as "Z".
[forum:/forumpost/2025-09-17T10:12:14z|Forum post 2025-09-17T10:12:14z].

FossilOrigin-Name: 3b7a5babf0843c4b3ce93d26f1447218585ce645ec3acd942ac649204e16675a
2025-09-17 14:55:47 +00:00
dan a12c1dcca6 If the file-system supports f2fs style atomic-writes, sync the directory after deleting a journal file in journal_mode=DELETE mode in synchronous=NORMAL or synchronous=FULL modes (as well as synchronous=EXTRA).
FossilOrigin-Name: c1e37cb70a8e93368c19ba0fdb987f0616abac028e3541d793a4e6f005b0e513
2025-09-16 19:52:12 +00:00
dan 48790b48a7 Updates to where.c to handle vtabs in joins more similarly to regular tables.
FossilOrigin-Name: 9138223013505d3e0f1f2b40b51d521184aabd50732fdf4f6bed393cfa9475fc
2025-09-15 17:06:35 +00:00
191 changed files with 12119 additions and 7224 deletions
+10 -16
View File
@@ -30,14 +30,12 @@ The public domain source files usually contain a header comment
similar to the following to make it clear that the software is
public domain.
> ~~~
The author disclaims copyright to this source code. In place of
a legal notice, here is a blessing:
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
~~~
> The author disclaims copyright to this source code. In place of
> a legal notice, here is a blessing:
>
> * May you do good and not evil.
> * May you find forgiveness for yourself and forgive others.
> * May you share freely, never taking more than you give.
Almost every file you find in this source repository will be
public domain. But there are a small number of exceptions:
@@ -49,9 +47,7 @@ This repository contains a (relatively) small amount of non-public-domain
code used to help implement the configuration and build logic. In other
words, there are some non-public-domain files used to implement:
> ~~~
./configure && make
~~~
> ./configure && make
In all cases, the non-public-domain files included with this
repository have generous BSD-style licenses. So anyone is free to
@@ -69,7 +65,7 @@ third-party build scripts in order to compile SQLite.
Non-public-domain code included in this respository includes:
* The ["autosetup"](http://msteveb.github.io/autosetup/) configuration
system that is contained (mostly) the autosetup/ directory, but also
system that is contained (mostly) in the autosetup/ directory, but also
includes the "./configure" script at the top-level of this archive.
Autosetup has a separate BSD-style license. See the
[autosetup/LICENSE](http://msteveb.github.io/autosetup/license/)
@@ -79,13 +75,11 @@ Non-public-domain code included in this respository includes:
software found in the legacy autoconf/ directory and its
subdirectories.
The following unix shell command is can be run from the top-level
The following unix shell command can be run from the top-level
of this source repository in order to remove all non-public-domain
code:
> ~~~
rm -rf configure autosetup autoconf
~~~
> rm -rf configure autosetup autoconf
If you unpack this source repository and then run the command above, what
is left will be 100% public domain.
+145 -6
View File
@@ -405,6 +405,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1
!ENDIF
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
!ENDIF
@@ -427,6 +428,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
# Always enable math functions on Windows
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE
# Should the rbu extension be enabled? If so, add compilation options
# to enable it.
@@ -803,17 +805,21 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
!IF $(DEBUG)>1
TCC = $(TCC) -MDd
BCC = $(BCC) -MDd
ZLIBCFLAGS = -nologo -MDd -W3 -O2 -Oy- -Zi
!ELSE
TCC = $(TCC) -MD
BCC = $(BCC) -MD
ZLIBCFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi
!ENDIF
!ELSE
!IF $(DEBUG)>1
TCC = $(TCC) -MTd
BCC = $(BCC) -MTd
ZLIBCFLAGS = -nologo -MTd -W3 -O2 -Oy- -Zi
!ELSE
TCC = $(TCC) -MT
BCC = $(BCC) -MT
ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi
!ENDIF
!ENDIF
@@ -1343,7 +1349,7 @@ LTLIBS = $(LTLIBS) $(LIBICU)
#
LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
callback.lo complete.lo ctime.lo \
callback.lo carray.lo complete.lo ctime.lo \
date.lo dbpage.lo dbstat.lo delete.lo \
expr.lo fault.lo fkey.lo \
fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
@@ -1405,6 +1411,7 @@ SRC00 = \
$(TOP)\src\btree.c \
$(TOP)\src\build.c \
$(TOP)\src\callback.c \
$(TOP)\src\carray.c \
$(TOP)\src\complete.c \
ctime.c \
$(TOP)\src\date.c \
@@ -1638,7 +1645,6 @@ TESTEXT = \
$(TOP)\ext\misc\amatch.c \
$(TOP)\ext\misc\appendvfs.c \
$(TOP)\ext\misc\basexx.c \
$(TOP)\ext\misc\carray.c \
$(TOP)\ext\misc\cksumvfs.c \
$(TOP)\ext\misc\closure.c \
$(TOP)\ext\misc\csv.c \
@@ -1654,7 +1660,6 @@ TESTEXT = \
$(TOP)\ext\misc\mmapwarm.c \
$(TOP)\ext\misc\nextchar.c \
$(TOP)\ext\misc\normalize.c \
$(TOP)\ext\misc\percentile.c \
$(TOP)\ext\misc\prefixes.c \
$(TOP)\ext\misc\qpvtab.c \
$(TOP)\ext\misc\randomjson.c \
@@ -1766,6 +1771,7 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_PERCENTILE=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1
@@ -1780,6 +1786,7 @@ FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -I$(TOP)\test -I$(TOP)\ext\recover
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MEMSYS5
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_OSS_FUZZ
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_CARRAY
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBPAGE_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBSTAT_VTAB
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
@@ -1793,6 +1800,7 @@ FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MATH_FUNCTIONS
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MEMSYS5
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_NORMALIZE
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_PERCENTILE
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_PREUPDATE_HOOK
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_RTREE
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_SESSION
@@ -1823,7 +1831,6 @@ FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\test\fuzzinvariants.c
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\test\vt02.c
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\recover\dbdata.c
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\recover\sqlite3recover.c
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\misc\percentile.c
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\misc\randomjson.c
OSSSHELL_SRC = $(TOP)\test\ossshell.c $(TOP)\test\ossfuzz.c
@@ -2101,6 +2108,9 @@ build.lo: $(TOP)\src\build.c $(HDR)
callback.lo: $(TOP)\src\callback.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
carray.lo: $(TOP)\src\carray.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\carray.c
complete.lo: $(TOP)\src\complete.c $(HDR)
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
@@ -2384,7 +2394,6 @@ SHELL_DEP = \
$(TOP)\ext\misc\ieee754.c \
$(TOP)\ext\misc\memtrace.c \
$(TOP)\ext\misc\pcachetrace.c \
$(TOP)\ext\misc\percentile.c \
$(TOP)\ext\misc\regexp.c \
$(TOP)\ext\misc\series.c \
$(TOP)\ext\misc\sha1.c \
@@ -2411,7 +2420,7 @@ shell.c: $(SHELL_DEP) $(TOP)\tool\mkshellc.tcl $(JIM_TCLSH)
$(JIM_TCLSH) $(TOP)\tool\mkshellc.tcl shell.c
zlib:
pushd $(ZLIBDIR) && $(MAKE) /f win32\Makefile.msc clean $(ZLIBLIB) && popd
pushd $(ZLIBDIR) && $(MAKE) /f win32\Makefile.msc clean $(ZLIBLIB) CFLAGS="$(ZLIBCFLAGS)" && popd
# Rules to build the extension objects.
#
@@ -2525,6 +2534,8 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CKSUMVFS_STATIC=1
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_STATIC_RANDOMJSON
@@ -2804,6 +2815,134 @@ tcl-env:
@echo JIM_TCLSH = $(JIM_TCLSH)
@echo VISUALSTUDIOVERSION = $(VISUALSTUDIOVERSION)
env:
@echo ALL_TCL_TARGETS = $(ALL_TCL_TARGETS)
@echo API_ARMOR = $(API_ARMOR)
@echo ASAN = $(ASAN)
@echo BCC = $(BCC)
@echo BUILD_ZLIB = $(BUILD_ZLIB)
@echo CC = $(CC)
@echo CCOPTS = $(CCOPTS)
@echo CHECKER_DEPS = $(CHECKER_DEPS)
@echo CORE_CCONV_OPTS = $(CORE_CCONV_OPTS)
@echo CORE_COMPILE_OPTS = $(CORE_COMPILE_OPTS)
@echo CORE_LINK_DEP = $(CORE_LINK_DEP)
@echo CORE_LINK_OPTS = $(CORE_LINK_OPTS)
@echo CRTLIBPATH = $(CRTLIBPATH)
@echo CSC = $(CSC)
@echo DBFUZZ_COMPILE_OPTS = $(DBFUZZ_COMPILE_OPTS)
@echo DEBUG = $(DEBUG)
@echo DYNAMIC_SHELL = $(DYNAMIC_SHELL)
@echo EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS)
@echo EXTHDR = $(EXTHDR)
@echo EXTRA_SRC = $(EXTRA_SRC)
@echo FOR_UWP = $(FOR_UWP)
@echo FUZZCHECK_OPTS = $(FUZZCHECK_OPTS)
@echo FUZZCHECK_SRC = $(FUZZCHECK_SRC)
@echo FUZZDATA = $(FUZZDATA)
@echo FUZZERSHELL_COMPILE_OPTS = $(FUZZERSHELL_COMPILE_OPTS)
@echo HDR = $(HDR)
@echo ICUDIR = $(ICUDIR)
@echo ICUINCDIR = $(ICUINCDIR)
@echo ICULIBDIR = $(ICULIBDIR)
@echo JIM_TCLSH = $(JIM_TCLSH)
@echo KV_COMPILE_OPTS = $(KV_COMPILE_OPTS)
@echo LDFLAGS = $(LDFLAGS)
@echo LD = $(LD)
@echo LIBICU = $(LIBICU)
@echo LIBOBJ = $(LIBOBJ)
@echo LIBREADLINE = $(LIBREADLINE)
@echo LIBRESOBJS = $(LIBRESOBJS)
@echo LIBTCLPATH = $(LIBTCLPATH)
@echo LIBTCLSTUB = $(LIBTCLSTUB)
@echo LIBTCL = $(LIBTCL)
@echo LTCOMPILE = $(LTCOMPILE)
@echo LTLIB = $(LTLIB)
@echo LTLIBOPTS = $(LTLIBOPTS)
@echo LTLIBPATHS = $(LTLIBPATHS)
@echo LTLIBS = $(LTLIBS)
@echo LTLINK = $(LTLINK)
@echo LTLINKOPTS = $(LTLINKOPTS)
@echo LTRCOMPILE = $(LTRCOMPILE)
@echo MEMDEBUG = $(MEMDEBUG)
@echo MINIMAL_AMALGAMATION = $(MINIMAL_AMALGAMATION)
@echo MPTESTER_COMPILE_OPTS = $(MPTESTER_COMPILE_OPTS)
@echo NCC = $(NCC)
@echo NCRTLIBPATH = $(NCRTLIBPATH)
@echo NLTLIBPATHS = $(NLTLIBPATHS)
@echo NO_LINEMACROS = $(NO_LINEMACROS)
@echo NO_TCL = $(NO_TCL)
@echo NO_WARN = $(NO_WARN)
@echo NSDKLIBPATH = $(NSDKLIBPATH)
@echo NUCRTLIBPATH = $(NUCRTLIBPATH)
@echo OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS)
@echo OPTIMIZATIONS = $(OPTIMIZATIONS)
@echo OSSSHELL_SRC = $(OSSSHELL_SRC)
@echo OSTRACE = $(OSTRACE)
@echo RBU = $(RBU)
@echo RCC = $(RCC)
@echo RC = $(RC)
@echo READLINE_FLAGS = $(READLINE_FLAGS)
@echo REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS)
@echo RSYNC_OPT = $(RSYNC_OPT)
@echo RSYNC_SRC = $(RSYNC_SRC)
@echo SESSION = $(SESSION)
@echo SETLK_TIMEOUT = $(SETLK_TIMEOUT)
@echo SHELL_CCONV_OPTS = $(SHELL_CCONV_OPTS)
@echo SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS)
@echo SHELL_CORE_DEP = $(SHELL_CORE_DEP)
@echo SHELL_CORE_LIB = $(SHELL_CORE_LIB)
@echo SHELL_CORE_SRC = $(SHELL_CORE_SRC)
@echo SHELL_DEP = $(SHELL_DEP)
@echo SHELL_LINK_OPTS = $(SHELL_LINK_OPTS)
@echo SPLIT_AMALGAMATION = $(SPLIT_AMALGAMATION)
@echo SQLITETCLDECLSH = $(SQLITETCLDECLSH)
@echo SQLITE_TCL_DEP = $(SQLITE_TCL_DEP)
@echo SQLITETCLH = $(SQLITETCLH)
@echo SRC = $(SRC)
@echo STATICALLY_LINK_TCL = $(STATICALLY_LINK_TCL)
@echo ST_COMPILE_OPTS = $(ST_COMPILE_OPTS)
@echo STORELIBPATH = $(STORELIBPATH)
@echo SYMBOLS = $(SYMBOLS)
@echo TCC = $(TCC)
@echo TCLDIR = $(TCLDIR)
@echo TCLINCDIR = $(TCLINCDIR)
@echo TCLLIBDIR = $(TCLLIBDIR)
@echo TCLLIBPATHS = $(TCLLIBPATHS)
@echo TCLLIBS = $(TCLLIBS)
@echo TCLSH_CMD = $(TCLSH_CMD)
@echo TCLSQLITEEX = $(TCLSQLITEEX)
@echo TCLSUFFIX = $(TCLSUFFIX)
@echo TCLVERSION = $(TCLVERSION)
@echo TEST_CCONV_OPTS = $(TEST_CCONV_OPTS)
@echo TESTEXT = $(TESTEXT)
@echo TESTFIXTURE_DEP = $(TESTFIXTURE_DEP)
@echo TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS)
@echo TESTFIXTURE_SRC = $(TESTFIXTURE_SRC)
@echo TESTOPTS = $(TESTOPTS)
@echo TESTPROGS = $(TESTPROGS)
@echo TESTSRC = $(TESTSRC)
@echo TLIBS = $(TLIBS)
@echo TOP = $(TOP)
@echo UCRTLIBPATH = $(UCRTLIBPATH)
@echo USE_AMALGAMATION = $(USE_AMALGAMATION)
@echo USE_CRT_DLL = $(USE_CRT_DLL)
@echo USE_FATAL_WARN = $(USE_FATAL_WARN)
@echo USE_FULLWARN = $(USE_FULLWARN)
@echo USE_ICU = $(USE_ICU)
@echo USE_LISTINGS = $(USE_LISTINGS)
@echo USE_NATIVE_LIBPATHS = $(USE_NATIVE_LIBPATHS)
@echo USE_RC = $(USE_RC)
@echo USE_RUNTIME_CHECKS = $(USE_RUNTIME_CHECKS)
@echo USE_SEH = $(USE_SEH)
@echo USE_STDCALL = $(USE_STDCALL)
@echo USE_ZLIB = $(USE_ZLIB)
@echo XCOMPILE = $(XCOMPILE)
@echo ZLIBDIR = $(ZLIBDIR)
@echo ZLIBINCDIR = $(ZLIBINCDIR)
@echo ZLIBLIBDIR = $(ZLIBLIBDIR)
@echo ZLIBLIB = $(ZLIBLIB)
moreclean: clean
del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL
# <</mark>>
+18 -24
View File
@@ -2,8 +2,8 @@
This repository contains the complete source code for the
[SQLite database engine](https://sqlite.org/), including
many test scripts. However, other test scripts
and most of the documentation are managed separately.
many tests. Additional tests and most documentation
are managed separately.
See the [on-line documentation](https://sqlite.org/) for more information
about what SQLite is and how it works from a user's perspective. This
@@ -53,39 +53,32 @@ then no longer be fully in the public domain.
## Obtaining The SQLite Source Code
If you do not want to use Fossil, you can download tarballs or ZIP
archives or [SQLite archives](https://sqlite.org/cli.html#sqlar) as follows:
Source code tarballs or ZIP archives are available at:
* Latest trunk check-in as
[Tarball](https://sqlite.org/src/tarball/sqlite.tar.gz),
[ZIP-archive](https://sqlite.org/src/zip/sqlite.zip), or
[SQLite-archive](https://sqlite.org/src/sqlar/sqlite.sqlar).
* [Latest trunk check-in](https://sqlite.org/src/rchvdwnld/trunk).
* Latest release as
[Tarball](https://sqlite.org/src/tarball/sqlite.tar.gz?r=release),
[ZIP-archive](https://sqlite.org/src/zip/sqlite.zip?r=release), or
[SQLite-archive](https://sqlite.org/src/sqlar/sqlite.sqlar?r=release).
* [Latest release](https://sqlite.org/src/rchvdwnld/release)
* For other check-ins, substitute an appropriate branch name or
tag or hash prefix in place of "release" in the URLs of the previous
bullet. Or browse the [timeline](https://sqlite.org/src/timeline)
to locate the check-in desired, click on its information page link,
then click on the "Tarball" or "ZIP Archive" links on the information
page.
* For other check-ins, browse the
[project timeline](https://sqlite.org/src/timeline?y=ci) and
click on the check-in hash of the check-in you want to download.
On the resulting "info" page, click one of the options to the
right of the "**Downloads:**" label in the "**Overview**" section
near the top.
To access sources directly using [Fossil](https://fossil-scm.org/home),
first install Fossil version 2.0 or later.
Source tarballs and precompiled binaries available at
Source tarballs and precompiled binaries for Fossil are available at
<https://fossil-scm.org/home/uv/download.html>. Fossil is
a stand-alone program. To install, simply download or build the single
executable file and put that file someplace on your $PATH.
executable file and put that file someplace on your $PATH or %PATH%.
Then run commands like this:
mkdir -p ~/sqlite
cd ~/sqlite
fossil open https://sqlite.org/src
The "fossil open" command will take two or three minutes. Afterwards,
The initial "fossil open" command will take two or three minutes. Afterwards,
you can do fast, bandwidth-efficient updates to the whatever versions
of SQLite you like. Some examples:
@@ -152,7 +145,8 @@ show what changes are needed.
## Compiling for Windows Using MSVC
On Windows, everything can be compiled with MSVC.
You will also need a working installation of TCL.
You will also need a working installation of TCL if you want to run tests.
TCL is not required if you just want to build SQLite itself.
See the [compile-for-windows.md](doc/compile-for-windows.md) document for
additional information about how to install MSVC and TCL and configure your
build environment.
@@ -164,8 +158,8 @@ TCL library, using a command like this:
SQLite uses "tclsh.exe" as part of the build process, and so that
program will need to be somewhere on your %PATH%. SQLite itself
does not contain any TCL code, but it does use TCL to help with the
build process and to run tests. You may need to install TCL development
does not contain any TCL code, but it does use TCL to run tests.
You may need to install TCL development
libraries in order to successfully complete some makefile targets.
It is helpful, but is not required, to install the SQLite TCL extension
(the "tclextension-install" target) prior to running tests.
+1 -1
View File
@@ -1 +1 @@
3.51.0
3.51.2
+13
View File
@@ -117,6 +117,19 @@ sqlite_cfg.h: $(AS_AUTO_DEF)
# CFLAGS for sqlite3$(T.exe)
#
SHELL_OPT ?= @OPT_SHELL@
SHELL_OPT += -DSQLITE_DQS=0
SHELL_OPT += -DSQLITE_ENABLE_FTS4
#SHELL_OPT += -DSQLITE_ENABLE_FTS5
SHELL_OPT += -DSQLITE_ENABLE_RTREE
SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
SHELL_OPT += -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
SHELL_OPT += -DSQLITE_ENABLE_STMTVTAB
SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
SHELL_OPT += -DSQLITE_ENABLE_PERCENTILE
SHELL_OPT += -DSQLITE_STRICT_SUBTYPE=1
#
# Library-level feature flags
+7
View File
@@ -327,6 +327,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1
!ENDIF
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
!ENDIF
@@ -349,6 +350,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
# Always enable math functions on Windows
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE
# Should the rbu extension be enabled? If so, add compilation options
# to enable it.
@@ -693,17 +695,21 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
!IF $(DEBUG)>1
TCC = $(TCC) -MDd
BCC = $(BCC) -MDd
ZLIBCFLAGS = -nologo -MDd -W3 -O2 -Oy- -Zi
!ELSE
TCC = $(TCC) -MD
BCC = $(BCC) -MD
ZLIBCFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi
!ENDIF
!ELSE
!IF $(DEBUG)>1
TCC = $(TCC) -MTd
BCC = $(BCC) -MTd
ZLIBCFLAGS = -nologo -MTd -W3 -O2 -Oy- -Zi
!ELSE
TCC = $(TCC) -MT
BCC = $(BCC) -MT
ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi
!ENDIF
!ENDIF
@@ -1015,6 +1021,7 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_PERCENTILE=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1
+3 -2
View File
@@ -119,7 +119,7 @@ TCLLIBDIR = @TCLLIBDIR@
# typically come from the ./configure command-line invocation).
#
CFLAGS.configure = @SH_CFLAGS@ @TEAISH_CFLAGS@ @CFLAGS@ @CPPFLAGS@ $(TCL_INCLUDE_SPEC)
#CFLAGS.configure += -DUSE_TCL_STUBS=1
CFLAGS.configure += -DUSE_TCL_STUBS=@TEAISH_USE_STUBS@
#
# LDFLAGS.configure = LDFLAGS as known at configure-time.
@@ -153,6 +153,7 @@ tx.src = @TEAISH_EXT_SRC@
# gets set up via the configure script.
#
tx.CFLAGS =
tx.CPPFLAGS =
#
# tx.LDFLAGS is typically set by teaish.make, whereas TEAISH_LDFLAGS
@@ -218,7 +219,7 @@ config.log: @TEAISH_TEST_TCL_IN@
# CC variant for compiling Tcl-using sources.
#
CC.tcl = \
$(CC) -o $@ $(CFLAGS.configure) $(CFLAGS) $(tx.CFLAGS)
$(CC) -o $@ $(CFLAGS.configure) $(CFLAGS) $(tx.CFLAGS) $(tx.CPPFLAGS)
#
# CC variant for linking $(tx.src) into an extension DLL. Note that
+1 -1
View File
@@ -557,7 +557,7 @@ proc proj-opt-define-bool {args} {
if {$invert} {
set rc [expr {!$rc}]
}
msg-result $rc
msg-result [string map {0 no 1 yes} $rc]
define $defName $rc
return $rc
}
+5 -3
View File
@@ -65,7 +65,7 @@ array set sqliteConfig [subst [proj-strip-hash-comments {
# The list of feature --flags which the --all flag implies. This
# requires special handling in a few places.
#
all-flag-enables {fts4 fts5 rtree geopoly session dbpage dbstat}
all-flag-enables {fts4 fts5 rtree geopoly session dbpage dbstat carray}
#
# Default value for the --all flag. Can hypothetically be modified
@@ -222,6 +222,7 @@ proc sqlite-configure {buildMode configScript} {
session => {Enable the SESSION extension}
dbpage => {Enable the sqlite3_dbpage extension}
dbstat => {Enable the sqlite3_dbstat extension}
carray=1 => {Disable the CARRAY extension}
all=$::sqliteConfig(all-flag-default) => {$allFlagHelp}
largefile=1
=> {This legacy flag has no effect on the library but may influence
@@ -630,7 +631,7 @@ proc sqlite-check-common-system-deps {} {
# Check for needed/wanted functions
cc-check-functions gmtime_r isnan localtime_r localtime_s \
strchrnul usleep utime pread pread64 pwrite pwrite64
usleep utime pread pread64 pwrite pwrite64
apply {{} {
set ldrt ""
@@ -790,6 +791,7 @@ proc sqlite-handle-common-feature-flags {} {
column-metadata -DSQLITE_ENABLE_COLUMN_METADATA {}
dbpage -DSQLITE_ENABLE_DBPAGE_VTAB {}
dbstat -DSQLITE_ENABLE_DBSTAT_VTAB {}
carray -DSQLITE_ENABLE_CARRAY {}
}] {
if {$boolFlag ni $::autosetup(options)} {
# Skip flags which are in the canonical build but not
@@ -1488,7 +1490,7 @@ proc sqlite-handle-math {} {
}
define LDFLAGS_MATH [get-define lib_ceil]
undefine lib_ceil
sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS
sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE
msg-result "Enabling math SQL functions"
} {
define LDFLAGS_MATH ""
+5 -1
View File
@@ -220,7 +220,9 @@ proc teaish-configure-core {} {
=> {Full pathname of tclsh to use. It is used for trying to find
tclConfig.sh. Warning: if its containing dir has multiple tclsh
versions, it may select the wrong tclConfig.sh!
Defaults to the $TCLSH environment variable.}
Defaults to the $TCLSH environment variable.}
tcl-stubs=0 => {Enable use of Tcl stubs library.}
# TEA has --with-tclinclude but it appears to only be useful for
# building an extension against an uninstalled copy of TCL's own
@@ -498,6 +500,8 @@ proc teaish__configure_phase1 {} {
}
teaish-checks-run -post
define TEAISH_USE_STUBS [opt-bool tcl-stubs]
apply {{} {
# Set up "vsatisfies" code for pkgIndex.tcl.in,
# _teaish.tester.tcl.in, and for a configure-time check. We would
+8 -17
View File
@@ -1,7 +1,7 @@
# Notes On Compiling SQLite On Windows 11
Below are step-by-step instructions on how to build SQLite from
canonical source on a new Windows 11 PC, as of 2024-10-09.
canonical source on a new Windows 11 PC, as of 2025-10-31.
See [](./compile-for-unix.md) for a similar guide for unix-like
systems, including MacOS.
@@ -24,7 +24,8 @@ systems, including MacOS.
application to your task bar, as you will use it a lot. Bring up
an instance of this command prompt and do all of the subsequent steps
in that "x64 Native Tools" command prompt. (Or use "x86" if you want
a 32-bit build.) The subsequent steps will not work in a vanilla
a 32-bit build. Or use "ARM64" if you want to do a build for Windows
on ARM.) The subsequent steps will not work in a vanilla
DOS prompt. Nor will they work in PowerShell.
3. *(Optional):* Install TCL development libraries.
@@ -133,9 +134,7 @@ following minor changes:
The command the developers use for building the deliverable DLL on the
[download page](https://sqlite.org/download.html) is as follows:
> ~~~~
nmake /f Makefile.msc sqlite3.dll USE_NATIVE_LIBPATHS=1 "OPTS=-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SERIALIZE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1"
~~~~
> nmake /f Makefile.msc sqlite3.dll USE_NATIVE_LIBPATHS=1 "OPTS=-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SERIALIZE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1"
That command generates both the sqlite3.dll and sqlite3.def files. The same
command works for both 32-bit and 64-bit builds.
@@ -147,9 +146,7 @@ with TCL in order to function. The [sqlite3_analyzer.exe program](https://sqlit
is an example. You can build as described above, and then
enter:
> ~~~~
nmake /f Makefile.msc sqlite3_analyzer.exe
~~~~
> nmake /f Makefile.msc sqlite3_analyzer.exe
And you will end up with a working executable. However, that executable
will depend on having the "tcl98.dll" library somewhere on your %PATH%.
@@ -175,17 +172,11 @@ statically linked so that it does not depend on separate DLL:
5. CD into your SQLite source code directory and build the desired
utility program, but add the following extra argument to the
nmake command line:
<blockquote><pre>
STATICALLY_LINK_TCL=1
</pre></blockquote>
<blockquote><pre>STATICALLY_LINK_TCL=1</pre></blockquote>
<p>So, for example, to build a statically linked version of
sqlite3_analyzer.exe, you might type:
<blockquote><pre>
nmake /f Makefile.msc STATICALLY_LINK_TCL=1 sqlite3_analyzer.exe
</pre></blockquote>
<blockquote><pre>nmake /f Makefile.msc STATICALLY_LINK_TCL=1 sqlite3_analyzer.exe</pre></blockquote>
6. After your executable is built, you can verify that it does not
depend on the TCL DLL by running:
<blockquote><pre>
dumpbin /dependents sqlite3_analyzer.exe
</pre></blockquote>
<blockquote><pre>dumpbin /dependents sqlite3_analyzer.exe</pre></blockquote>
+8 -9
View File
@@ -149,11 +149,10 @@ RFC 8259 format, without extensions. The payload is the ASCII
text representation of that numeric value.
<li value="4"><p><b>INT5</b> &rarr;
The element is a JSON integer value that is not in the
canonical format. The payload is the ASCII
text representation of that numeric value. Because the payload is in a
non-standard format, it will need to be translated when the JSONB is
converted into RFC 8259 text JSON.
The element is a JSON integer literal in hexadecimal notation.
The payload is the ASCII text representation of the literal.
Because the payload is in a non-standard format, it will need
to be translated when the JSONB is converted into RFC 8259 text JSON.
<li value="5"><p><b>FLOAT</b> &rarr;
The element is a JSON floating-point value in the canonical
@@ -162,10 +161,10 @@ text representation of that numeric value.
<li value="6"><p><b>FLOAT5</b> &rarr;
The element is a JSON floating-point value that is not in the
canonical format. The payload is the ASCII
text representation of that numeric value. Because the payload is in a
non-standard format, it will need to be translated when the JSONB is
converted into RFC 8259 text JSON.
canonical JSON format but rather the extended JSON5 format.
The payload is the ASCII text representation of that numeric value.
Because the payload is in a non-standard format, it will need to
be translated when the JSONB is converted into RFC 8259 text JSON.
<li value="7"><p><b>TEXT</b> &rarr;
The element is a JSON string value that does not contain
+27 -25
View File
@@ -172,11 +172,11 @@ struct sqlite3expert {
** Allocate and return nByte bytes of zeroed memory using sqlite3_malloc().
** If the allocation fails, set *pRc to SQLITE_NOMEM and return NULL.
*/
static void *idxMalloc(int *pRc, int nByte){
static void *idxMalloc(int *pRc, i64 nByte){
void *pRet;
assert( *pRc==SQLITE_OK );
assert( nByte>0 );
pRet = sqlite3_malloc(nByte);
pRet = sqlite3_malloc64(nByte);
if( pRet ){
memset(pRet, 0, nByte);
}else{
@@ -243,7 +243,7 @@ static int idxHashAdd(
return 1;
}
}
pEntry = idxMalloc(pRc, sizeof(IdxHashEntry) + nKey+1 + nVal+1);
pEntry = idxMalloc(pRc, sizeof(IdxHashEntry) + (i64)nKey+1 + (i64)nVal+1);
if( pEntry ){
pEntry->zKey = (char*)&pEntry[1];
memcpy(pEntry->zKey, zKey, nKey);
@@ -378,15 +378,15 @@ struct ExpertCsr {
};
static char *expertDequote(const char *zIn){
int n = STRLEN(zIn);
char *zRet = sqlite3_malloc(n);
i64 n = STRLEN(zIn);
char *zRet = sqlite3_malloc64(n);
assert( zIn[0]=='\'' );
assert( zIn[n-1]=='\'' );
if( zRet ){
int iOut = 0;
int iIn = 0;
i64 iOut = 0;
i64 iIn = 0;
for(iIn=1; iIn<(n-1); iIn++){
if( zIn[iIn]=='\'' ){
assert( zIn[iIn+1]=='\'' );
@@ -699,7 +699,7 @@ static int idxGetTableInfo(
sqlite3_stmt *p1 = 0;
int nCol = 0;
int nTab;
int nByte;
i64 nByte;
IdxTable *pNew = 0;
int rc, rc2;
char *pCsr = 0;
@@ -791,14 +791,14 @@ static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){
va_list ap;
char *zAppend = 0;
char *zRet = 0;
int nIn = zIn ? STRLEN(zIn) : 0;
int nAppend = 0;
i64 nIn = zIn ? STRLEN(zIn) : 0;
i64 nAppend = 0;
va_start(ap, zFmt);
if( *pRc==SQLITE_OK ){
zAppend = sqlite3_vmprintf(zFmt, ap);
if( zAppend ){
nAppend = STRLEN(zAppend);
zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
zRet = (char*)sqlite3_malloc64(nIn + nAppend + 1);
}
if( zAppend && zRet ){
if( nIn ) memcpy(zRet, zIn, nIn);
@@ -1562,8 +1562,8 @@ struct IdxRemCtx {
int eType; /* SQLITE_NULL, INTEGER, REAL, TEXT, BLOB */
i64 iVal; /* SQLITE_INTEGER value */
double rVal; /* SQLITE_FLOAT value */
int nByte; /* Bytes of space allocated at z */
int n; /* Size of buffer z */
i64 nByte; /* Bytes of space allocated at z */
i64 n; /* Size of buffer z */
char *z; /* SQLITE_TEXT/BLOB value */
} aSlot[1];
};
@@ -1599,11 +1599,13 @@ static void idxRemFunc(
break;
case SQLITE_BLOB:
sqlite3_result_blob(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT);
assert( pSlot->n <= 0x7fffffff );
sqlite3_result_blob(pCtx, pSlot->z, (int)pSlot->n, SQLITE_TRANSIENT);
break;
case SQLITE_TEXT:
sqlite3_result_text(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT);
assert( pSlot->n <= 0x7fffffff );
sqlite3_result_text(pCtx, pSlot->z, (int)pSlot->n, SQLITE_TRANSIENT);
break;
}
@@ -1623,10 +1625,10 @@ static void idxRemFunc(
case SQLITE_BLOB:
case SQLITE_TEXT: {
int nByte = sqlite3_value_bytes(argv[1]);
i64 nByte = sqlite3_value_bytes(argv[1]);
const void *pData = 0;
if( nByte>pSlot->nByte ){
char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2);
char *zNew = (char*)sqlite3_realloc64(pSlot->z, nByte*2);
if( zNew==0 ){
sqlite3_result_error_nomem(pCtx);
return;
@@ -1681,7 +1683,7 @@ static int idxPopulateOneStat1(
int nCol = 0;
int i;
sqlite3_stmt *pQuery = 0;
int *aStat = 0;
i64 *aStat = 0;
int rc = SQLITE_OK;
assert( p->iSample>0 );
@@ -1727,7 +1729,7 @@ static int idxPopulateOneStat1(
sqlite3_free(zQuery);
if( rc==SQLITE_OK ){
aStat = (int*)idxMalloc(&rc, sizeof(int)*(nCol+1));
aStat = (i64*)idxMalloc(&rc, sizeof(i64)*(nCol+1));
}
if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pQuery) ){
IdxHashEntry *pEntry;
@@ -1744,11 +1746,11 @@ static int idxPopulateOneStat1(
}
if( rc==SQLITE_OK ){
int s0 = aStat[0];
zStat = sqlite3_mprintf("%d", s0);
i64 s0 = aStat[0];
zStat = sqlite3_mprintf("%lld", s0);
if( zStat==0 ) rc = SQLITE_NOMEM;
for(i=1; rc==SQLITE_OK && i<=nCol; i++){
zStat = idxAppendText(&rc, zStat, " %d", (s0+aStat[i]/2) / aStat[i]);
zStat = idxAppendText(&rc, zStat, " %lld", (s0+aStat[i]/2) / aStat[i]);
}
}
@@ -1827,7 +1829,7 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
rc = sqlite3_exec(p->dbm, "ANALYZE; PRAGMA writable_schema=1", 0, 0, 0);
if( rc==SQLITE_OK ){
int nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax);
i64 nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax);
pCtx = (struct IdxRemCtx*)idxMalloc(&rc, nByte);
}
@@ -1844,7 +1846,7 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
}
if( rc==SQLITE_OK ){
pCtx->nSlot = nMax+1;
pCtx->nSlot = (i64)nMax+1;
rc = idxPrepareStmt(p->dbm, &pAllIndex, pzErr, zAllIndex);
}
if( rc==SQLITE_OK ){
@@ -2111,7 +2113,7 @@ int sqlite3_expert_sql(
if( pStmt ){
IdxStatement *pNew;
const char *z = sqlite3_sql(pStmt);
int n = STRLEN(z);
i64 n = STRLEN(z);
pNew = (IdxStatement*)idxMalloc(&rc, sizeof(IdxStatement) + n+1);
if( rc==SQLITE_OK ){
pNew->zSql = (char*)&pNew[1];
-4
View File
@@ -17,10 +17,6 @@
#include <string.h>
#include <assert.h>
#ifndef SQLITE_AMALGAMATION
typedef sqlite3_int64 i64;
#endif
/*
** Characters that may appear in the second argument to matchinfo().
*/
+7 -1
View File
@@ -81,7 +81,13 @@ typedef sqlite3_uint64 u64;
# define FLEXARRAY 1
#endif
#endif
#endif /* SQLITE_AMALGAMATION */
/*
** Constants for the largest and smallest possible 32-bit signed integers.
*/
# define LARGEST_INT32 ((int)(0x7fffffff))
# define SMALLEST_INT32 ((int)((-1) - LARGEST_INT32))
/* Truncate very long tokens to this many bytes. Hard limit is
** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset
+6 -5
View File
@@ -877,9 +877,9 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
if( rc==SQLITE_OK ){
u8 *aOut = 0; /* Read blob data into this buffer */
int nByte = sqlite3_blob_bytes(p->pReader);
int szData = (sizeof(Fts5Data) + 7) & ~7;
sqlite3_int64 nAlloc = szData + nByte + FTS5_DATA_PADDING;
i64 nByte = sqlite3_blob_bytes(p->pReader);
i64 szData = (sizeof(Fts5Data) + 7) & ~7;
i64 nAlloc = szData + nByte + FTS5_DATA_PADDING;
pRet = (Fts5Data*)sqlite3_malloc64(nAlloc);
if( pRet ){
pRet->nn = nByte;
@@ -2074,6 +2074,7 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
while( 1 ){
u64 iDelta = 0;
if( i>=n ) break;
if( eDetail==FTS5_DETAIL_NONE ){
/* todo */
if( i<n && a[i]==0 ){
@@ -5930,7 +5931,7 @@ int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge){
fts5StructureRelease(pStruct);
pStruct = pNew;
nMin = 1;
nMerge = nMerge*-1;
nMerge = (nMerge==SMALLEST_INT32 ? LARGEST_INT32 : (nMerge*-1));
}
if( pStruct && pStruct->nLevel ){
if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
@@ -6829,7 +6830,7 @@ int sqlite3Fts5IndexReinit(Fts5Index *p){
fts5StructureInvalidate(p);
fts5IndexDiscardData(p);
pTmp = &uFts.sFts;
memset(pTmp, 0, SZ_FTS5STRUCTURE(1));
memset(uFts.tmpSpace, 0, sizeof(uFts.tmpSpace));
if( p->pConfig->bContentlessDelete ){
pTmp->nOriginCntr = 1;
}
+5 -5
View File
@@ -657,7 +657,7 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
nSeenMatch++;
idxStr[iIdxStr++] = 'M';
sqlite3_snprintf(6, &idxStr[iIdxStr], "%d", iCol);
iIdxStr += strlen(&idxStr[iIdxStr]);
iIdxStr += (int)strlen(&idxStr[iIdxStr]);
assert( idxStr[iIdxStr]=='\0' );
}
pInfo->aConstraintUsage[i].argvIndex = ++iCons;
@@ -3621,9 +3621,9 @@ static void fts5LocaleFunc(
sqlite3_value **apArg /* Function arguments */
){
const char *zLocale = 0;
int nLocale = 0;
i64 nLocale = 0;
const char *zText = 0;
int nText = 0;
i64 nText = 0;
assert( nArg==2 );
UNUSED_PARAM(nArg);
@@ -3640,10 +3640,10 @@ static void fts5LocaleFunc(
Fts5Global *p = (Fts5Global*)sqlite3_user_data(pCtx);
u8 *pBlob = 0;
u8 *pCsr = 0;
int nBlob = 0;
i64 nBlob = 0;
nBlob = FTS5_LOCALE_HDR_SIZE + nLocale + 1 + nText;
pBlob = (u8*)sqlite3_malloc(nBlob);
pBlob = (u8*)sqlite3_malloc64(nBlob);
if( pBlob==0 ){
sqlite3_result_error_nomem(pCtx);
return;
+11
View File
@@ -396,7 +396,12 @@ static int fts5VocabOpenMethod(
return rc;
}
/*
** Restore cursor pCsr to the state it was in immediately after being
** created by the xOpen() method.
*/
static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
int nCol = pCsr->pFts5->pConfig->nCol;
pCsr->rowid = 0;
sqlite3Fts5IterClose(pCsr->pIter);
sqlite3Fts5StructureRelease(pCsr->pStruct);
@@ -406,6 +411,12 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
pCsr->nLeTerm = -1;
pCsr->zLeTerm = 0;
pCsr->bEof = 0;
pCsr->iCol = 0;
pCsr->iInstPos = 0;
pCsr->iInstOff = 0;
pCsr->colUsed = 0;
memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
}
/*
+33
View File
@@ -294,6 +294,39 @@ do_execsql_test 7.0 {
INSERT INTO x1 VALUES($doc);
}
#-------------------------------------------------------------------------
# Forum post: https://sqlite.org/forum/forumpost/ea4d8c9acb
#
reset_db
do_execsql_test 8.0 {
PRAGMA encoding = 'UTF-16le';
CREATE VIRTUAL TABLE vt0 USING fts5(c0);
}
set v [db one {SELECT x'2a12'}]
do_execsql_test 8.1 {
INSERT INTO vt0 VALUES ($v);
}
do_execsql_test 8.2 {
SELECT quote(c0) FROM vt0
} {X'2A12'}
do_execsql_test 8.3 {
INSERT INTO vt0(vt0) VALUES('integrity-check');
} {}
reset_db
do_execsql_test 8.4 {
PRAGMA encoding = 'UTF-16le';
CREATE VIRTUAL TABLE vt0 USING fts5(c0);
}
do_execsql_test 8.5 {
INSERT INTO vt0 VALUES (x'2a12');
}
do_execsql_test 8.6 {
SELECT quote(c0) FROM vt0
} {X'2A12'}
do_execsql_test 8.7 {
INSERT INTO vt0(vt0) VALUES('integrity-check');
} {}
} ;# foreach_detail_mode...
+362
View File
@@ -16124,5 +16124,367 @@ do_catchsql_test 83.1 {
SELECT * FROM t1('R*R*R*R*R*R*R*R*') WHERE (a,b)<=(current_date,0 BETWEEN 'a'<>11 AND '') ORDER BY rowid DESC;
} {/.*fts5: corruption found/}
#-------------------------------------------------------------------------
reset_db
do_test 84.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
.open --hexdb
| size 53248 pagesize 4096 filename c1a.txt.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 0d .....@ ........
| 32: 00 00 00 02 00 00 00 01 00 00 00 09 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
| 96: 00 00 00 00 0d 0f c7 00 07 0d 92 00 0f 8d 0f 36 ...............6
| 112: 0e cb 0e 6b 0e 0e 0d b6 0d 92 0d 92 00 00 00 00 ...k............
| 3472: 00 00 22 08 06 17 11 11 01 31 74 61 62 6c 65 74 .........1tablet
| 3488: 32 74 32 0d 43 52 45 41 54 45 20 54 41 42 4c 45 2t2.CREATE TABLE
| 3504: 20 74 32 28 78 29 56 07 06 17 1f 1f 01 7d 74 61 t2(x)V.......ta
| 3520: 62 6c 65 74 31 5f 63 6f 6e 66 69 67 74 31 5f 63 blet1_configt1_c
| 3536: 6f 6e 66 69 67 07 43 52 45 41 54 45 20 54 41 42 onfig.CREATE TAB
| 3552: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b LE 't1_config'(k
| 3568: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 PRIMARY KEY, v)
| 3584: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 06 WITHOUT ROWID[.
| 3600: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64 ..!!...tablet1_d
| 3616: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65 ocsizet1_docsize
| 3632: 06 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 .CREATE TABLE 't
| 3648: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 1_docsize'(id IN
| 3664: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 TEGER PRIMARY KE
| 3680: 59 2c 20 73 7a 20 42 4c 4f 42 29 5e 05 07 17 21 Y, sz BLOB)^...!
| 3696: 21 01 81 07 74 61 62 6c 65 74 31 5f 63 6f 6e 74 !...tablet1_cont
| 3712: 65 6e 74 74 31 5f 63 6f 6e 74 65 6e 74 05 43 52 entt1_content.CR
| 3728: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 EATE TABLE 't1_c
| 3744: 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47 ontent'(id INTEG
| 3760: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 ER PRIMARY KEY,
| 3776: 63 30 2c 20 63 31 2c 20 63 32 29 69 04 07 17 19 c0, c1, c2)i....
| 3792: 19 01 81 2d 74 61 62 6c 65 74 31 5f 69 64 78 74 ...-tablet1_idxt
| 3808: 31 5f 69 64 78 04 43 52 45 41 54 45 20 54 41 42 1_idx.CREATE TAB
| 3824: 4c 45 20 27 74 31 5f 69 64 78 27 28 73 65 67 69 LE 't1_idx'(segi
| 3840: 64 2c 20 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50 d, term, pgno, P
| 3856: 52 49 4d 41 52 59 20 4b 45 59 28 73 65 67 69 64 RIMARY KEY(segid
| 3872: 2c 20 74 65 72 6d 29 29 20 57 49 54 48 4f 55 54 , term)) WITHOUT
| 3888: 20 52 4f 57 49 44 55 03 07 17 1b 1b 01 81 01 74 ROWIDU........t
| 3904: 61 62 6c 65 74 31 5f 64 61 74 61 74 31 5f 64 61 ablet1_datat1_da
| 3920: 74 61 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 ta.CREATE TABLE
| 3936: 27 74 31 5f 64 61 74 61 27 28 69 64 20 49 4e 54 't1_data'(id INT
| 3952: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 EGER PRIMARY KEY
| 3968: 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 38 02 06 , block BLOB)8..
| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR
| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35 LE t1 USING fts5
| 4032: 28 61 2c 62 2c 63 29 00 00 00 39 00 00 00 00 00 (a,b,c)...9.....
| page 3 offset 8192
| 0: 05 00 00 00 02 0f f1 00 00 00 00 0c 0f fb 0f f1 ................
| 4064: 00 00 0b 01 03 00 1c 81 3a 84 5e 81 3a 81 3a 0a ........:.^.:.:.
| 4080: 0a 00 00 00 0b 84 80 80 80 80 01 00 00 00 0a 0a ................
| page 4 offset 12288
| 0: 0a 00 00 00 01 0f fa 00 0f fa 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................
| page 7 offset 24576
| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version.
| page 10 offset 36864
| 0: 0d 00 00 00 02 0f e2 00 0f e2 0f ef 00 00 00 00 ................
| 4064: 00 00 0b 01 03 00 1c 81 3a 84 5e 81 3a 81 3a 0f ........:.^.:.:.
| 4080: 0a 03 00 24 00 00 00 00 01 01 02 00 01 01 01 09 ...$............
| page 11 offset 40960
| 0: 0d 00 00 00 01 00 22 00 00 22 00 00 00 00 00 00 ................
| 32: 00 00 9f 56 84 80 80 80 80 01 04 00 bf 30 00 00 ...V.........0..
| 48: 0f 58 02 30 30 19 02 05 01 02 05 01 02 05 16 02 .X.00...........
| 64: 05 01 02 05 01 02 05 61 02 05 01 02 05 01 02 05 .......a........
| 80: 13 02 05 01 02 05 01 02 05 0d 02 03 01 02 03 01 ................
| 96: 02 03 02 09 78 66 66 66 66 66 66 66 65 81 17 02 ....xfffffffe...
| 112: 05 01 02 05 01 02 05 01 01 31 04 02 04 01 02 04 .........1......
| 128: 01 02 04 01 02 05 01 02 05 01 02 05 0d 02 06 01 ................
| 144: 02 06 01 02 06 02 01 30 79 02 04 01 02 04 01 02 .......0y.......
| 160: 04 03 02 30 30 2b 02 05 01 02 05 01 02 05 58 02 ...00+........X.
| 176: 05 01 02 05 01 02 05 01 02 05 01 02 05 01 02 05 ................
| 192: 16 02 05 01 02 05 01 02 05 05 06 30 30 30 30 30 ...........00000
| 208: 30 81 0b 02 04 01 02 04 01 02 04 10 02 05 01 02 0...............
| 224: 05 01 02 05 03 02 32 34 76 02 05 01 02 05 01 02 ......24v.......
| 240: 05 02 01 38 07 02 04 01 02 04 01 02 04 01 01 32 ...8...........2
| 256: 28 02 04 01 02 04 01 02 04 04 02 05 01 02 05 01 (...............
| 272: 02 05 02 01 30 1f 02 05 01 02 05 01 02 05 03 02 ....0...........
| 288: 30 30 10 02 05 01 02 05 01 02 05 6a 02 04 01 02 00.........j....
| 304: 04 01 02 04 02 08 35 30 30 30 30 30 30 30 81 26 ......50000000.&
| 320: 02 05 01 02 05 01 02 05 01 01 33 07 02 06 01 02 ..........3.....
| 336: 06 01 02 06 81 2c 02 04 01 02 04 01 02 04 02 04 .....,..........
| 352: 32 37 36 36 81 23 02 05 01 02 05 01 02 05 01 01 2766.#..........
| 368: 34 13 02 05 01 02 05 01 02 05 02 03 30 39 36 1c 4...........096.
| 384: 02 05 01 02 05 01 02 05 07 02 05 01 02 05 01 02 ................
| 400: 05 01 03 35 30 30 7f 02 05 01 02 05 01 02 05 04 ...500..........
| 416: 02 30 30 81 0e 02 06 01 02 06 01 02 06 06 03 30 .00............0
| 432: 30 30 81 11 02 04 01 02 04 01 02 04 01 05 36 35 00............65
| 448: 35 33 36 81 1a 02 05 01 02 05 01 02 05 01 04 38 536............8
| 464: 31 39 32 81 02 02 06 01 02 06 01 02 06 01 05 61 192............a
| 480: 6c 6c 6f 77 01 02 02 01 02 02 01 02 02 02 02 72 llow...........r
| 496: 67 81 08 02 04 01 02 04 01 02 04 02 05 74 6f 6d g............tom
| 512: 69 63 04 02 02 01 02 02 01 02 02 03 06 74 61 63 ic...........tac
| 528: 68 65 64 79 02 03 01 02 03 01 02 03 02 0d 75 74 hedy..........ut
| 544: 6f 63 68 65 63 6b 70 6f 69 6e 74 2b 02 04 01 02 ocheckpoint+....
| 560: 04 01 02 04 05 06 76 61 63 75 75 6d 0d 02 03 01 ......vacuum....
| 576: 02 03 01 02 03 01 06 62 69 6e 61 72 79 03 06 01 .......binary...
| 592: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 608: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 624: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 640: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 656: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 672: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 688: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 704: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 720: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 736: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 752: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 768: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 784: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 800: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 816: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 832: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 848: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 864: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 880: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 896: 01 02 02 02 07 79 74 65 63 6f 64 65 37 02 03 01 .....ytecode7...
| 912: 02 03 01 02 03 01 05 63 61 63 68 65 10 02 03 01 .......cache....
| 928: 02 03 01 01 03 02 04 6c 61 6e 67 07 02 03 01 02 .......lang.....
| 944: 03 01 02 03 02 05 6f 6c 75 6d 6e 7c 02 03 01 02 ......olumn|....
| 960: 03 01 02 03 03 06 6d 6d 65 6e 74 73 43 02 04 01 ......mmentsC...
| 976: 02 04 01 02 04 04 05 70 69 6c 65 72 07 02 02 01 .......piler....
| 992: 02 02 01 02 02 05 04 6f 75 6e 64 7f 02 03 01 02 .......ound.....
| 1008: 03 01 02 03 03 03 75 6e 74 81 17 02 04 01 02 04 ......unt.......
| 1024: 01 02 04 02 05 75 72 73 6f 72 3a 02 03 01 02 03 .....ursor:.....
| 1040: 01 02 03 01 06 64 62 70 61 67 65 3d 02 03 01 02 .....dbpage=....
| 1056: 03 01 02 03 03 04 73 74 61 74 40 02 03 01 02 03 ......stat@.....
| 1072: 01 02 03 02 04 65 62 75 67 0a 02 02 01 02 02 01 .....ebug.......
| 1088: 02 02 03 05 66 61 75 6c 74 0d 02 02 01 02 02 01 ....fault.......
| 1104: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1120: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1136: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1152: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1168: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1184: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1200: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 4f 02 ..............O.
| 1216: 03 01 02 03 01 02 03 03 03 70 74 68 81 05 02 04 .........pth....
| 1232: 01 02 04 01 02 04 19 02 04 01 02 04 01 02 04 02 ................
| 1248: 05 69 72 65 63 74 34 02 02 01 02 02 01 02 02 01 .irect4.........
| 1264: 06 65 6e 61 62 6c 65 37 02 02 01 02 02 01 02 02 .enable7........
| 1280: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1296: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1312: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1328: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1344: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1360: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1376: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1392: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1408: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1424: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1440: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1456: 02 01 02 02 02 06 78 70 6c 61 69 6e 43 02 03 01 ......xplainC...
| 1472: 02 03 01 02 03 04 01 72 81 05 02 03 01 02 03 01 .......r........
| 1488: 02 03 03 07 74 65 6e 73 69 6f 6e 81 2f 02 04 01 ....tension./...
| 1504: 02 04 01 02 04 01 04 66 69 6c 65 13 02 03 01 02 .......file.....
| 1520: 03 01 02 03 02 05 6f 72 6d 61 74 13 02 04 01 02 ......ormat.....
| 1536: 04 01 02 04 02 03 74 73 33 46 02 03 01 02 03 01 ......ts3F......
| 1552: 02 03 01 02 03 01 02 03 01 02 03 04 01 34 4c 02 .............4L.
| 1568: 03 01 02 03 01 02 03 04 01 35 4f 02 03 01 02 03 .........5O.....
| 1584: 01 02 03 02 03 75 6e 63 5e 02 05 01 02 05 01 02 .....unc^.......
| 1600: 05 05 04 74 69 6f 6e 73 02 05 01 02 05 01 02 05 ...tions........
| 1616: 13 02 03 01 02 03 01 02 03 09 01 73 55 02 04 01 ...........sU...
| 1632: 02 04 01 02 04 01 07 67 65 6f 70 6f 6c 79 52 02 .......geopolyR.
| 1648: 03 01 02 03 01 02 03 01 05 68 69 6e 74 73 3a 02 .........hints:.
| 1664: 04 01 02 04 01 02 04 02 03 6f 6f 6b 61 02 04 01 .........ooka...
| 1680: 02 04 01 02 04 01 02 69 6e 01 02 04 01 02 04 01 .......in.......
| 1696: 02 04 03 04 69 74 73 7a 1f 02 04 01 02 04 01 02 ....itsz........
| 1712: 04 03 08 74 72 69 6e 73 69 63 73 04 02 03 01 02 ...trinsics.....
| 1728: 03 01 02 03 01 07 6a 6f 75 72 6e 61 6c 16 02 03 ......journal...
| 1744: 01 02 03 01 02 03 01 06 6c 65 6e 67 74 68 81 0b ........length..
| 1760: 02 03 01 02 03 01 02 03 01 02 05 01 02 05 01 02 ................
| 1776: 05 0d 02 04 01 02 04 01 02 04 02 03 69 6b 65 81 ............ike.
| 1792: 0e 02 03 01 02 03 01 02 03 03 03 6d 69 74 16 02 ...........mit..
| 1808: 05 01 02 05 01 02 05 5e 02 04 01 02 04 01 02 04 .......^........
| 1824: 02 03 6f 61 64 81 2f 02 03 01 02 03 01 02 03 01 ..oad./.........
| 1840: 06 6d 61 6c 6c 6f 63 76 02 02 01 02 02 01 02 02 .mallocv........
| 1856: 3a 02 03 01 02 03 01 02 03 03 02 74 68 55 02 03 :..........thU..
| 1872: 01 02 03 01 02 03 03 01 78 79 02 02 01 02 02 01 ........xy......
| 1888: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1904: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1920: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1936: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1952: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1968: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1984: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 2000: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 2016: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 2032: 02 02 02 05 65 6d 6f 72 79 81 11 02 03 01 02 03 ....emory.......
| 2048: 01 02 03 04 04 73 79 73 35 58 02 03 01 02 03 01 .....sys5X......
| 2064: 02 03 02 03 6d 61 70 19 02 03 01 02 03 01 02 03 ....map.........
| 2080: 79 02 03 01 02 03 01 02 03 02 04 75 74 65 78 81 y..........utex.
| 2096: 2c 02 02 01 02 02 01 02 02 01 06 6e 6f 63 61 73 ,..........nocas
| 2112: 65 02 06 01 02 02 03 06 01 02 02 03 06 01 02 02 e...............
| 2128: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2144: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2160: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2176: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2192: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2208: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2224: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2240: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2256: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2272: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2288: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2304: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2320: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2336: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2352: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2368: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2384: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2400: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2416: 02 02 03 06 01 02 02 03 07 72 6d 61 6c 69 7a 65 .........rmalize
| 2432: 5b 02 03 01 02 03 01 02 03 02 05 75 6d 62 65 72 [..........umber
| 2448: 81 23 02 04 01 02 04 01 02 04 01 06 6f 66 66 73 .#..........offs
| 2464: 65 74 5e 02 03 01 02 03 01 02 03 02 03 6d 69 74 et^..........mit
| 2480: 81 2c 02 03 01 02 03 01 02 03 01 02 02 01 02 02 .,..............
| 2496: 01 02 02 02 01 70 81 26 02 04 01 02 04 01 02 04 .....p.&........
| 2512: 02 07 76 65 72 66 6c 6f 77 34 02 03 01 02 03 01 ..verflow4......
| 2528: 02 03 01 04 70 61 67 65 1c 02 03 01 02 03 01 02 ....page........
| 2544: 03 64 02 04 01 02 04 01 02 04 13 02 03 01 02 03 .d..............
| 2560: 01 02 03 01 02 03 01 02 03 01 02 03 03 09 72 65 ..............re
| 2576: 6e 74 68 65 73 69 73 49 02 04 01 02 04 01 02 04 nthesisI........
| 2592: 03 05 74 74 65 72 6e 81 0e 02 04 01 02 04 01 02 ..ttern.........
| 2608: 04 02 05 63 61 63 68 65 1f 02 03 01 02 03 01 02 ...cache........
| 2624: 03 02 08 72 65 75 70 64 61 74 65 61 02 03 01 02 ...reupdatea....
| 2640: 03 01 02 03 01 04 72 65 61 64 34 02 04 01 02 04 ......read4.....
| 2656: 01 02 04 03 07 63 75 72 73 69 76 65 22 02 03 01 .....cursive....
| 2672: 02 03 01 02 03 02 04 6f 77 69 64 01 02 03 01 02 .......owid.....
| 2688: 03 01 02 03 02 04 74 72 65 65 64 02 03 01 02 03 ......treed.....
| 2704: 01 02 03 04 02 69 6d 01 06 01 02 02 03 06 01 02 .....im.........
| 2720: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2736: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2752: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2768: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2784: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2800: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2816: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2832: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2848: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2864: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2880: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2896: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2912: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2928: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2944: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2960: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2976: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2992: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 3008: 01 02 02 03 06 01 02 02 03 06 01 02 02 01 0a 73 ...............s
| 3024: 63 61 6e 73 74 61 74 75 73 70 02 04 01 02 04 01 canstatusp......
| 3040: 02 04 02 05 65 63 74 6f 72 25 02 03 01 02 03 01 ....ector%......
| 3056: 02 03 03 04 6c 65 63 74 7f 02 04 01 02 04 01 02 ....lect........
| 3072: 04 03 05 73 73 69 6f 6e 67 02 03 01 02 03 01 02 ...ssiong.......
| 3088: 03 02 03 69 7a 65 10 02 04 01 02 04 01 02 04 04 ...ize..........
| 3104: 02 04 01 02 04 01 02 04 01 02 04 01 02 04 01 02 ................
| 3120: 04 01 02 04 01 02 04 01 02 04 07 02 04 01 02 04 ................
| 3136: 01 02 04 5b 02 05 01 02 05 01 02 05 10 02 04 01 ...[............
| 3152: 02 04 01 02 04 04 02 04 01 02 04 01 02 04 02 03 ................
| 3168: 6f 66 74 76 02 03 01 02 03 01 02 03 02 02 71 6c oftv..........ql
| 3184: 5e 02 04 01 02 04 01 02 04 13 02 04 01 02 04 01 ^...............
| 3200: 02 04 28 02 03 01 02 03 01 02 03 02 04 74 61 74 ..(..........tat
| 3216: 34 6a 02 03 01 02 03 01 02 03 03 02 6d 74 70 02 4j..........mtp.
| 3232: 03 01 02 03 01 02 03 05 04 76 74 61 62 6d 02 03 .........vtabm..
| 3248: 01 02 03 01 02 03 03 03 6f 72 65 81 35 02 03 01 ........ore.5...
| 3264: 02 03 01 02 03 02 0a 79 6e 63 68 72 6f 6e 6f 75 .......ynchronou
| 3280: 73 28 02 03 01 02 03 01 02 03 04 02 04 01 02 04 s(..............
| 3296: 01 02 04 03 04 73 74 65 6d 81 32 02 02 01 02 02 .....stem.2.....
| 3312: 01 02 02 01 04 74 65 6d 70 81 35 02 02 01 02 02 .....temp.5.....
| 3328: 01 02 02 02 06 68 72 65 61 64 73 31 02 04 01 02 .....hreads1....
| 3344: 04 01 02 04 76 02 04 01 02 04 01 02 04 08 03 61 ....v..........a
| 3360: 66 65 81 38 02 02 01 02 02 01 02 02 02 06 72 69 fe.8..........ri
| 3376: 67 67 65 72 81 20 02 03 01 02 03 01 02 03 08 01 gger. ..........
| 3392: 73 22 02 04 01 02 04 01 02 04 01 07 75 6e 6b 6e s...........unkn
| 3408: 6f 77 6e 73 02 03 01 02 03 01 02 03 01 08 76 61 owns..........va
| 3424: 72 69 61 62 6c 65 81 23 02 03 01 02 03 01 02 03 riable.#........
| 3440: 02 03 64 62 65 81 26 02 03 01 02 03 01 02 03 02 ..dbe.&.........
| 3456: 03 69 65 77 01 02 05 01 02 05 01 02 05 02 03 74 .iew...........t
| 3472: 61 62 37 02 04 01 02 04 01 02 04 04 02 04 01 02 ab7.............
| 3488: 04 01 02 04 01 02 04 01 02 04 01 02 04 01 03 77 ...............w
| 3504: 61 6c 2b 02 03 01 02 03 01 02 03 01 02 03 01 02 al+.............
| 3520: 03 01 02 03 02 05 6f 72 6b 65 72 31 02 03 01 02 ......orker1....
| 3536: 03 01 02 03 76 02 03 01 02 03 01 02 03 01 01 78 ....v..........x
| 3552: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3568: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3584: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3600: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3616: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3632: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3648: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3664: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3680: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3696: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3712: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3728: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3744: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3760: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3776: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3792: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3808: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3824: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3840: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3856: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3872: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3888: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3904: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3920: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3936: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3952: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3968: 06 01 01 02 01 06 04 30 15 1e 0c 28 1b 0d 0c 15 .......0...(....
| 3984: 0c 16 14 16 10 0c 17 0e 0e 0f 11 10 10 0e 10 11 ................
| 4000: 18 11 82 3e 12 10 0f 10 11 10 0f 0f 10 11 0f 0f ...>............
| 4016: 81 05 18 10 81 45 11 0d 13 0f 10 17 0c 0c 0e 18 .....E..........
| 4032: 0c 12 10 0e 0d 0f 13 12 24 0f 17 0f 1a 0d 81 1c ........$.......
| 4048: 11 0f 17 10 82 3e 12 11 11 18 0d 12 2a 14 11 10 .....>......*...
| 4064: 13 0f 12 0f 0f 82 3a 15 10 0f 10 4d 0e 1f 0f 0d ......:....M....
| 4080: 0f 0f 1e 10 10 1a 0f 12 0c 12 14 0f 0e 20 17 19 ............. ..
| page 12 offset 45056
| 0: 0d 00 00 00 01 0d f4 00 0d f4 00 00 00 00 00 00 ................
| 3568: 00 00 00 00 84 04 84 80 80 80 80 02 04 00 88 0c ................
| 3584: 00 07 02 00 01 01 02 56 06 01 01 02 01 06 01 01 .......V........
| 3600: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3616: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3632: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3648: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3664: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3680: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3696: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3712: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3728: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3744: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3760: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3776: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3792: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3808: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3824: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3840: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3856: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3872: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3888: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3904: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3920: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3936: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3952: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3968: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3984: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 4000: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 4016: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 4032: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 4048: 52 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 R...............
| 4064: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 4080: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| end c1a.txt.db
}]} {}
do_catchsql_test 84.1 {
SELECT * FROM t1('R*R*x') ORDER BY rowid DESC;
} {1 {fts5: corruption found reading blob 137438953475 from table "t1"}}
sqlite3_fts5_may_be_corrupt 0
finish_test
+53
View File
@@ -0,0 +1,53 @@
# 2025 October 13
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This test is focused on really large position lists. Those that require
# 4 or 5 byte position-list size varints. Because of the amount of memory
# required, these tests only run on 64-bit platforms.
#
source [file join [file dirname [info script]] fts5_common.tcl]
set testprefix fts5corruptbig
# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
ifcapable !fts5 {
finish_test
return
}
if { $tcl_platform(wordSize)<8 } {
finish_test
return
}
if { $SQLITE_MAX_LENGTH!=0x7FFFFFFF } {
finish_test
return
}
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE t1 USING fts5(x);
}
do_execsql_test 1.1 {
UPDATE t1_data SET block = zeroblob(2147483640) WHERE id=10;
}
do_execsql_test 1.2 {
SELECT id, length(block) FROM t1_data
} {1 0 10 2147483640}
do_catchsql_test 1.3 {
SELECT * FROM t1('abc')
} {1 {out of memory}}
finish_test
+16
View File
@@ -238,6 +238,22 @@ do_execsql_test 6.3 {
INSERT INTO g1(g1) VALUES('integrity-check');
}
#--------------------------------------------------------------------------
# Check that passing -2147483648 as the parameter to a merge command
# does not cause a signed integer overflow error.
#
reset_db
do_execsql_test 7.0 {
CREATE VIRTUAL TABLE f1 USING fts5(a);
}
do_execsql_test 7.1 {
INSERT INTO f1 VALUES('one two three');
INSERT INTO f1 VALUES('four five six');
INSERT INTO f1 VALUES('seven eight nine');
}
do_execsql_test 7.2 {
INSERT INTO f1(f1, rank) VALUES('merge', -2147483648);
}
finish_test
+22
View File
@@ -305,6 +305,28 @@ do_catchsql_test 6.2 {
sqlite3_fts5_may_be_corrupt 0
#-------------------------------------------------------------------------
reset_db
do_execsql_test 7.0 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, col);
INSERT INTO t1 VALUES('xx', 'xx');
CREATE TABLE x1(t);
INSERT INTO x1 VALUES('xx');
INSERT INTO x1 VALUES('xx');
SELECT term, col FROM v1;
} {
xx a xx b
}
do_execsql_test 7.1 {
SELECT * FROM x1 WHERE 'a'=(SELECT col FROM v1 WHERE term=t)
} {xx xx}
finish_test
+2
View File
@@ -139,6 +139,7 @@ do_test 2.3 {
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 0 0
db eval {
PRAGMA writable_schema=on;
DELETE FROM imp1 WHERE rowid=1;
DELETE FROM imp2 WHERE rowid=2;
}
@@ -174,6 +175,7 @@ do_test 3.2 {
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 0 0
db eval {
PRAGMA writable_schema=on;
DELETE FROM imp1 WHERE a=5;
}
execsql_pp {
+1
View File
@@ -29,6 +29,7 @@ do_execsql_test 1.0 {
proc imposter_edit {obj create sql} {
sqlite3 xdb test.db
set pgno [xdb one {SELECT rootpage FROM sqlite_schema WHERE name=$obj}]
xdb eval {PRAGMA Writable_schema=ON}
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER xdb main 1 $pgno
xdb eval $create
+1
View File
@@ -160,6 +160,7 @@ static char *intckMprintf(sqlite3_intck *p, const char *zFmt, ...){
sqlite3_free(zRet);
zRet = 0;
}
va_end(ap);
return zRet;
}
-10
View File
@@ -9,11 +9,6 @@ Each source file contains a description in its header comment. See the
header comments for details about each extension. Additional notes are
as follows:
* **carray.c** &mdash; This module implements the
[carray](https://sqlite.org/carray.html) table-valued function.
It is a good example of how to go about implementing a custom
[table-valued function](https://sqlite.org/vtab.html#tabfunc2).
* **csv.c** &mdash; A [virtual table](https://sqlite.org/vtab.html)
for reading
[Comma-Separated-Value (CSV) files](https://en.wikipedia.org/wiki/Comma-separated_values).
@@ -28,11 +23,6 @@ as follows:
[SQLite amalgamation](https://sqlite.org/amalgamation.html). See
<https://sqlite.org/json1.html> for additional information.
* **memvfs.c** &mdash; This file implements a custom
[VFS](https://sqlite.org/vfs.html) that stores an entire database
file in a single block of RAM. It serves as a good example of how
to implement a simple custom VFS.
* **rot13.c** &mdash; This file implements the very simple rot13()
substitution function. This file makes a good template for implementing
new custom SQL functions for SQLite.
+5 -5
View File
@@ -514,7 +514,7 @@ struct amatch_cursor {
sqlite3_int64 iRowid; /* The rowid of the current word */
amatch_langid iLang; /* Use this language ID */
amatch_cost rLimit; /* Maximum cost of any term */
int nBuf; /* Space allocated for zBuf */
sqlite3_int64 nBuf; /* Space allocated for zBuf */
int oomErr; /* True following an OOM error */
int nWord; /* Number of amatch_word objects */
char *zBuf; /* Temp-use buffer space */
@@ -1039,7 +1039,7 @@ static void amatchAddWord(
nTail = (int)strlen(zWordTail);
if( nBase+nTail+3>pCur->nBuf ){
pCur->nBuf = nBase+nTail+100;
pCur->zBuf = sqlite3_realloc(pCur->zBuf, pCur->nBuf);
pCur->zBuf = sqlite3_realloc64(pCur->zBuf, pCur->nBuf);
if( pCur->zBuf==0 ){
pCur->nBuf = 0;
return;
@@ -1105,13 +1105,13 @@ static int amatchNext(sqlite3_vtab_cursor *cur){
amatch_avl *pNode;
int isMatch = 0;
amatch_vtab *p = pCur->pVtab;
int nWord;
sqlite3_int64 nWord;
int rc;
int i;
const char *zW;
amatch_rule *pRule;
char *zBuf = 0;
char nBuf = 0;
sqlite3_int64 nBuf = 0;
char zNext[8];
char zNextIn[8];
int nNextIn;
@@ -1158,7 +1158,7 @@ static int amatchNext(sqlite3_vtab_cursor *cur){
nWord = (int)strlen(pWord->zWord+2);
if( nWord+20>nBuf ){
nBuf = (char)(nWord+100);
zBuf = sqlite3_realloc(zBuf, nBuf);
zBuf = sqlite3_realloc64(zBuf, nBuf);
if( zBuf==0 ) return SQLITE_NOMEM;
}
amatchStrcpy(zBuf, pWord->zWord+2);
+4 -2
View File
@@ -207,7 +207,9 @@ static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){
/* This function does the work for the SQLite base64(x) UDF. */
static void base64(sqlite3_context *context, int na, sqlite3_value *av[]){
int nb, nc, nv = sqlite3_value_bytes(av[0]);
sqlite3_int64 nb;
sqlite3_int64 nv = sqlite3_value_bytes(av[0]);
sqlite3_int64 nc;
int nvMax = sqlite3_limit(sqlite3_context_db_handle(context),
SQLITE_LIMIT_LENGTH, -1);
char *cBuf;
@@ -216,7 +218,7 @@ static void base64(sqlite3_context *context, int na, sqlite3_value *av[]){
switch( sqlite3_value_type(av[0]) ){
case SQLITE_BLOB:
nb = nv;
nc = 4*(nv+2/3); /* quads needed */
nc = 4*((nv+2)/3); /* quads needed */
nc += (nc+(B64_DARK_MAX-1))/B64_DARK_MAX + 1; /* LFs and a 0-terminator */
if( nvMax < nc ){
sqlite3_result_error(context, "blob expanded to base64 too big", -1);
+1 -1
View File
@@ -286,7 +286,7 @@ static void is_base85(sqlite3_context *context, int na, sqlite3_value *av[]){
/* This function does the work for the SQLite base85(x) UDF. */
static void base85(sqlite3_context *context, int na, sqlite3_value *av[]){
int nb, nc, nv = sqlite3_value_bytes(av[0]);
sqlite3_int64 nb, nc, nv = sqlite3_value_bytes(av[0]);
int nvMax = sqlite3_limit(sqlite3_context_db_handle(context),
SQLITE_LIMIT_LENGTH, -1);
char *cBuf;
-50
View File
@@ -1,50 +0,0 @@
/*
** 2020-11-17
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
**
** Interface definitions for the CARRAY table-valued function
** extension.
*/
#ifndef _CARRAY_H
#define _CARRAY_H
#include "sqlite3.h" /* Required for error code definitions */
#ifdef __cplusplus
extern "C" {
#endif
/* Use this interface to bind an array to the single-argument version
** of CARRAY().
*/
SQLITE_API int sqlite3_carray_bind(
sqlite3_stmt *pStmt, /* Statement to be bound */
int i, /* Parameter index */
void *aData, /* Pointer to array data */
int nData, /* Number of data elements */
int mFlags, /* CARRAY flags */
void (*xDel)(void*) /* Destructor for aData */
);
/* Allowed values for the mFlags parameter to sqlite3_carray_bind().
*/
#define CARRAY_INT32 0 /* Data is 32-bit signed integers */
#define CARRAY_INT64 1 /* Data is 64-bit signed integers */
#define CARRAY_DOUBLE 2 /* Data is doubles */
#define CARRAY_TEXT 3 /* Data is char* */
#define CARRAY_BLOB 4 /* Data is struct iovec */
#ifdef __cplusplus
} /* end of the 'extern "C"' block */
#endif
#endif /* ifndef _CARRAY_H */
+3
View File
@@ -370,6 +370,7 @@ static int completionFilter(
if( pCur->nPrefix>0 ){
pCur->zPrefix = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
pCur->nPrefix = (int)strlen(pCur->zPrefix);
}
iArg = 1;
}
@@ -378,6 +379,7 @@ static int completionFilter(
if( pCur->nLine>0 ){
pCur->zLine = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
if( pCur->zLine==0 ) return SQLITE_NOMEM;
pCur->nLine = (int)strlen(pCur->zLine);
}
}
if( pCur->zLine!=0 && pCur->zPrefix==0 ){
@@ -389,6 +391,7 @@ static int completionFilter(
if( pCur->nPrefix>0 ){
pCur->zPrefix = sqlite3_mprintf("%.*s", pCur->nPrefix, pCur->zLine + i);
if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
pCur->nPrefix = (int)strlen(pCur->zPrefix);
}
}
pCur->iRowid = 0;
+2 -2
View File
@@ -59,7 +59,7 @@ static void compressFunc(
pIn = sqlite3_value_blob(argv[0]);
nIn = sqlite3_value_bytes(argv[0]);
nOut = 13 + nIn + (nIn+999)/1000;
pOut = sqlite3_malloc( nOut+5 );
pOut = sqlite3_malloc64( nOut+5 );
for(i=4; i>=0; i--){
x[i] = (nIn >> (7*(4-i)))&0x7f;
}
@@ -98,7 +98,7 @@ static void uncompressFunc(
nOut = (nOut<<7) | (pIn[i]&0x7f);
if( (pIn[i]&0x80)!=0 ){ i++; break; }
}
pOut = sqlite3_malloc( nOut+1 );
pOut = sqlite3_malloc64( nOut+1 );
rc = uncompress(pOut, &nOut, &pIn[i], nIn-i);
if( rc==Z_OK ){
sqlite3_result_blob(context, pOut, nOut, sqlite3_free);
+7 -5
View File
@@ -62,6 +62,9 @@ SQLITE_EXTENSION_INIT1
# define CSV_NOINLINE
#endif
#ifndef SQLITEINT_H
typedef sqlite3_int64 i64;
#endif
/* Max size of the error message in a CsvReader */
#define CSV_MXERR 200
@@ -74,9 +77,9 @@ typedef struct CsvReader CsvReader;
struct CsvReader {
FILE *in; /* Read the CSV text from this input stream */
char *z; /* Accumulated text for a field */
int n; /* Number of bytes in z */
int nAlloc; /* Space allocated for z[] */
int nLine; /* Current line number */
i64 n; /* Number of bytes in z */
i64 nAlloc; /* Space allocated for z[] */
i64 nLine; /* Current line number */
int bNotFirst; /* True if prior text has been seen */
int cTerm; /* Character that terminated the most recent field */
size_t iIn; /* Next unread character in the input buffer */
@@ -174,7 +177,7 @@ static int csv_getc(CsvReader *p){
** Return 0 on success and non-zero if there is an OOM error */
static CSV_NOINLINE int csv_resize_and_append(CsvReader *p, char c){
char *zNew;
int nNew = p->nAlloc*2 + 100;
i64 nNew = p->nAlloc*2 + 100;
zNew = sqlite3_realloc64(p->z, nNew);
if( zNew ){
p->z = zNew;
@@ -510,7 +513,6 @@ static int csvtabConnect(
# define CSV_DATA (azPValue[1])
# define CSV_SCHEMA (azPValue[2])
assert( sizeof(azPValue)==sizeof(azParam) );
memset(&sRdr, 0, sizeof(sRdr));
memset(azPValue, 0, sizeof(azPValue));
+6 -6
View File
@@ -67,9 +67,9 @@ struct DState {
*/
typedef struct DText DText;
struct DText {
char *z; /* The text */
int n; /* Number of bytes of content in z[] */
int nAlloc; /* Number of bytes allocated to z[] */
char *z; /* The text */
sqlite3_int64 n; /* Number of bytes of content in z[] */
sqlite3_int64 nAlloc; /* Number of bytes allocated to z[] */
};
/*
@@ -107,7 +107,7 @@ static void appendText(DText *p, char const *zAppend, char quote){
if( p->n+len>=p->nAlloc ){
char *zNew;
p->nAlloc = p->nAlloc*2 + len + 20;
zNew = sqlite3_realloc(p->z, p->nAlloc);
zNew = sqlite3_realloc64(p->z, p->nAlloc);
if( zNew==0 ){
freeText(p);
return;
@@ -179,8 +179,8 @@ static char **tableColumnList(DState *p, const char *zTab){
char **azCol = 0;
sqlite3_stmt *pStmt = 0;
char *zSql;
int nCol = 0;
int nAlloc = 0;
sqlite3_int64 nCol = 0;
sqlite3_int64 nAlloc = 0;
int nPK = 0; /* Number of PRIMARY KEY columns seen */
int isIPK = 0; /* True if one PRIMARY KEY column of type INTEGER */
int preserveRowid = 1;
+23 -8
View File
@@ -128,7 +128,8 @@ static Decimal *decimalNewFromText(const char *zIn, int n){
}
}
if( iExp>0 ){
p->a = sqlite3_realloc64(p->a, p->nDigit + iExp + 1 );
p->a = sqlite3_realloc64(p->a, (sqlite3_int64)p->nDigit
+ (sqlite3_int64)iExp + 1 );
if( p->a==0 ) goto new_from_text_failed;
memset(p->a+p->nDigit, 0, iExp);
p->nDigit += iExp;
@@ -147,7 +148,8 @@ static Decimal *decimalNewFromText(const char *zIn, int n){
}
}
if( iExp>0 ){
p->a = sqlite3_realloc64(p->a, p->nDigit + iExp + 1 );
p->a = sqlite3_realloc64(p->a, (sqlite3_int64)p->nDigit
+ (sqlite3_int64)iExp + 1 );
if( p->a==0 ) goto new_from_text_failed;
memmove(p->a+iExp, p->a, p->nDigit);
memset(p->a, 0, iExp);
@@ -155,6 +157,10 @@ static Decimal *decimalNewFromText(const char *zIn, int n){
p->nFrac += iExp;
}
}
if( p->sign ){
for(i=0; i<p->nDigit && p->a[i]==0; i++){}
if( i>=p->nDigit ) p->sign = 0;
}
return p;
new_from_text_failed:
@@ -247,7 +253,7 @@ static void decimal_result(sqlite3_context *pCtx, Decimal *p){
sqlite3_result_null(pCtx);
return;
}
z = sqlite3_malloc( p->nDigit+4 );
z = sqlite3_malloc64( (sqlite3_int64)p->nDigit+4 );
if( z==0 ){
sqlite3_result_error_nomem(pCtx);
return;
@@ -312,7 +318,7 @@ static void decimal_result_sci(sqlite3_context *pCtx, Decimal *p){
for(nZero=0; nZero<nDigit && p->a[nZero]==0; nZero++){}
nFrac = p->nFrac + (nDigit - p->nDigit);
nDigit -= nZero;
z = sqlite3_malloc( nDigit+20 );
z = sqlite3_malloc64( (sqlite3_int64)nDigit+20 );
if( z==0 ){
sqlite3_result_error_nomem(pCtx);
return;
@@ -357,13 +363,21 @@ static void decimal_result_sci(sqlite3_context *pCtx, Decimal *p){
** pB!=0
** pB->isNull==0
*/
static int decimal_cmp(const Decimal *pA, const Decimal *pB){
static int decimal_cmp(Decimal *pA, Decimal *pB){
int nASig, nBSig, rc, n;
while( pA->nFrac>0 && pA->a[pA->nDigit-1]==0 ){
pA->nDigit--;
pA->nFrac--;
}
while( pB->nFrac>0 && pB->a[pB->nDigit-1]==0 ){
pB->nDigit--;
pB->nFrac--;
}
if( pA->sign!=pB->sign ){
return pA->sign ? -1 : +1;
}
if( pA->sign ){
const Decimal *pTemp = pA;
Decimal *pTemp = pA;
pA = pB;
pB = pTemp;
}
@@ -525,7 +539,8 @@ static void decimalMul(Decimal *pA, Decimal *pB){
){
goto mul_end;
}
acc = sqlite3_malloc64( pA->nDigit + pB->nDigit + 2 );
acc = sqlite3_malloc64( (sqlite3_int64)pA->nDigit +
(sqlite3_int64)pB->nDigit + 2 );
if( acc==0 ){
pA->oom = 1;
goto mul_end;
@@ -612,7 +627,7 @@ static Decimal *decimalFromDouble(double r){
isNeg = 0;
}
memcpy(&a,&r,sizeof(a));
if( a==0 ){
if( a==0 || a==(sqlite3_int64)0x8000000000000000LL){
e = 0;
m = 0;
}else{
+2 -1
View File
@@ -329,6 +329,7 @@ static int fileStat(
b1[sz] = 0;
rc = _wstat(b1, pStatBuf);
if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
sqlite3_free(b1);
return rc;
#else
return stat(zPath, pStatBuf);
@@ -760,7 +761,7 @@ static int fsdirNext(sqlite3_vtab_cursor *cur){
pCur->zPath = 0;
pLvl->pDir = opendir(pLvl->zDir);
if( pLvl->pDir==0 ){
fsdirSetErrmsg(pCur, "cannot read directory: %s", pCur->zPath);
fsdirSetErrmsg(pCur, "cannot read directory: %s", pLvl->zDir);
return SQLITE_ERROR;
}
}
+23 -9
View File
@@ -27,7 +27,7 @@
** This delta format is used by the RBU extension, which is the main
** reason that these routines are included in the extension library.
** RBU does not use this extension directly. Rather, this extension is
** provided as a convenience to developers who want to analyze RBU files
** provided as a convenience to developers who want to analyze RBU files
** that contain deltas.
*/
#include <string.h>
@@ -868,11 +868,21 @@ static int deltaparsevtabNext(sqlite3_vtab_cursor *cur){
int i = 0;
pCur->iCursor = pCur->iNext;
if( pCur->iCursor >= pCur->nDelta ){
pCur->eOp = DELTAPARSE_OP_ERROR;
pCur->iNext = pCur->nDelta;
return SQLITE_OK;
}
z = pCur->aDelta + pCur->iCursor;
pCur->a1 = deltaGetInt(&z, &i);
switch( z[0] ){
case '@': {
z++;
if( pCur->iNext>=pCur->nDelta ){
pCur->eOp = DELTAPARSE_OP_ERROR;
pCur->iNext = pCur->nDelta;
break;
}
pCur->a2 = deltaGetInt(&z, &i);
pCur->eOp = DELTAPARSE_OP_COPY;
pCur->iNext = (int)(&z[1] - pCur->aDelta);
@@ -926,8 +936,12 @@ static int deltaparsevtabColumn(
if( pCur->eOp==DELTAPARSE_OP_COPY ){
sqlite3_result_int(ctx, pCur->a2);
}else if( pCur->eOp==DELTAPARSE_OP_INSERT ){
sqlite3_result_blob(ctx, pCur->aDelta+pCur->a2, pCur->a1,
SQLITE_TRANSIENT);
if( pCur->a2 + pCur->a1 > pCur->nDelta ){
sqlite3_result_zeroblob(ctx, pCur->a1);
}else{
sqlite3_result_blob(ctx, pCur->aDelta+pCur->a2, pCur->a1,
SQLITE_TRANSIENT);
}
}
break;
}
@@ -955,17 +969,17 @@ static int deltaparsevtabRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
*/
static int deltaparsevtabEof(sqlite3_vtab_cursor *cur){
deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur;
return pCur->eOp==DELTAPARSE_OP_EOF;
return pCur->eOp==DELTAPARSE_OP_EOF || pCur->iCursor>=pCur->nDelta;
}
/*
** This method is called to "rewind" the deltaparsevtab_cursor object back
** to the first row of output. This method is always called at least
** once prior to any call to deltaparsevtabColumn() or deltaparsevtabRowid() or
** once prior to any call to deltaparsevtabColumn() or deltaparsevtabRowid() or
** deltaparsevtabEof().
*/
static int deltaparsevtabFilter(
sqlite3_vtab_cursor *pVtabCursor,
sqlite3_vtab_cursor *pVtabCursor,
int idxNum, const char *idxStr,
int argc, sqlite3_value **argv
){
@@ -1031,7 +1045,7 @@ static int deltaparsevtabBestIndex(
}
/*
** This following structure defines all the methods for the
** This following structure defines all the methods for the
** virtual table.
*/
static sqlite3_module deltaparsevtabModule = {
@@ -1068,8 +1082,8 @@ static sqlite3_module deltaparsevtabModule = {
__declspec(dllexport)
#endif
int sqlite3_fossildelta_init(
sqlite3 *db,
char **pzErrMsg,
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
static const int enc = SQLITE_UTF8|SQLITE_INNOCUOUS;
+3
View File
@@ -134,6 +134,9 @@ static void ieee754func(
if( a==0 ){
e = 0;
m = 0;
}else if( a==(sqlite3_int64)0x8000000000000000LL ){
e = -1996;
m = -1;
}else{
e = a>>52;
m = a & ((((sqlite3_int64)1)<<52)-1);
-575
View File
@@ -1,575 +0,0 @@
/*
** 2016-09-07
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
******************************************************************************
**
** This is an in-memory VFS implementation. The application supplies
** a chunk of memory to hold the database file.
**
** Because there is place to store a rollback or wal journal, the database
** must use one of journal_mode=MEMORY or journal_mode=NONE.
**
** USAGE:
**
** sqlite3_open_v2("file:/whatever?ptr=0xf05538&sz=14336&max=65536", &db,
** SQLITE_OPEN_READWRITE | SQLITE_OPEN_URI,
** "memvfs");
**
** These are the query parameters:
**
** ptr= The address of the memory buffer that holds the database.
**
** sz= The current size the database file
**
** maxsz= The maximum size of the database. In other words, the
** amount of space allocated for the ptr= buffer.
**
** freeonclose= If true, then sqlite3_free() is called on the ptr=
** value when the connection closes.
**
** The ptr= and sz= query parameters are required. If maxsz= is omitted,
** then it defaults to the sz= value. Parameter values can be in either
** decimal or hexadecimal. The filename in the URI is ignored.
*/
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
#include <string.h>
#include <assert.h>
/*
** Forward declaration of objects used by this utility
*/
typedef struct sqlite3_vfs MemVfs;
typedef struct MemFile MemFile;
/* Access to a lower-level VFS that (might) implement dynamic loading,
** access to randomness, etc.
*/
#define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData))
/* An open file */
struct MemFile {
sqlite3_file base; /* IO methods */
sqlite3_int64 sz; /* Size of the file */
sqlite3_int64 szMax; /* Space allocated to aData */
unsigned char *aData; /* content of the file */
int bFreeOnClose; /* Invoke sqlite3_free() on aData at close */
};
/*
** Methods for MemFile
*/
static int memClose(sqlite3_file*);
static int memRead(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
static int memWrite(sqlite3_file*,const void*,int iAmt, sqlite3_int64 iOfst);
static int memTruncate(sqlite3_file*, sqlite3_int64 size);
static int memSync(sqlite3_file*, int flags);
static int memFileSize(sqlite3_file*, sqlite3_int64 *pSize);
static int memLock(sqlite3_file*, int);
static int memUnlock(sqlite3_file*, int);
static int memCheckReservedLock(sqlite3_file*, int *pResOut);
static int memFileControl(sqlite3_file*, int op, void *pArg);
static int memSectorSize(sqlite3_file*);
static int memDeviceCharacteristics(sqlite3_file*);
static int memShmMap(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
static int memShmLock(sqlite3_file*, int offset, int n, int flags);
static void memShmBarrier(sqlite3_file*);
static int memShmUnmap(sqlite3_file*, int deleteFlag);
static int memFetch(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
static int memUnfetch(sqlite3_file*, sqlite3_int64 iOfst, void *p);
/*
** Methods for MemVfs
*/
static int memOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
static int memDelete(sqlite3_vfs*, const char *zName, int syncDir);
static int memAccess(sqlite3_vfs*, const char *zName, int flags, int *);
static int memFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
static void *memDlOpen(sqlite3_vfs*, const char *zFilename);
static void memDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
static void (*memDlSym(sqlite3_vfs *pVfs, void *p, const char*zSym))(void);
static void memDlClose(sqlite3_vfs*, void*);
static int memRandomness(sqlite3_vfs*, int nByte, char *zOut);
static int memSleep(sqlite3_vfs*, int microseconds);
static int memCurrentTime(sqlite3_vfs*, double*);
static int memGetLastError(sqlite3_vfs*, int, char *);
static int memCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
static sqlite3_vfs mem_vfs = {
2, /* iVersion */
0, /* szOsFile (set when registered) */
1024, /* mxPathname */
0, /* pNext */
"memvfs", /* zName */
0, /* pAppData (set when registered) */
memOpen, /* xOpen */
memDelete, /* xDelete */
memAccess, /* xAccess */
memFullPathname, /* xFullPathname */
memDlOpen, /* xDlOpen */
memDlError, /* xDlError */
memDlSym, /* xDlSym */
memDlClose, /* xDlClose */
memRandomness, /* xRandomness */
memSleep, /* xSleep */
memCurrentTime, /* xCurrentTime */
memGetLastError, /* xGetLastError */
memCurrentTimeInt64 /* xCurrentTimeInt64 */
};
static const sqlite3_io_methods mem_io_methods = {
3, /* iVersion */
memClose, /* xClose */
memRead, /* xRead */
memWrite, /* xWrite */
memTruncate, /* xTruncate */
memSync, /* xSync */
memFileSize, /* xFileSize */
memLock, /* xLock */
memUnlock, /* xUnlock */
memCheckReservedLock, /* xCheckReservedLock */
memFileControl, /* xFileControl */
memSectorSize, /* xSectorSize */
memDeviceCharacteristics, /* xDeviceCharacteristics */
memShmMap, /* xShmMap */
memShmLock, /* xShmLock */
memShmBarrier, /* xShmBarrier */
memShmUnmap, /* xShmUnmap */
memFetch, /* xFetch */
memUnfetch /* xUnfetch */
};
/*
** Close an mem-file.
**
** The pData pointer is owned by the application, so there is nothing
** to free.
*/
static int memClose(sqlite3_file *pFile){
MemFile *p = (MemFile *)pFile;
if( p->bFreeOnClose ) sqlite3_free(p->aData);
return SQLITE_OK;
}
/*
** Read data from an mem-file.
*/
static int memRead(
sqlite3_file *pFile,
void *zBuf,
int iAmt,
sqlite_int64 iOfst
){
MemFile *p = (MemFile *)pFile;
memcpy(zBuf, p->aData+iOfst, iAmt);
return SQLITE_OK;
}
/*
** Write data to an mem-file.
*/
static int memWrite(
sqlite3_file *pFile,
const void *z,
int iAmt,
sqlite_int64 iOfst
){
MemFile *p = (MemFile *)pFile;
if( iOfst+iAmt>p->sz ){
if( iOfst+iAmt>p->szMax ) return SQLITE_FULL;
if( iOfst>p->sz ) memset(p->aData+p->sz, 0, iOfst-p->sz);
p->sz = iOfst+iAmt;
}
memcpy(p->aData+iOfst, z, iAmt);
return SQLITE_OK;
}
/*
** Truncate an mem-file.
*/
static int memTruncate(sqlite3_file *pFile, sqlite_int64 size){
MemFile *p = (MemFile *)pFile;
if( size>p->sz ){
if( size>p->szMax ) return SQLITE_FULL;
memset(p->aData+p->sz, 0, size-p->sz);
}
p->sz = size;
return SQLITE_OK;
}
/*
** Sync an mem-file.
*/
static int memSync(sqlite3_file *pFile, int flags){
return SQLITE_OK;
}
/*
** Return the current file-size of an mem-file.
*/
static int memFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
MemFile *p = (MemFile *)pFile;
*pSize = p->sz;
return SQLITE_OK;
}
/*
** Lock an mem-file.
*/
static int memLock(sqlite3_file *pFile, int eLock){
return SQLITE_OK;
}
/*
** Unlock an mem-file.
*/
static int memUnlock(sqlite3_file *pFile, int eLock){
return SQLITE_OK;
}
/*
** Check if another file-handle holds a RESERVED lock on an mem-file.
*/
static int memCheckReservedLock(sqlite3_file *pFile, int *pResOut){
*pResOut = 0;
return SQLITE_OK;
}
/*
** File control method. For custom operations on an mem-file.
*/
static int memFileControl(sqlite3_file *pFile, int op, void *pArg){
MemFile *p = (MemFile *)pFile;
int rc = SQLITE_NOTFOUND;
if( op==SQLITE_FCNTL_VFSNAME ){
*(char**)pArg = sqlite3_mprintf("mem(%p,%lld)", p->aData, p->sz);
rc = SQLITE_OK;
}
return rc;
}
/*
** Return the sector-size in bytes for an mem-file.
*/
static int memSectorSize(sqlite3_file *pFile){
return 1024;
}
/*
** Return the device characteristic flags supported by an mem-file.
*/
static int memDeviceCharacteristics(sqlite3_file *pFile){
return SQLITE_IOCAP_ATOMIC |
SQLITE_IOCAP_POWERSAFE_OVERWRITE |
SQLITE_IOCAP_SAFE_APPEND |
SQLITE_IOCAP_SEQUENTIAL;
}
/* Create a shared memory file mapping */
static int memShmMap(
sqlite3_file *pFile,
int iPg,
int pgsz,
int bExtend,
void volatile **pp
){
return SQLITE_IOERR_SHMMAP;
}
/* Perform locking on a shared-memory segment */
static int memShmLock(sqlite3_file *pFile, int offset, int n, int flags){
return SQLITE_IOERR_SHMLOCK;
}
/* Memory barrier operation on shared memory */
static void memShmBarrier(sqlite3_file *pFile){
return;
}
/* Unmap a shared memory segment */
static int memShmUnmap(sqlite3_file *pFile, int deleteFlag){
return SQLITE_OK;
}
/* Fetch a page of a memory-mapped file */
static int memFetch(
sqlite3_file *pFile,
sqlite3_int64 iOfst,
int iAmt,
void **pp
){
MemFile *p = (MemFile *)pFile;
*pp = (void*)(p->aData + iOfst);
return SQLITE_OK;
}
/* Release a memory-mapped page */
static int memUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
return SQLITE_OK;
}
/*
** Open an mem file handle.
*/
static int memOpen(
sqlite3_vfs *pVfs,
const char *zName,
sqlite3_file *pFile,
int flags,
int *pOutFlags
){
MemFile *p = (MemFile*)pFile;
memset(p, 0, sizeof(*p));
if( (flags & SQLITE_OPEN_MAIN_DB)==0 ) return SQLITE_CANTOPEN;
p->aData = (unsigned char*)sqlite3_uri_int64(zName,"ptr",0);
if( p->aData==0 ) return SQLITE_CANTOPEN;
p->sz = sqlite3_uri_int64(zName,"sz",0);
if( p->sz<0 ) return SQLITE_CANTOPEN;
p->szMax = sqlite3_uri_int64(zName,"max",p->sz);
if( p->szMax<p->sz ) return SQLITE_CANTOPEN;
p->bFreeOnClose = sqlite3_uri_boolean(zName,"freeonclose",0);
pFile->pMethods = &mem_io_methods;
return SQLITE_OK;
}
/*
** Delete the file located at zPath. If the dirSync argument is true,
** ensure the file-system modifications are synced to disk before
** returning.
*/
static int memDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
return SQLITE_IOERR_DELETE;
}
/*
** Test for access permissions. Return true if the requested permission
** is available, or false otherwise.
*/
static int memAccess(
sqlite3_vfs *pVfs,
const char *zPath,
int flags,
int *pResOut
){
*pResOut = 0;
return SQLITE_OK;
}
/*
** Populate buffer zOut with the full canonical pathname corresponding
** to the pathname in zPath. zOut is guaranteed to point to a buffer
** of at least (INST_MAX_PATHNAME+1) bytes.
*/
static int memFullPathname(
sqlite3_vfs *pVfs,
const char *zPath,
int nOut,
char *zOut
){
sqlite3_snprintf(nOut, zOut, "%s", zPath);
return SQLITE_OK;
}
/*
** Open the dynamic library located at zPath and return a handle.
*/
static void *memDlOpen(sqlite3_vfs *pVfs, const char *zPath){
return ORIGVFS(pVfs)->xDlOpen(ORIGVFS(pVfs), zPath);
}
/*
** Populate the buffer zErrMsg (size nByte bytes) with a human readable
** utf-8 string describing the most recent error encountered associated
** with dynamic libraries.
*/
static void memDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
ORIGVFS(pVfs)->xDlError(ORIGVFS(pVfs), nByte, zErrMsg);
}
/*
** Return a pointer to the symbol zSymbol in the dynamic library pHandle.
*/
static void (*memDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){
return ORIGVFS(pVfs)->xDlSym(ORIGVFS(pVfs), p, zSym);
}
/*
** Close the dynamic library handle pHandle.
*/
static void memDlClose(sqlite3_vfs *pVfs, void *pHandle){
ORIGVFS(pVfs)->xDlClose(ORIGVFS(pVfs), pHandle);
}
/*
** Populate the buffer pointed to by zBufOut with nByte bytes of
** random data.
*/
static int memRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
return ORIGVFS(pVfs)->xRandomness(ORIGVFS(pVfs), nByte, zBufOut);
}
/*
** Sleep for nMicro microseconds. Return the number of microseconds
** actually slept.
*/
static int memSleep(sqlite3_vfs *pVfs, int nMicro){
return ORIGVFS(pVfs)->xSleep(ORIGVFS(pVfs), nMicro);
}
/*
** Return the current time as a Julian Day number in *pTimeOut.
*/
static int memCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
return ORIGVFS(pVfs)->xCurrentTime(ORIGVFS(pVfs), pTimeOut);
}
static int memGetLastError(sqlite3_vfs *pVfs, int a, char *b){
return ORIGVFS(pVfs)->xGetLastError(ORIGVFS(pVfs), a, b);
}
static int memCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p){
return ORIGVFS(pVfs)->xCurrentTimeInt64(ORIGVFS(pVfs), p);
}
#ifdef MEMVFS_TEST
/*
** memvfs_from_file(FILENAME, MAXSIZE)
**
** This an SQL function used to help in testing the memvfs VFS. The
** function reads the content of a file into memory and then returns
** a URI that can be handed to ATTACH to attach the memory buffer as
** a database. Example:
**
** ATTACH memvfs_from_file('test.db',1048576) AS inmem;
**
** The optional MAXSIZE argument gives the size of the memory allocation
** used to hold the database. If omitted, it defaults to the size of the
** file on disk.
*/
#include <stdio.h>
static void memvfsFromFileFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
unsigned char *p;
sqlite3_int64 sz;
sqlite3_int64 szMax;
FILE *in;
const char *zFilename = (const char*)sqlite3_value_text(argv[0]);
char *zUri;
if( zFilename==0 ) return;
in = fopen(zFilename, "rb");
if( in==0 ) return;
fseek(in, 0, SEEK_END);
szMax = sz = ftell(in);
rewind(in);
if( argc>=2 ){
szMax = sqlite3_value_int64(argv[1]);
if( szMax<sz ) szMax = sz;
}
p = sqlite3_malloc64( szMax );
if( p==0 ){
fclose(in);
sqlite3_result_error_nomem(context);
return;
}
fread(p, sz, 1, in);
fclose(in);
zUri = sqlite3_mprintf(
"file:/mem?vfs=memvfs&ptr=%lld&sz=%lld&max=%lld&freeonclose=1",
(sqlite3_int64)p, sz, szMax);
sqlite3_result_text(context, zUri, -1, sqlite3_free);
}
#endif /* MEMVFS_TEST */
#ifdef MEMVFS_TEST
/*
** memvfs_to_file(SCHEMA, FILENAME)
**
** The schema identified by SCHEMA must be a memvfs database. Write
** the content of this database into FILENAME.
*/
static void memvfsToFileFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
MemFile *p = 0;
FILE *out;
int rc;
sqlite3 *db = sqlite3_context_db_handle(context);
sqlite3_vfs *pVfs = 0;
const char *zSchema = (const char*)sqlite3_value_text(argv[0]);
const char *zFilename = (const char*)sqlite3_value_text(argv[1]);
if( zFilename==0 ) return;
out = fopen(zFilename, "wb");
if( out==0 ) return;
rc = sqlite3_file_control(db, zSchema, SQLITE_FCNTL_VFS_POINTER, &pVfs);
if( rc || pVfs==0 ) return;
if( strcmp(pVfs->zName,"memvfs")!=0 ) return;
rc = sqlite3_file_control(db, zSchema, SQLITE_FCNTL_FILE_POINTER, &p);
if( rc ) return;
fwrite(p->aData, 1, (size_t)p->sz, out);
fclose(out);
}
#endif /* MEMVFS_TEST */
#ifdef MEMVFS_TEST
/* Called for each new database connection */
static int memvfsRegister(
sqlite3 *db,
char **pzErrMsg,
const struct sqlite3_api_routines *pThunk
){
sqlite3_create_function(db, "memvfs_from_file", 1, SQLITE_UTF8, 0,
memvfsFromFileFunc, 0, 0);
sqlite3_create_function(db, "memvfs_from_file", 2, SQLITE_UTF8, 0,
memvfsFromFileFunc, 0, 0);
sqlite3_create_function(db, "memvfs_to_file", 2, SQLITE_UTF8, 0,
memvfsToFileFunc, 0, 0);
return SQLITE_OK;
}
#endif /* MEMVFS_TEST */
#ifdef _WIN32
__declspec(dllexport)
#endif
/*
** This routine is called when the extension is loaded.
** Register the new VFS.
*/
int sqlite3_memvfs_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
mem_vfs.pAppData = sqlite3_vfs_find(0);
if( mem_vfs.pAppData==0 ) return SQLITE_ERROR;
mem_vfs.szOsFile = sizeof(MemFile);
rc = sqlite3_vfs_register(&mem_vfs, 1);
#ifdef MEMVFS_TEST
if( rc==SQLITE_OK ){
rc = sqlite3_auto_extension((void(*)(void))memvfsRegister);
}
if( rc==SQLITE_OK ){
rc = memvfsRegister(db, pzErrMsg, pApi);
}
#endif
if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY;
return rc;
}
+4 -3
View File
@@ -297,8 +297,9 @@ static const unsigned char sqlite3CtypeMap[256] = {
** Return the length (in bytes) of the token that begins at z[0].
** Store the token type in *tokenType before returning.
*/
static int sqlite3GetToken(const unsigned char *z, int *tokenType){
int i, c;
static sqlite3_int64 sqlite3GetToken(const unsigned char *z, int *tokenType){
sqlite3_int64 i;
int c;
switch( aiClass[*z] ){ /* Switch on the character-class of the first byte
** of the token. See the comment on the CC_ defines
** above. */
@@ -559,7 +560,7 @@ char *sqlite3_normalize(const char *zSql){
int i; /* Next character to read from zSql[] */
int j; /* Next slot to fill in on z[] */
int tokenType; /* Type of the next token */
int n; /* Size of the next token */
sqlite3_int64 n; /* Size of the next token */
int k; /* Loop counter */
nSql = strlen(zSql);
+75 -43
View File
@@ -55,6 +55,8 @@
** to p copies of X following by q-p copies of X? and that the size of the
** regular expression in the O(N*M) performance bound is computed after
** this expansion.
**
** To help prevent DoS attacks, the maximum size of the NFA is restricted.
*/
#include <string.h>
#include <stdlib.h>
@@ -96,32 +98,6 @@ SQLITE_EXTENSION_INIT1
#define RE_OP_BOUNDARY 17 /* Boundary between word and non-word */
#define RE_OP_ATSTART 18 /* Currently at the start of the string */
#if defined(SQLITE_DEBUG)
/* Opcode names used for symbolic debugging */
static const char *ReOpName[] = {
"EOF",
"MATCH",
"ANY",
"ANYSTAR",
"FORK",
"GOTO",
"ACCEPT",
"CC_INC",
"CC_EXC",
"CC_VALUE",
"CC_RANGE",
"WORD",
"NOTWORD",
"DIGIT",
"NOTDIGIT",
"SPACE",
"NOTSPACE",
"BOUNDARY",
"ATSTART",
};
#endif /* SQLITE_DEBUG */
/* Each opcode is a "state" in the NFA */
typedef unsigned short ReStateNumber;
@@ -158,6 +134,7 @@ struct ReCompiled {
int nInit; /* Number of bytes in zInit */
unsigned nState; /* Number of entries in aOp[] and aArg[] */
unsigned nAlloc; /* Slots allocated for aOp[] and aArg[] */
unsigned mxAlloc; /* Complexity limit */
};
/* Add a state to the given state set if it is not already there */
@@ -372,14 +349,15 @@ re_match_end:
/* Resize the opcode and argument arrays for an RE under construction.
*/
static int re_resize(ReCompiled *p, int N){
static int re_resize(ReCompiled *p, unsigned int N){
char *aOp;
int *aArg;
if( N>p->mxAlloc ){ p->zErr = "REGEXP pattern too big"; return 1; }
aOp = sqlite3_realloc64(p->aOp, N*sizeof(p->aOp[0]));
if( aOp==0 ) return 1;
if( aOp==0 ){ p->zErr = "out of memory"; return 1; }
p->aOp = aOp;
aArg = sqlite3_realloc64(p->aArg, N*sizeof(p->aArg[0]));
if( aArg==0 ) return 1;
if( aArg==0 ){ p->zErr = "out of memory"; return 1; }
p->aArg = aArg;
p->nAlloc = N;
return 0;
@@ -410,7 +388,7 @@ static int re_append(ReCompiled *p, int op, int arg){
/* Make a copy of N opcodes starting at iStart onto the end of the RE
** under construction.
*/
static void re_copy(ReCompiled *p, int iStart, int N){
static void re_copy(ReCompiled *p, int iStart, unsigned int N){
if( p->nState+N>=p->nAlloc && re_resize(p, p->nAlloc*2+N) ) return;
memcpy(&p->aOp[p->nState], &p->aOp[iStart], N*sizeof(p->aOp[0]));
memcpy(&p->aArg[p->nState], &p->aArg[iStart], N*sizeof(p->aArg[0]));
@@ -563,18 +541,26 @@ static const char *re_subcompile_string(ReCompiled *p){
break;
}
case '{': {
int m = 0, n = 0;
int sz, j;
unsigned int m = 0, n = 0;
unsigned int sz, j;
if( iPrev<0 ) return "'{m,n}' without operand";
while( (c=rePeek(p))>='0' && c<='9' ){ m = m*10 + c - '0'; p->sIn.i++; }
while( (c=rePeek(p))>='0' && c<='9' ){
m = m*10 + c - '0';
if( m*2>p->mxAlloc ) return "REGEXP pattern too big";
p->sIn.i++;
}
n = m;
if( c==',' ){
p->sIn.i++;
n = 0;
while( (c=rePeek(p))>='0' && c<='9' ){ n = n*10 + c-'0'; p->sIn.i++; }
while( (c=rePeek(p))>='0' && c<='9' ){
n = n*10 + c-'0';
if( n*2>p->mxAlloc ) return "REGEXP pattern too big";
p->sIn.i++;
}
}
if( c!='}' ) return "unmatched '{'";
if( n>0 && n<m ) return "n less than m in '{m,n}'";
if( n<m ) return "n less than m in '{m,n}'";
p->sIn.i++;
sz = p->nState - iPrev;
if( m==0 ){
@@ -590,7 +576,7 @@ static const char *re_subcompile_string(ReCompiled *p){
re_copy(p, iPrev, sz);
}
if( n==0 && m>0 ){
re_append(p, RE_OP_FORK, -sz);
re_append(p, RE_OP_FORK, -(int)sz);
}
break;
}
@@ -656,8 +642,7 @@ static const char *re_subcompile_string(ReCompiled *p){
** regular expression. Applications should invoke this routine once
** for every call to re_compile() to avoid memory leaks.
*/
static void re_free(void *p){
ReCompiled *pRe = (ReCompiled*)p;
static void re_free(ReCompiled *pRe){
if( pRe ){
sqlite3_free(pRe->aOp);
sqlite3_free(pRe->aArg);
@@ -665,13 +650,27 @@ static void re_free(void *p){
}
}
/*
** Version of re_free() that accepts a pointer of type (void*). Required
** to satisfy sanitizers when the re_free() function is called via a
** function pointer.
*/
static void re_free_voidptr(void *p){
re_free((ReCompiled*)p);
}
/*
** Compile a textual regular expression in zIn[] into a compiled regular
** expression suitable for us by re_match() and return a pointer to the
** compiled regular expression in *ppRe. Return NULL on success or an
** error message if something goes wrong.
*/
static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
static const char *re_compile(
ReCompiled **ppRe, /* OUT: write compiled NFA here */
const char *zIn, /* Input regular expression */
int mxRe, /* Complexity limit */
int noCase /* True for caseless comparisons */
){
ReCompiled *pRe;
const char *zErr;
int i, j;
@@ -683,9 +682,11 @@ static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
}
memset(pRe, 0, sizeof(*pRe));
pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
pRe->mxAlloc = mxRe;
if( re_resize(pRe, 30) ){
zErr = pRe->zErr;
re_free(pRe);
return "out of memory";
return zErr;
}
if( zIn[0]=='^' ){
zIn++;
@@ -738,6 +739,14 @@ static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
return pRe->zErr;
}
/*
** Compute a reasonable limit on the length of the REGEXP NFA.
*/
static int re_maxlen(sqlite3_context *context){
sqlite3 *db = sqlite3_context_db_handle(context);
return 75 + sqlite3_limit(db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH,-1)/2;
}
/*
** Implementation of the regexp() SQL function. This function implements
** the build-in REGEXP operator. The first argument to the function is the
@@ -763,7 +772,8 @@ static void re_sql_func(
if( pRe==0 ){
zPattern = (const char*)sqlite3_value_text(argv[0]);
if( zPattern==0 ) return;
zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
zErr = re_compile(&pRe, zPattern, re_maxlen(context),
sqlite3_user_data(context)!=0);
if( zErr ){
re_free(pRe);
sqlite3_result_error(context, zErr, -1);
@@ -780,7 +790,7 @@ static void re_sql_func(
sqlite3_result_int(context, re_match(pRe, zStr, -1));
}
if( setAux ){
sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
sqlite3_set_auxdata(context, 0, pRe, re_free_voidptr);
}
}
@@ -805,10 +815,32 @@ static void re_bytecode_func(
int n;
char *z;
(void)argc;
static const char *ReOpName[] = {
"EOF",
"MATCH",
"ANY",
"ANYSTAR",
"FORK",
"GOTO",
"ACCEPT",
"CC_INC",
"CC_EXC",
"CC_VALUE",
"CC_RANGE",
"WORD",
"NOTWORD",
"DIGIT",
"NOTDIGIT",
"SPACE",
"NOTSPACE",
"BOUNDARY",
"ATSTART",
};
zPattern = (const char*)sqlite3_value_text(argv[0]);
if( zPattern==0 ) return;
zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
zErr = re_compile(&pRe, zPattern, re_maxlen(context),
sqlite3_user_data(context)!=0);
if( zErr ){
re_free(pRe);
sqlite3_result_error(context, zErr, -1);
+299 -230
View File
@@ -30,19 +30,20 @@
** SELECT * FROM generate_series(0,100,5);
**
** The query above returns integers from 0 through 100 counting by steps
** of 5.
** of 5. In other words, 0, 5, 10, 15, ..., 90, 95, 100. There are a total
** of 21 rows.
**
** SELECT * FROM generate_series(0,100);
**
** Integers from 0 through 100 with a step size of 1.
** Integers from 0 through 100 with a step size of 1. 101 rows.
**
** SELECT * FROM generate_series(20) LIMIT 10;
**
** Integers 20 through 29.
** Integers 20 through 29. 10 rows.
**
** SELECT * FROM generate_series(0,-100,-5);
**
** Integers 0 -5 -10 ... -100.
** Integers 0 -5 -10 ... -100. 21 rows.
**
** SELECT * FROM generate_series(0,-1);
**
@@ -118,140 +119,89 @@ SQLITE_EXTENSION_INIT1
#include <math.h>
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Return that member of a generate_series(...) sequence whose 0-based
** index is ix. The 0th member is given by smBase. The sequence members
** progress per ix increment by smStep.
*/
static sqlite3_int64 genSeqMember(
sqlite3_int64 smBase,
sqlite3_int64 smStep,
sqlite3_uint64 ix
){
static const sqlite3_uint64 mxI64 =
((sqlite3_uint64)0x7fffffff)<<32 | 0xffffffff;
if( ix>=mxI64 ){
/* Get ix into signed i64 range. */
ix -= mxI64;
/* With 2's complement ALU, this next can be 1 step, but is split into
* 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */
smBase += (mxI64/2) * smStep;
smBase += (mxI64 - mxI64/2) * smStep;
}
/* Under UBSAN (or on 1's complement machines), must do this last term
* in steps to avoid the dreaded (and harmless) signed multiply overflow. */
if( ix>=2 ){
sqlite3_int64 ix2 = (sqlite3_int64)ix/2;
smBase += ix2*smStep;
ix -= ix2;
}
return smBase + ((sqlite3_int64)ix)*smStep;
}
typedef unsigned char u8;
typedef struct SequenceSpec {
sqlite3_int64 iOBase; /* Original starting value ("start") */
sqlite3_int64 iOTerm; /* Original terminal value ("stop") */
sqlite3_int64 iBase; /* Starting value to actually use */
sqlite3_int64 iTerm; /* Terminal value to actually use */
sqlite3_int64 iStep; /* Increment ("step") */
sqlite3_uint64 uSeqIndexMax; /* maximum sequence index (aka "n") */
sqlite3_uint64 uSeqIndexNow; /* Current index during generation */
sqlite3_int64 iValueNow; /* Current value during generation */
u8 isNotEOF; /* Sequence generation not exhausted */
u8 isReversing; /* Sequence is being reverse generated */
} SequenceSpec;
/*
** Prepare a SequenceSpec for use in generating an integer series
** given initialized iBase, iTerm and iStep values. Sequence is
** initialized per given isReversing. Other members are computed.
*/
static void setupSequence( SequenceSpec *pss ){
int bSameSigns;
pss->uSeqIndexMax = 0;
pss->isNotEOF = 0;
bSameSigns = (pss->iBase < 0)==(pss->iTerm < 0);
if( pss->iTerm < pss->iBase ){
sqlite3_uint64 nuspan = 0;
if( bSameSigns ){
nuspan = (sqlite3_uint64)(pss->iBase - pss->iTerm);
}else{
/* Under UBSAN (or on 1's complement machines), must do this in steps.
* In this clause, iBase>=0 and iTerm<0 . */
nuspan = 1;
nuspan += pss->iBase;
nuspan += -(pss->iTerm+1);
}
if( pss->iStep<0 ){
pss->isNotEOF = 1;
if( nuspan==ULONG_MAX ){
pss->uSeqIndexMax = ( pss->iStep>LLONG_MIN )? nuspan/-pss->iStep : 1;
}else if( pss->iStep>LLONG_MIN ){
pss->uSeqIndexMax = nuspan/-pss->iStep;
}
}
}else if( pss->iTerm > pss->iBase ){
sqlite3_uint64 puspan = 0;
if( bSameSigns ){
puspan = (sqlite3_uint64)(pss->iTerm - pss->iBase);
}else{
/* Under UBSAN (or on 1's complement machines), must do this in steps.
* In this clause, iTerm>=0 and iBase<0 . */
puspan = 1;
puspan += pss->iTerm;
puspan += -(pss->iBase+1);
}
if( pss->iStep>0 ){
pss->isNotEOF = 1;
pss->uSeqIndexMax = puspan/pss->iStep;
}
}else if( pss->iTerm == pss->iBase ){
pss->isNotEOF = 1;
pss->uSeqIndexMax = 0;
}
pss->uSeqIndexNow = (pss->isReversing)? pss->uSeqIndexMax : 0;
pss->iValueNow = (pss->isReversing)
? genSeqMember(pss->iBase, pss->iStep, pss->uSeqIndexMax)
: pss->iBase;
}
/*
** Progress sequence generator to yield next value, if any.
** Leave its state to either yield next value or be at EOF.
** Return whether there is a next value, or 0 at EOF.
*/
static int progressSequence( SequenceSpec *pss ){
if( !pss->isNotEOF ) return 0;
if( pss->isReversing ){
if( pss->uSeqIndexNow > 0 ){
pss->uSeqIndexNow--;
pss->iValueNow -= pss->iStep;
}else{
pss->isNotEOF = 0;
}
}else{
if( pss->uSeqIndexNow < pss->uSeqIndexMax ){
pss->uSeqIndexNow++;
pss->iValueNow += pss->iStep;
}else{
pss->isNotEOF = 0;
}
}
return pss->isNotEOF;
}
/* series_cursor is a subclass of sqlite3_vtab_cursor which will
** serve as the underlying representation of a cursor that scans
** over rows of the result
** over rows of the result.
**
** iOBase, iOTerm, and iOStep are the original values of the
** start=, stop=, and step= constraints on the query. These are
** the values reported by the start, stop, and step columns of the
** virtual table.
**
** iBase, iTerm, iStep, and bDescp are the actual values used to generate
** the sequence. These might be different from the iOxxxx values.
** For example in
**
** SELECT value FROM generate_series(1,11,2)
** WHERE value BETWEEN 4 AND 8;
**
** The iOBase is 1, but the iBase is 5. iOTerm is 11 but iTerm is 7.
** Another example:
**
** SELECT value FROM generate_series(1,15,3) ORDER BY value DESC;
**
** The cursor initialization for the above query is:
**
** iOBase = 1 iBase = 13
** iOTerm = 15 iTerm = 1
** iOStep = 3 iStep = 3 bDesc = 1
**
** The actual step size is unsigned so that can have a value of
** +9223372036854775808 which is needed for querys like this:
**
** SELECT value
** FROM generate_series(9223372036854775807,
** -9223372036854775808,
** -9223372036854775808)
** ORDER BY value ASC;
**
** The setup for the previous query will be:
**
** iOBase = 9223372036854775807 iBase = -1
** iOTerm = -9223372036854775808 iTerm = 9223372036854775807
** iOStep = -9223372036854775808 iStep = 9223372036854775808 bDesc = 0
*/
typedef unsigned char u8;
typedef struct series_cursor series_cursor;
struct series_cursor {
sqlite3_vtab_cursor base; /* Base class - must be first */
SequenceSpec ss; /* (this) Derived class data */
sqlite3_int64 iOBase; /* Original starting value ("start") */
sqlite3_int64 iOTerm; /* Original terminal value ("stop") */
sqlite3_int64 iOStep; /* Original step value */
sqlite3_int64 iBase; /* Starting value to actually use */
sqlite3_int64 iTerm; /* Terminal value to actually use */
sqlite3_uint64 iStep; /* The step size */
sqlite3_int64 iValue; /* Current value */
u8 bDesc; /* iStep is really negative */
u8 bDone; /* True if stepped past last element */
};
/*
** Computed the difference between two 64-bit signed integers using a
** convoluted computation designed to work around the silly restriction
** against signed integer overflow in C.
*/
static sqlite3_uint64 span64(sqlite3_int64 a, sqlite3_int64 b){
assert( a>=b );
return (*(sqlite3_uint64*)&a) - (*(sqlite3_uint64*)&b);
}
/*
** Add or substract an unsigned 64-bit integer from a signed 64-bit integer
** and return the new signed 64-bit integer.
*/
static sqlite3_int64 add64(sqlite3_int64 a, sqlite3_uint64 b){
sqlite3_uint64 x = *(sqlite3_uint64*)&a;
x += b;
return *(sqlite3_int64*)&x;
}
static sqlite3_int64 sub64(sqlite3_int64 a, sqlite3_uint64 b){
sqlite3_uint64 x = *(sqlite3_uint64*)&a;
x -= b;
return *(sqlite3_int64*)&x;
}
/*
** The seriesConnect() method is invoked to create a new
** series_vtab that describes the generate_series virtual table.
@@ -332,7 +282,15 @@ static int seriesClose(sqlite3_vtab_cursor *cur){
*/
static int seriesNext(sqlite3_vtab_cursor *cur){
series_cursor *pCur = (series_cursor*)cur;
progressSequence( & pCur->ss );
if( pCur->iValue==pCur->iTerm ){
pCur->bDone = 1;
}else if( pCur->bDesc ){
pCur->iValue = sub64(pCur->iValue, pCur->iStep);
assert( pCur->iValue>=pCur->iTerm );
}else{
pCur->iValue = add64(pCur->iValue, pCur->iStep);
assert( pCur->iValue<=pCur->iTerm );
}
return SQLITE_OK;
}
@@ -348,19 +306,19 @@ static int seriesColumn(
series_cursor *pCur = (series_cursor*)cur;
sqlite3_int64 x = 0;
switch( i ){
case SERIES_COLUMN_START: x = pCur->ss.iOBase; break;
case SERIES_COLUMN_STOP: x = pCur->ss.iOTerm; break;
case SERIES_COLUMN_STEP: x = pCur->ss.iStep; break;
default: x = pCur->ss.iValueNow; break;
case SERIES_COLUMN_START: x = pCur->iOBase; break;
case SERIES_COLUMN_STOP: x = pCur->iOTerm; break;
case SERIES_COLUMN_STEP: x = pCur->iOStep; break;
default: x = pCur->iValue; break;
}
sqlite3_result_int64(ctx, x);
return SQLITE_OK;
}
#ifndef LARGEST_UINT64
#define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
#define LARGEST_UINT64 (0xffffffff|(((sqlite3_uint64)0xffffffff)<<32))
#define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
#define LARGEST_INT64 ((sqlite3_int64)0x7fffffffffffffffLL)
#define LARGEST_UINT64 ((sqlite3_uint64)0xffffffffffffffffULL)
#define SMALLEST_INT64 ((sqlite3_int64)0x8000000000000000LL)
#endif
/*
@@ -368,7 +326,7 @@ static int seriesColumn(
*/
static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
series_cursor *pCur = (series_cursor*)cur;
*pRowid = pCur->ss.iValueNow;
*pRowid = pCur->iValue;
return SQLITE_OK;
}
@@ -378,7 +336,7 @@ static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
*/
static int seriesEof(sqlite3_vtab_cursor *cur){
series_cursor *pCur = (series_cursor*)cur;
return !pCur->ss.isNotEOF;
return pCur->bDone;
}
/* True to cause run-time checking of the start=, stop=, and/or step=
@@ -389,6 +347,59 @@ static int seriesEof(sqlite3_vtab_cursor *cur){
# define SQLITE_SERIES_CONSTRAINT_VERIFY 0
#endif
/*
** Return the number of steps between pCur->iBase and pCur->iTerm if
** the step width is pCur->iStep.
*/
static sqlite3_uint64 seriesSteps(series_cursor *pCur){
if( pCur->bDesc ){
assert( pCur->iBase >= pCur->iTerm );
return span64(pCur->iBase, pCur->iTerm)/pCur->iStep;
}else{
assert( pCur->iBase <= pCur->iTerm );
return span64(pCur->iTerm, pCur->iBase)/pCur->iStep;
}
}
#if defined(SQLITE_ENABLE_MATH_FUNCTIONS) || defined(_WIN32)
/*
** Case 1 (the most common case):
** The standard math library is available so use ceil() and floor() from there.
*/
static double seriesCeil(double r){ return ceil(r); }
static double seriesFloor(double r){ return floor(r); }
#elif defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
/*
** Case 2 (2nd most common): Use GCC/Clang builtins
*/
static double seriesCeil(double r){ return __builtin_ceil(r); }
static double seriesFloor(double r){ return __builtin_floor(r); }
#else
/*
** Case 3 (rarely happens): Use home-grown ceil() and floor() routines.
*/
static double seriesCeil(double r){
sqlite3_int64 x;
if( r!=r ) return r;
if( r<=(-4503599627370496.0) ) return r;
if( r>=(+4503599627370496.0) ) return r;
x = (sqlite3_int64)r;
if( r==(double)x ) return r;
if( r>(double)x ) x++;
return (double)x;
}
static double seriesFloor(double r){
sqlite3_int64 x;
if( r!=r ) return r;
if( r<=(-4503599627370496.0) ) return r;
if( r>=(+4503599627370496.0) ) return r;
x = (sqlite3_int64)r;
if( r==(double)x ) return r;
if( r<(double)x ) x--;
return (double)x;
}
#endif
/*
** This method is called to "rewind" the series_cursor object back
** to the first row of output. This method is always called at least
@@ -422,33 +433,42 @@ static int seriesFilter(
int argc, sqlite3_value **argv
){
series_cursor *pCur = (series_cursor *)pVtabCursor;
int i = 0;
int returnNoRows = 0;
sqlite3_int64 iMin = SMALLEST_INT64;
sqlite3_int64 iMax = LARGEST_INT64;
sqlite3_int64 iLimit = 0;
sqlite3_int64 iOffset = 0;
int iArg = 0; /* Arguments used so far */
int i; /* Loop counter */
sqlite3_int64 iMin = SMALLEST_INT64; /* Smallest allowed output value */
sqlite3_int64 iMax = LARGEST_INT64; /* Largest allowed output value */
sqlite3_int64 iLimit = 0; /* if >0, the value of the LIMIT */
sqlite3_int64 iOffset = 0; /* if >0, the value of the OFFSET */
(void)idxStrUnused;
/* If any constraints have a NULL value, then return no rows.
** See ticket https://sqlite.org/src/info/fac496b61722daf2
*/
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
goto series_no_rows;
}
}
/* Capture the three HIDDEN parameters to the virtual table and insert
** default values for any parameters that are omitted.
*/
if( idxNum & 0x01 ){
pCur->ss.iBase = sqlite3_value_int64(argv[i++]);
pCur->iOBase = sqlite3_value_int64(argv[iArg++]);
}else{
pCur->ss.iBase = 0;
pCur->iOBase = 0;
}
if( idxNum & 0x02 ){
pCur->ss.iTerm = sqlite3_value_int64(argv[i++]);
pCur->iOTerm = sqlite3_value_int64(argv[iArg++]);
}else{
pCur->ss.iTerm = 0xffffffff;
pCur->iOTerm = 0xffffffff;
}
if( idxNum & 0x04 ){
pCur->ss.iStep = sqlite3_value_int64(argv[i++]);
if( pCur->ss.iStep==0 ){
pCur->ss.iStep = 1;
}else if( pCur->ss.iStep<0 ){
if( (idxNum & 0x10)==0 ) idxNum |= 0x08;
}
pCur->iOStep = sqlite3_value_int64(argv[iArg++]);
if( pCur->iOStep==0 ) pCur->iOStep = 1;
}else{
pCur->ss.iStep = 1;
pCur->iOStep = 1;
}
/* If there are constraints on the value column but there are
@@ -458,72 +478,94 @@ static int seriesFilter(
** further below.
*/
if( (idxNum & 0x05)==0 && (idxNum & 0x0380)!=0 ){
pCur->ss.iBase = SMALLEST_INT64;
pCur->iOBase = SMALLEST_INT64;
}
if( (idxNum & 0x06)==0 && (idxNum & 0x3080)!=0 ){
pCur->ss.iTerm = LARGEST_INT64;
pCur->iOTerm = LARGEST_INT64;
}
pCur->iBase = pCur->iOBase;
pCur->iTerm = pCur->iOTerm;
if( pCur->iOStep>0 ){
pCur->iStep = pCur->iOStep;
}else if( pCur->iOStep>SMALLEST_INT64 ){
pCur->iStep = -pCur->iOStep;
}else{
pCur->iStep = LARGEST_INT64;
pCur->iStep++;
}
pCur->bDesc = pCur->iOStep<0;
if( pCur->bDesc==0 && pCur->iBase>pCur->iTerm ){
goto series_no_rows;
}
if( pCur->bDesc!=0 && pCur->iBase<pCur->iTerm ){
goto series_no_rows;
}
pCur->ss.iOBase = pCur->ss.iBase;
pCur->ss.iOTerm = pCur->ss.iTerm;
/* Extract the LIMIT and OFFSET values, but do not apply them yet.
** The range must first be constrained by the limits on value.
*/
if( idxNum & 0x20 ){
iLimit = sqlite3_value_int64(argv[i++]);
iLimit = sqlite3_value_int64(argv[iArg++]);
if( idxNum & 0x40 ){
iOffset = sqlite3_value_int64(argv[i++]);
iOffset = sqlite3_value_int64(argv[iArg++]);
}
}
/* Narrow the range of iMin and iMax (the minimum and maximum outputs)
** based on equality and inequality constraints on the "value" column.
*/
if( idxNum & 0x3380 ){
/* Extract the maximum range of output values determined by
** constraints on the "value" column.
*/
if( idxNum & 0x0080 ){
if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[i++]);
if( r==ceil(r) ){
if( idxNum & 0x0080 ){ /* value=X */
if( sqlite3_value_numeric_type(argv[iArg])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[iArg++]);
if( r==seriesCeil(r)
&& r>=(double)SMALLEST_INT64
&& r<=(double)LARGEST_INT64
){
iMin = iMax = (sqlite3_int64)r;
}else{
returnNoRows = 1;
goto series_no_rows;
}
}else{
iMin = iMax = sqlite3_value_int64(argv[i++]);
iMin = iMax = sqlite3_value_int64(argv[iArg++]);
}
}else{
if( idxNum & 0x0300 ){
if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[i++]);
if( idxNum & 0x0200 && r==ceil(r) ){
iMin = (sqlite3_int64)ceil(r+1.0);
if( idxNum & 0x0300 ){ /* value>X or value>=X */
if( sqlite3_value_numeric_type(argv[iArg])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[iArg++]);
if( r<(double)SMALLEST_INT64 ){
iMin = SMALLEST_INT64;
}else if( (idxNum & 0x0200)!=0 && r==seriesCeil(r) ){
iMin = (sqlite3_int64)seriesCeil(r+1.0);
}else{
iMin = (sqlite3_int64)ceil(r);
iMin = (sqlite3_int64)seriesCeil(r);
}
}else{
iMin = sqlite3_value_int64(argv[i++]);
if( idxNum & 0x0200 ){
iMin = sqlite3_value_int64(argv[iArg++]);
if( (idxNum & 0x0200)!=0 ){
if( iMin==LARGEST_INT64 ){
returnNoRows = 1;
goto series_no_rows;
}else{
iMin++;
}
}
}
}
if( idxNum & 0x3000 ){
if( sqlite3_value_numeric_type(argv[i])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[i++]);
if( (idxNum & 0x2000)!=0 && r==floor(r) ){
if( idxNum & 0x3000 ){ /* value<X or value<=X */
if( sqlite3_value_numeric_type(argv[iArg])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[iArg++]);
if( r>(double)LARGEST_INT64 ){
iMax = LARGEST_INT64;
}else if( (idxNum & 0x2000)!=0 && r==seriesFloor(r) ){
iMax = (sqlite3_int64)(r-1.0);
}else{
iMax = (sqlite3_int64)floor(r);
iMax = (sqlite3_int64)seriesFloor(r);
}
}else{
iMax = sqlite3_value_int64(argv[i++]);
iMax = sqlite3_value_int64(argv[iArg++]);
if( idxNum & 0x2000 ){
if( iMax==SMALLEST_INT64 ){
returnNoRows = 1;
goto series_no_rows;
}else{
iMax--;
}
@@ -531,72 +573,99 @@ static int seriesFilter(
}
}
if( iMin>iMax ){
returnNoRows = 1;
goto series_no_rows;
}
}
/* Try to reduce the range of values to be generated based on
** constraints on the "value" column.
*/
if( pCur->ss.iStep>0 ){
sqlite3_int64 szStep = pCur->ss.iStep;
if( pCur->ss.iBase<iMin ){
sqlite3_uint64 d = iMin - pCur->ss.iBase;
pCur->ss.iBase += ((d+szStep-1)/szStep)*szStep;
if( pCur->bDesc==0 ){
if( pCur->iBase<iMin ){
sqlite3_uint64 span = span64(iMin,pCur->iBase);
pCur->iBase = add64(pCur->iBase, (span/pCur->iStep)*pCur->iStep);
if( pCur->iBase<iMin ){
if( pCur->iBase > sub64(LARGEST_INT64, pCur->iStep) ){
goto series_no_rows;
}
pCur->iBase = add64(pCur->iBase, pCur->iStep);
}
}
if( pCur->ss.iTerm>iMax ){
pCur->ss.iTerm = iMax;
if( pCur->iTerm>iMax ){
pCur->iTerm = iMax;
}
}else{
sqlite3_int64 szStep = -pCur->ss.iStep;
assert( szStep>0 );
if( pCur->ss.iBase>iMax ){
sqlite3_uint64 d = pCur->ss.iBase - iMax;
pCur->ss.iBase -= ((d+szStep-1)/szStep)*szStep;
if( pCur->iBase>iMax ){
sqlite3_uint64 span = span64(pCur->iBase,iMax);
pCur->iBase = sub64(pCur->iBase, (span/pCur->iStep)*pCur->iStep);
if( pCur->iBase>iMax ){
if( pCur->iBase < add64(SMALLEST_INT64, pCur->iStep) ){
goto series_no_rows;
}
pCur->iBase = sub64(pCur->iBase, pCur->iStep);
}
}
if( pCur->ss.iTerm<iMin ){
pCur->ss.iTerm = iMin;
if( pCur->iTerm<iMin ){
pCur->iTerm = iMin;
}
}
}
/* Adjust iTerm so that it is exactly the last value of the series.
*/
if( pCur->bDesc==0 ){
if( pCur->iBase>pCur->iTerm ){
goto series_no_rows;
}
pCur->iTerm = sub64(pCur->iTerm,
span64(pCur->iTerm,pCur->iBase) % pCur->iStep);
}else{
if( pCur->iBase<pCur->iTerm ){
goto series_no_rows;
}
pCur->iTerm = add64(pCur->iTerm,
span64(pCur->iBase,pCur->iTerm) % pCur->iStep);
}
/* Transform the series generator to output values in the requested
** order.
*/
if( ((idxNum & 0x0008)!=0 && pCur->bDesc==0)
|| ((idxNum & 0x0010)!=0 && pCur->bDesc!=0)
){
sqlite3_int64 tmp = pCur->iBase;
pCur->iBase = pCur->iTerm;
pCur->iTerm = tmp;
pCur->bDesc = !pCur->bDesc;
}
/* Apply LIMIT and OFFSET constraints, if any */
assert( pCur->iStep!=0 );
if( idxNum & 0x20 ){
if( iOffset>0 ){
pCur->ss.iBase += pCur->ss.iStep*iOffset;
}
if( iLimit>=0 ){
sqlite3_int64 iTerm;
iTerm = pCur->ss.iBase + (iLimit - 1)*pCur->ss.iStep;
if( pCur->ss.iStep<0 ){
if( iTerm>pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
if( seriesSteps(pCur) < (sqlite3_uint64)iOffset ){
goto series_no_rows;
}else if( pCur->bDesc ){
pCur->iBase = sub64(pCur->iBase, pCur->iStep*iOffset);
}else{
if( iTerm<pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
pCur->iBase = add64(pCur->iBase, pCur->iStep*iOffset);
}
}
}
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
** See ticket https://sqlite.org/src/info/fac496b61722daf2 */
returnNoRows = 1;
break;
if( iLimit>=0 && seriesSteps(pCur) > (sqlite3_uint64)iLimit ){
pCur->iTerm = add64(pCur->iBase, (iLimit - 1)*pCur->iStep);
}
}
if( returnNoRows ){
pCur->ss.iBase = 1;
pCur->ss.iTerm = 0;
pCur->ss.iStep = 1;
}
if( idxNum & 0x08 ){
pCur->ss.isReversing = pCur->ss.iStep > 0;
}else{
pCur->ss.isReversing = pCur->ss.iStep < 0;
}
setupSequence( &pCur->ss );
pCur->iValue = pCur->iBase;
pCur->bDone = 0;
return SQLITE_OK;
series_no_rows:
pCur->iBase = 0;
pCur->iTerm = 0;
pCur->iStep = 1;
pCur->bDesc = 0;
pCur->bDone = 1;
return SQLITE_OK;
}
/*
+4
View File
@@ -206,6 +206,10 @@ static int vtablogConnectCreate(
}
if( zSchema==0 ){
zSchema = sqlite3_mprintf("%s","CREATE TABLE x(a,b);");
if( zSchema==0 ){
rc = SQLITE_NOMEM;
goto vtablog_end_connect;
}
}
printf(" schema = '%s'\n", zSchema);
rc = sqlite3_declare_vtab(db, zSchema);
+26 -3
View File
@@ -115,9 +115,14 @@ static const char ZIPFILE_SCHEMA[] =
") WITHOUT ROWID;";
#define ZIPFILE_F_COLUMN_IDX 7 /* Index of column "file" in the above */
#define ZIPFILE_BUFFER_SIZE (64*1024)
#define ZIPFILE_MX_NAME (250) /* Windows limitation on filename size */
/*
** The buffer should be large enough to contain 3 65536 byte strings - the
** filename, the extra field and the file comment.
*/
#define ZIPFILE_BUFFER_SIZE (200*1024)
/*
** Magic numbers used to read and write zip files.
@@ -800,6 +805,15 @@ static void zipfileMtimeToDos(ZipfileCDS *pCds, u32 mUnixTime){
);
}
/*
** Set (*pzErr) to point to a buffer from sqlite3_malloc() containing a
** generic corruption message and return SQLITE_CORRUPT;
*/
static int zipfileCorrupt(char **pzErr){
*pzErr = sqlite3_mprintf("zip archive is corrupt");
return SQLITE_CORRUPT;
}
/*
** If aBlob is not NULL, then it is a pointer to a buffer (nBlob bytes in
** size) containing an entire zip archive image. Or, if aBlob is NULL,
@@ -822,12 +836,15 @@ static int zipfileGetEntry(
u8 *aRead;
char **pzErr = &pTab->base.zErrMsg;
int rc = SQLITE_OK;
(void)nBlob;
if( aBlob==0 ){
aRead = pTab->aBuffer;
rc = zipfileReadData(pFile, aRead, ZIPFILE_CDS_FIXED_SZ, iOff, pzErr);
}else{
if( (iOff+ZIPFILE_CDS_FIXED_SZ)>nBlob ){
/* Not enough data for the CDS structure. Corruption. */
return zipfileCorrupt(pzErr);
}
aRead = (u8*)&aBlob[iOff];
}
@@ -858,6 +875,9 @@ static int zipfileGetEntry(
);
}else{
aRead = (u8*)&aBlob[iOff + ZIPFILE_CDS_FIXED_SZ];
if( (iOff + ZIPFILE_CDS_FIXED_SZ + nFile + nExtra)>nBlob ){
rc = zipfileCorrupt(pzErr);
}
}
}
@@ -880,6 +900,9 @@ static int zipfileGetEntry(
rc = zipfileReadData(pFile, aRead, szFix, pNew->cds.iOffset, pzErr);
}else{
aRead = (u8*)&aBlob[pNew->cds.iOffset];
if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>nBlob ){
rc = zipfileCorrupt(pzErr);
}
}
if( rc==SQLITE_OK ) rc = zipfileReadLFH(aRead, &lfh);
@@ -888,7 +911,7 @@ static int zipfileGetEntry(
pNew->iDataOff += lfh.nFile + lfh.nExtra;
if( aBlob && pNew->cds.szCompressed ){
if( pNew->iDataOff + pNew->cds.szCompressed > nBlob ){
rc = SQLITE_CORRUPT;
rc = zipfileCorrupt(pzErr);
}else{
pNew->aData = &pNew->aExtra[nExtra];
memcpy(pNew->aData, &aBlob[pNew->iDataOff], pNew->cds.szCompressed);
+2 -2
View File
@@ -62,7 +62,7 @@
#else
#include "sqlite3.h"
#endif
int sqlite3GetToken(const unsigned char*,int*); /* In the SQLite core */
sqlite3_int64 sqlite3GetToken(const unsigned char*,int*); /* In SQLite core */
#include <stddef.h>
@@ -3775,7 +3775,7 @@ static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){
if( node.zData==0 ) return;
nData = sqlite3_value_bytes(apArg[1]);
if( nData<4 ) return;
if( nData<NCELL(&node)*tree.nBytesPerCell ) return;
if( nData<4+NCELL(&node)*tree.nBytesPerCell ) return;
pOut = sqlite3_str_new(0);
for(ii=0; ii<NCELL(&node); ii++){
+10
View File
@@ -47,4 +47,14 @@ ifcapable rtree_int_only {
do_rtree_integrity_test rtreeB-1.2 t1
# https://sqlite.org/forum/forumpost/2026-01-08T23:32:19Z
#
db null NULL
do_execsql_test rtreeB-2.1 {
SELECT rtreenode(1,x'00000001'||randomblob(15)) IS NULL;
} {1}
do_execsql_test rtreeB-2.2 {
SELECT rtreenode(1,x'00000001'||randomblob(16)) IS NOT NULL;
} {1}
finish_test
+3
View File
@@ -189,6 +189,7 @@ foreach {tn wo} {
2 " WITHOUT ROWID "
} {
reset_db
catch { db2 close }
forcedelete test.db2
do_execsql_test 4.$tn.0 "
CREATE TABLE x1(a INTEGER PRIMARY KEY, b, c) $wo;
@@ -229,6 +230,7 @@ foreach {tn wo} {
2 " WITHOUT ROWID "
} {
reset_db
catch { db2 close }
forcedelete test.db2
do_execsql_test 5.$tn.0 "
PRAGMA foreign_keys = ON;
@@ -275,6 +277,7 @@ foreach {tn wo} {
2 " WITHOUT ROWID "
} {
reset_db
catch { db2 close }
forcedelete test.db2
do_execsql_test 6.$tn.0 "
CREATE TABLE x1(a INTEGER PRIMARY KEY, b, c) $wo;
+1
View File
@@ -5385,6 +5385,7 @@ static int sessionChangesetApply(
assert( sApply.bRebase || sApply.rebase.nBuf==0 );
if( rc==SQLITE_OK && bPatchset==0 && sApply.bRebase ){
assert( ppRebase!=0 && pnRebase!=0 );
*ppRebase = (void*)sApply.rebase.aBuf;
*pnRebase = sApply.rebase.nBuf;
sApply.rebase.aBuf = 0;
+866 -562
View File
File diff suppressed because it is too large Load Diff
+20 -2
View File
@@ -1,8 +1,9 @@
This directory houses the [Web Assembly (WASM)](https://en.wikipedia.org/wiki/WebAssembly)
parts of the sqlite3 build.
It requires [emscripten][] and that the build environment be set up for
emscripten. A mini-HOWTO for setting that up follows...
It requires [emscripten][] and that the build environment be set up
for emscripten. _Release_ builds also require [the wabt tools](#wabt),
but dev builds do not. A mini-HOWTO for setting that up follows...
First, install the Emscripten SDK, as documented
[here](https://emscripten.org/docs/getting_started/downloads.html) and summarized
@@ -125,6 +126,23 @@ connection). Since the web-server is on a different machine from the
web-broser, the localhost requirement means that the connection must
be tunneled using SSH.
<a id="wabt"></a>
# The wabt Tools
_Release_ builds require the wabt tools:
<https://github.com/WebAssembly/wabt>
Specifically, we need `wasm-strip` so that the resulting WASM file is not
several megabytes.
Pre-built binaries can be downloaded from:
<https://github.com/WebAssembly/wabt/releases>
As of 2025-10-14, versions 1.36.0 or higher are known to work and
1.34.0 is known to not work with current Emscripten output.
[emscripten]: https://emscripten.org
[althttpd]: https://sqlite.org/althttpd
+11 -19
View File
@@ -63,16 +63,6 @@ if( 0 && globalThis.WorkerGlobalScope ){
});
}
}
const wPost = (function(){
return (('undefined'===typeof WorkerGlobalScope)
? ()=>{}
: (type, payload)=>{
postMessage({type, payload});
});
})();
//log("WorkerGlobalScope",globalThis.WorkerGlobalScope);
// Return a new enum entry value
const newE = ()=>Object.create(null);
@@ -522,6 +512,8 @@ class SQLTester {
}
runTests(){
this.outln("SQLite version ", sqlite3.capi.sqlite3_libversion()," with ",
sqlite3.wasm.ptr.size, "-byte WASM pointers");
const tStart = (new Date()).getTime();
let isVerbose = this.verbosity();
this.metrics.failedScripts.length = 0;
@@ -638,16 +630,16 @@ class SQLTester {
const sb = (ResultBufferMode.NONE===appendMode) ? null : this.#resultBuffer;
let rc = 0;
wasm.scopedAllocCall(function(){
let sqlByteLen = sql.byteLength;
let sqlByteLen = Number(sql.byteLength);
const ppStmt = wasm.scopedAlloc(
/* output (sqlite3_stmt**) arg and pzTail */
(2 * wasm.ptrSizeof) + (sqlByteLen + 1/* SQL + NUL */)
(2 * wasm.ptr.size) /* output (sqlite3_stmt**) arg and pzTail */
+ (sqlByteLen + 1/* SQL + NUL */)
);
const pzTail = ppStmt + wasm.ptrSizeof /* final arg to sqlite3_prepare_v2() */;
let pSql = pzTail + wasm.ptrSizeof;
const pSqlEnd = pSql + sqlByteLen;
wasm.heap8().set(sql, pSql);
wasm.poke8(pSql + sqlByteLen, 0/*NUL terminator*/);
const pzTail = wasm.ptr.add(ppStmt, wasm.ptr.size) /* final arg to sqlite3_prepare_v2() */;
let pSql = wasm.ptr.add(pzTail, wasm.ptr.size);
const pSqlEnd = wasm.ptr.add(pSql, sqlByteLen);
wasm.heap8().set(sql, Number(pSql));
wasm.poke8(pSqlEnd, 0/*NUL terminator*/);
let pos = 0, n = 1, spacing = 0;
while( pSql && wasm.peek8(pSql) ){
wasm.pokePtr([ppStmt, pzTail], 0);
@@ -664,7 +656,7 @@ class SQLTester {
}
const pStmt = wasm.peekPtr(ppStmt);
pSql = wasm.peekPtr(pzTail);
sqlByteLen = pSqlEnd - pSql;
sqlByteLen = Number(pSqlEnd - pSql);
if(!pStmt) continue /* only whitespace or comments */;
if( sb ){
const nCol = capi.sqlite3_column_count(pStmt);
@@ -47,6 +47,7 @@ _sqlite3_db_handle
_sqlite3_db_name
_sqlite3_db_readonly
_sqlite3_db_status
_sqlite3_db_status64
_sqlite3_deserialize
_sqlite3_errcode
_sqlite3_errmsg
@@ -32,6 +32,8 @@ _sqlite3changeset_apply
_sqlite3changeset_apply_strm
_sqlite3changeset_apply_v2
_sqlite3changeset_apply_v2_strm
_sqlite3changeset_apply_v3
_sqlite3changeset_apply_v3_strm
_sqlite3changeset_concat
_sqlite3changeset_concat_strm
_sqlite3changeset_conflict
+68 -30
View File
@@ -2,7 +2,7 @@
This is the README for the files `sqlite3-*.js` and
`sqlite3-wasm.c`. This collection of files is used to build a
single-file distribution of the sqlite3 WASM API. It is broken into
single-file distribution of the sqlite3 JS/WASM API. It is broken into
multiple JS files because:
1. To facilitate including or excluding certain components for
@@ -12,17 +12,53 @@ multiple JS files because:
2. To facilitate modularizing the pieces for use in different WASM
build environments. e.g. the files `post-js-*.js` are for use with
Emscripten's `--post-js` feature, and nowhere else.
As-yet-hypothetical comparable toolchains would necessarily have
similar facilities.
3. Certain components must be in their own standalone files in order
to be loaded as JS Workers.
The structure described here is the current state of things, as of
this writing, but is not set in stone forever and may change at any
time.
time. This doc targets maintainers of this code and those wanting to
dive in to the details, not end user.
The overall idea is that the following files get concatenated
together, in the listed order, the resulting file is loaded by a
browser client:
First off, a pikchr of the proverbial onion:
```pikchr toggle center
scale = 0.85
D0: dot invis
define matryoshka {
$rad = $rad + $2
circle with se at D0.c radius $rad
text at last.nw $1 below ljust
# $anchor = last circle.e
}
$rad = 5mm
C0: circle with se at D0.c "sqlite3-api.js" fit
$rad = C0.width / 2
matryoshka("--post-js",5mm)
matryoshka("Emscripten",12mm)
circle with nw at 7mm s of 3mm e of last circle.nw "--pre-js" fit
matryoshka("--extern-pre/post-js",9mm)
matryoshka("sqlite3.js",6mm)
#CX: last circle
right
CW: file with w at 15mm e of 3rd circle.ne "sqlite3.wasm" fit
arrow from CW.w to 3rd circle.ne
CC: circle with e at 1cm w of last circle.w "End User" fit radius 1cm
arrow <- from CC.e to 6th circle.w
```
Actually, `sqlite3.js` and `--extern-js` are the same. The former is
what the client sees and the latter is how it looks from a code
maintenance point of view.
At the center of the onion is `sqlite3-api.js`, which gets generated
by concatenating the following files together in their listed order:
- **`sqlite3-api-prologue.js`**\
Contains the initial bootstrap setup of the sqlite3 API
@@ -50,10 +86,10 @@ browser client:
- **`sqlite3-api-glue.js`**\
Invokes functionality exposed by the previous two files to flesh out
low-level parts of `sqlite3-api-prologue.js`. Most of these pieces
involve populating the `sqlite3.capi.wasm` object. This file also
deletes most global-scope symbols the above files create,
effectively moving them into the scope being used for initializing
the API.
involve populating the `sqlite3.capi.wasm` object and creating
`sqlite3.capi.sqlite3_...()` bindings. This file also deletes most
global-scope symbols the above files create, effectively moving them
into the scope being used for initializing the API.
- **`<build>/sqlite3-api-build-version.js`**\
Gets created by the build process and populates the
`sqlite3.version` object. This part is not critical, but records the
@@ -117,21 +153,18 @@ browser client:
**Files with the extension `.c-pp.js`** are intended [to be processed
with `c-pp`](#c-pp), noting that such preprocessing may be applied
after all of the relevant files are concatenated. That extension is
used primarily to keep the code maintainers cognisant of the fact that
those files contain constructs which may not run as-is in any given
JavaScript environment.
after all of the relevant files are concatenated. The `.c-pp.js`
extension is used primarily to keep the code maintainers cognisant of
the fact that those files contain constructs which may not run as-is
in any given JavaScript environment.
The build process glues those files together, resulting in
`sqlite3-api.js`, which is everything except for the
`pre/post-js-*.js` files, and `sqlite3.js`, which is the
Emscripten-generated amalgamated output and includes the
`pre/post-js-*.js` parts, as well as the Emscripten-provided module
loading pieces.
`sqlite3-api.js`, which is everything except for the Emscripten-specific
files detailed below (into which `sqlite3-api.js` gets injected).
The non-JS outlier file is `sqlite3-wasm.c`: it is a proxy for
`sqlite3.c` which `#include`'s that file and adds a couple more
WASM-specific helper functions, at least one of which requires access
`sqlite3.c` which `#include`'s that file and adds a handful of
WASM-specific helper functions, at least two of which requires access
to private/static `sqlite3.c` internals. `sqlite3.wasm` is compiled
from this file rather than `sqlite3.c`.
@@ -144,21 +177,26 @@ build-generated `sqlite3.js` along with `sqlite3-api.js`.
purposes and holds no code relevant to the production deliverables.
- **`pre-js.c-pp.js`**\
Emscripten-specific header for Emscripten's `--pre-js` flag. This
file is intended as a place to override certain Emscripten behavior
before it starts up, but corner-case Emscripten bugs keep that from
being a reality.
file overrides certain Emscripten behavior before Emscripten does
most of its work.
- **`post-js-header.js`**\
Emscripten-specific header for the `--post-js` input. It opens up
a lexical scope by starting a post-run handler for Emscripten.
Emscripten-specific header for the `--post-js` input. It opens up,
but does not close, a function used for initializing the library.
- (**`sqlite3-api.js`** gets sandwiched between these &uarr; two
&darr; files.)
- **`post-js-footer.js`**\
Emscripten-specific footer for the `--post-js` input. This closes
off the lexical scope opened by `post-js-header.js`.
off the function opened by `post-js-header.js`.
- **`extern-post-js.c-pp.js`**\
Emscripten-specific header for Emscripten's `--extern-post-js`
flag. This file overwrites the Emscripten-installed
`sqlite3InitModule()` function with one which, after the module is
loaded, also initializes the asynchronous parts of the sqlite3
module. For example, the [OPFS][] VFS support.
flag. This file is run in the global scope. It overwrites the
Emscripten-installed `sqlite3InitModule()` function with one which
first runs the original implementation, then runs the function
installed by `post-js-header/footer.js` to initialize the library,
then initializes the asynchronous parts of the sqlite3 module (for
example, the [OPFS][] VFS support). Its final step is to return a
Promise of the sqlite3 namespace object to the caller of
`sqlite3InitModule()` (the library user).
<a id='c-pp'></a>
Preprocessing of Source Files
+55 -49
View File
@@ -1,13 +1,18 @@
/* ^^^^ ACHTUNG: blank line at the start is necessary because
Emscripten will not add a newline in some cases and we need
a blank line for a sed-based kludge for the ES6 build. */
/* extern-post-js.js must be appended to the resulting sqlite3.js
a blank line for a sed-based kludge for the ES6 build.
extern-post-js.js must be appended to the resulting sqlite3.js
file. It gets its name from being used as the value for the
--extern-post-js=... Emscripten flag. This code, unlike most of the
associated JS code, runs outside of the Emscripten-generated module
init scope, in the current global scope. */
//#if target=es6-module
init scope, in the current global scope.
At the time this is run, the global-scope sqlite3InitModule
function will have just been defined.
*/
//#if target:es6-module
const toExportForESM =
//#endif
(function(){
@@ -18,10 +23,6 @@ const toExportForESM =
documentation by being able to elide those details), we hide that
function and expose a hand-written sqlite3InitModule() to return
the sqlite3 object (most of the time).
Unfortunately, we cannot modify the module-loader/exporter-based
impls which Emscripten installs at some point in the file above
this.
*/
const originalInit = sqlite3InitModule;
if(!originalInit){
@@ -38,40 +39,51 @@ const toExportForESM =
into the global scope and delete it when sqlite3InitModule()
is called.
*/
const initModuleState = globalThis.sqlite3InitModuleState = Object.assign(Object.create(null),{
const sIMS = globalThis.sqlite3InitModuleState = Object.assign(Object.create(null),{
moduleScript: globalThis?.document?.currentScript,
isWorker: ('undefined' !== typeof WorkerGlobalScope),
location: globalThis.location,
urlParams: globalThis?.location?.href
? new URL(globalThis.location.href).searchParams
: new URLSearchParams()
: new URLSearchParams(),
/*
It is literally impossible to reliably get the name of _this_ script
at runtime, so impossible to reliably derive X.wasm from script name
X.js. (This is apparently why Emscripten hard-codes the name of the
wasm file into their output.) Thus we need, at build-time, to set
the name of the WASM file which our custom instantiateWasm() should to
load. The build process populates this.
Module.instantiateWasm() is found in pre-js.c-pp.js.
*/
wasmFilename: '@sqlite3.wasm@' /* replaced by the build process */
});
initModuleState.debugModule =
initModuleState.urlParams.has('sqlite3.debugModule')
sIMS.debugModule =
sIMS.urlParams.has('sqlite3.debugModule')
? (...args)=>console.warn('sqlite3.debugModule:',...args)
: ()=>{};
if(initModuleState.urlParams.has('sqlite3.dir')){
initModuleState.sqlite3Dir = initModuleState.urlParams.get('sqlite3.dir') +'/';
}else if(initModuleState.moduleScript){
const li = initModuleState.moduleScript.src.split('/');
if(sIMS.urlParams.has('sqlite3.dir')){
sIMS.sqlite3Dir = sIMS.urlParams.get('sqlite3.dir') +'/';
}else if(sIMS.moduleScript){
const li = sIMS.moduleScript.src.split('/');
li.pop();
initModuleState.sqlite3Dir = li.join('/') + '/';
sIMS.sqlite3Dir = li.join('/') + '/';
}
globalThis.sqlite3InitModule = function ff(...args){
const sIM = globalThis.sqlite3InitModule = function ff(...args){
//console.warn("Using replaced sqlite3InitModule()",globalThis.location);
return originalInit(...args).then((EmscriptenModule)=>{
//console.warn("originalInit() then() arg =",EmscriptenModule);
//console.warn("initModuleState =",initModuleState);
EmscriptenModule.runSQLite3PostLoadInit(EmscriptenModule);
const s = EmscriptenModule.sqlite3;
s.scriptInfo = initModuleState;
//console.warn("sqlite3.scriptInfo =",s.scriptInfo);
if(ff.__isUnderTest) s.__isUnderTest = true;
const f = s.asyncPostInit;
delete s.asyncPostInit;
const rv = f();
sIMS.debugModule("sqlite3InitModule() sIMS =",sIMS);
sIMS.debugModule("sqlite3InitModule() EmscriptenModule =",EmscriptenModule);
const s = EmscriptenModule.runSQLite3PostLoadInit(
sIMS,
EmscriptenModule /* see post-js-header/footer.js */,
!!ff.__isUnderTest
);
sIMS.debugModule("sqlite3InitModule() sqlite3 =",s);
//const rv = s.asyncPostInit();
//delete s.asyncPostInit;
//#if wasmfs
if('undefined'!==typeof WorkerGlobalScope &&
EmscriptenModule['ENVIRONMENT_IS_PTHREAD']){
@@ -84,46 +96,40 @@ const toExportForESM =
return EmscriptenModule;
}
//#endif
return rv;
return s;
}).catch((e)=>{
console.error("Exception loading sqlite3 module:",e);
throw e;
});
};
globalThis.sqlite3InitModule.ready = originalInit.ready;
sIM.ready = originalInit.ready;
if(globalThis.sqlite3InitModuleState.moduleScript){
const sim = globalThis.sqlite3InitModuleState;
let src = sim.moduleScript.src.split('/');
if(sIMS.moduleScript){
let src = sIMS.moduleScript.src.split('/');
src.pop();
sim.scriptDir = src.join('/') + '/';
sIMS.scriptDir = src.join('/') + '/';
}
initModuleState.debugModule('sqlite3InitModuleState =',initModuleState);
if(0){
console.warn("Replaced sqlite3InitModule()");
console.warn("globalThis.location.href =",globalThis.location.href);
if('undefined' !== typeof document){
console.warn("document.currentScript.src =",
document?.currentScript?.src);
}
}
//#ifnot target=es6-module
sIMS.debugModule('extern-post-js.c-pp.js sqlite3InitModuleState =',sIMS);
//#if not target:es6-module
// Emscripten does not inject these module-loader bits in ES6 module
// builds and including them here breaks JS bundlers, so elide them
// from ESM builds.
/* Replace the various module exports performed by the Emscripten
glue... */
if (typeof exports === 'object' && typeof module === 'object'){
module.exports = sqlite3InitModule;
module.exports = sIM;
module.exports.default = sIM;
}else if( 'function'===typeof define && define.amd ){
define([], ()=>sIM);
}else if (typeof exports === 'object'){
exports["sqlite3InitModule"] = sqlite3InitModule;
exports["sqlite3InitModule"] = sIM;
}
/* AMD modules get injected in a way we cannot override,
so we can't handle those here. */
//#endif // !target=es6-module
return globalThis.sqlite3InitModule /* required for ESM */;
//#endif // !target:es6-module
return sIM;
})();
//#if target=es6-module
//#if target:es6-module
sqlite3InitModule = toExportForESM;
export default sqlite3InitModule;
//#endif
+1 -4
View File
@@ -1,6 +1,3 @@
/* The current function scope was opened via post-js-header.js, which
gets prepended to this at build-time. This file closes that
scope. */
//console.warn("This is the end of the Module.runSQLite3PostLoadInit handler.");
}/*Module.runSQLite3PostLoadInit()*/;
}/*Module.runSQLite3PostLoadInit(...)*/;
//console.warn("This is the end of the setup of the (pending) Module.runSQLite3PostLoadInit");
+30 -20
View File
@@ -1,33 +1,43 @@
/**
post-js-header.js is to be prepended to other code to create
post-js.js for use with Emscripten's --post-js flag. This code
requires that it be running in that context. The Emscripten
environment must have been set up already but it will not have
loaded its WASM when the code in this file is run. The function it
installs will be run after the WASM module is loaded, at which
point the sqlite3 JS API bits will get set up.
post-js.js for use with Emscripten's --post-js flag, so it gets
injected in the earliest stages of sqlite3InitModule().
This function wraps the whole SQLite3 library but does not
bootstrap it.
Running this function will bootstrap the library and return
a Promise to the sqlite3 namespace object.
*/
Module.runSQLite3PostLoadInit = function(EmscriptenModule/*the Emscripten-style module object*/){
Module.runSQLite3PostLoadInit = function(
sqlite3InitScriptInfo /* populated by extern-post-js.c-pp.js */,
EmscriptenModule/*the Emscripten-style module object*/,
sqlite3IsUnderTest
){
/** ^^^ Don't use Module.postRun, as that runs a different time
depending on whether this file is built with emcc 3.1.x or
4.0.x. This function name is intentionally obnoxiously verbose to
ensure that we don't collide with current and future Emscripten
symbol names. */
'use strict';
delete EmscriptenModule.runSQLite3PostLoadInit;
//console.warn("This is the start of Module.runSQLite3PostLoadInit()");
/* This function will contain at least the following:
- post-js-header.js => this file
- sqlite3-api-prologue.js => Bootstrapping bits to attach the rest to
- common/whwasmutil.js => Replacements for much of Emscripten's glue
- jaccwabyt/jaccwabyt.js => Jaccwabyt (C/JS struct binding)
- sqlite3-api-glue.js => glues previous parts together
- sqlite3-api-oo1.js => SQLite3 OO API #1
- sqlite3-api-worker1.js => Worker-based API
- sqlite3-vfs-helper.c-pp.js => Utilities for VFS impls
- sqlite3-vtab-helper.c-pp.js => Utilities for virtual table impls
- sqlite3-vfs-opfs.c-pp.js => OPFS VFS
- sqlite3-vfs-opfs-sahpool.c-pp.js => OPFS SAHPool VFS
- sqlite3-api-cleanup.js => final API cleanup
- post-js-footer.js => closes this function
- post-js-header.js => this file
- sqlite3-api-prologue.js => Bootstrapping bits for the following files
- common/whwasmutil.js => Generic JS/WASM glue
- jaccwabyt/jaccwabyt.js => C struct-binding glue
- sqlite3-api-glue.js => glues previous parts together
- sqlite3-api-oo1.js => SQLite3 OO API #1
- sqlite3-api-worker1.js => Worker-based API
- sqlite3-vfs-helper.c-pp.js => Utilities for VFS impls
- sqlite3-vtab-helper.c-pp.js => Utilities for virtual table impls
- sqlite3-vfs-opfs.c-pp.js => OPFS VFS
- sqlite3-vfs-opfs-sahpool.c-pp.js => OPFS SAHPool VFS
- sqlite3-api-cleanup.js => final bootstrapping phase
- post-js-footer.js => this file's epilogue
And all of that gets sandwiched between extern-pre-js.js and
extern-post-js.js.
*/
+100 -106
View File
@@ -2,120 +2,114 @@
BEGIN FILE: api/pre-js.js
This file is intended to be prepended to the sqlite3.js build using
Emscripten's --pre-js=THIS_FILE flag (or equivalent).
Emscripten's --pre-js=THIS_FILE flag (or equivalent). It is run
from inside of sqlite3InitModule(), after Emscripten's Module is
defined, but early enough that we can ammend, or even outright
replace, Module from here.
Because this runs in-between Emscripten's own bootstrapping and
Emscripten's main work, we must be careful with file-local symbol
names. e.g. don't overwrite anything Emscripten defines and do not
use 'const' for local symbols which Emscripten might try to use for
itself. i.e. try to keep file-local symbol names obnoxiously
collision-resistant.
*/
(function(Module){
const sIMS =
globalThis.sqlite3InitModuleState/*from extern-post-js.c-pp.js*/
|| Object.assign(Object.create(null),{
debugModule: ()=>{
console.warn("globalThis.sqlite3InitModuleState is missing");
}
});
delete globalThis.sqlite3InitModuleState;
sIMS.debugModule('pre-js.js sqlite3InitModuleState =',sIMS);
// See notes in extern-post-js.js
const sqlite3InitModuleState = globalThis.sqlite3InitModuleState
|| Object.assign(Object.create(null),{
debugModule: ()=>{}
});
delete globalThis.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('globalThis.location =',globalThis.location);
/**
This custom locateFile() tries to figure out where to load `path`
from. The intent is to provide a way for foo/bar/X.js loaded from a
Worker constructor or importScripts() to be able to resolve
foo/bar/X.wasm (in the latter case, with some help):
//#ifnot target=es6-bundler-friendly
/**
This custom locateFile() tries to figure out where to load `path`
from. The intent is to provide a way for foo/bar/X.js loaded from a
Worker constructor or importScripts() to be able to resolve
foo/bar/X.wasm (in the latter case, with some help):
1) If URL param named the same as `path` is set, it is returned.
1) If URL param named the same as `path` is set, it is returned.
2) If sqlite3InitModuleState.sqlite3Dir is set, then (thatName + path)
is returned (it's assumed to end with '/').
2) If sqlite3InitModuleState.sqlite3Dir is set, then (thatName + path)
is returned (it's assumed to end with '/').
3) If this code is running in the main UI thread AND it was loaded
from a SCRIPT tag, the directory part of that URL is used
as the prefix. (This form of resolution unfortunately does not
function for scripts loaded via importScripts().)
3) If this code is running in the main UI thread AND it was loaded
from a SCRIPT tag, the directory part of that URL is used
as the prefix. (This form of resolution unfortunately does not
function for scripts loaded via importScripts().)
4) If none of the above apply, (prefix+path) is returned.
4) If none of the above apply, (prefix+path) is returned.
*/
Module['locateFile'] = function(path, prefix) {
//#if target=es6-module
return new URL(path, import.meta.url).href;
None of the above apply in ES6 builds, which uses a much simpler
approach.
*/
Module['locateFile'] = function(path, prefix) {
//#if target:es6-module
return new URL(path, import.meta.url).href;
//#else
'use strict';
let theFile;
const up = this.urlParams;
if(up.has(path)){
theFile = up.get(path);
}else if(this.sqlite3Dir){
theFile = this.sqlite3Dir + path;
}else if(this.scriptDir){
theFile = this.scriptDir + path;
}else{
theFile = prefix + path;
}
this.debugModule(
"locateFile(",arguments[0], ',', arguments[1],")",
'sqlite3InitModuleState.scriptDir =',this.scriptDir,
'up.entries() =',Array.from(up.entries()),
"result =", theFile
);
return theFile;
//#endif target=es6-module
}.bind(sqlite3InitModuleState);
//#endif ifnot target=es6-bundler-friendly
'use strict';
let theFile;
const up = this.urlParams;
if(up.has(path)){
theFile = up.get(path);
}else if(this.sqlite3Dir){
theFile = this.sqlite3Dir + path;
}else if(this.scriptDir){
theFile = this.scriptDir + path;
}else{
theFile = prefix + path;
}
this.debugModule(
"locateFile(",arguments[0], ',', arguments[1],")",
'sqlite3InitModuleState.scriptDir =',this.scriptDir,
'up.entries() =',Array.from(up.entries()),
"result =", theFile
);
return theFile;
//#endif target:es6-module
}.bind(sIMS);
//#if custom-Module.instantiateModule
/**
Bug warning: a custom Module.instantiateWasm() does not work
in WASMFS builds:
//#if Module.instantiateWasm
//#if not wasmfs
/**
Override Module.instantiateWasm().
https://github.com/emscripten-core/emscripten/issues/17951
A custom Module.instantiateWasm() does not work in WASMFS builds:
In such builds we must disable this.
*/
const xNameOfInstantiateWasm =
//#if wasmfs
false
//#else
true /* This works, but it does not have the testing coverage in the
wild which Emscripten's default impl does, so we'll save
this option until we really need a custom
Module.instantiateWasm() */
//#endif
? 'instantiateWasm'
: 'emscripten-bug-17951';
Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
imports.env.foo = function(){};
const uri = Module.locateFile(
callee.uri, (
('undefined'===typeof scriptDirectory/*var defined by Emscripten glue*/)
? "" : scriptDirectory)
);
sqlite3InitModuleState.debugModule(
"instantiateWasm() uri =", uri
);
//console.warn("Custom instantiateModule",uri);
const wfetch = ()=>fetch(uri, {credentials: 'same-origin'});
const loadWasm = WebAssembly.instantiateStreaming
? async ()=>{
return WebAssembly.instantiateStreaming(wfetch(), imports)
.then((arg)=>onSuccess(arg.instance, arg.module));
}
: async ()=>{ // Safari < v15
return wfetch()
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports))
.then((arg)=>onSuccess(arg.instance, arg.module));
};
loadWasm();
return {};
};
/*
It is literally impossible to reliably get the name of _this_ script
at runtime, so impossible to derive X.wasm from script name
X.js. Thus we need, at build-time, to redefine
Module[xNameOfInstantiateWasm].uri by appending it to a build-specific
copy of this file with the name of the wasm file. This is apparently
why Emscripten hard-codes the name of the wasm file into their glue
scripts.
*/
Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm';
//#endif custom-Module.instantiateModule
/* END FILE: api/pre-js.js, noting that the build process may add a
line after this one to change the above .uri to a build-specific
one. */
https://github.com/emscripten-core/emscripten/issues/17951
In such builds we must disable this.
*/
Module['instantiateWasm'] = function callee(imports,onSuccess){
const sims = this;
const uri = Module.locateFile(
sims.wasmFilename, (
('undefined'===typeof scriptDirectory/*var defined by Emscripten glue*/)
? "" : scriptDirectory)
);
sims.debugModule("instantiateWasm() uri =", uri, "sIMS =",this);
const wfetch = ()=>fetch(uri, {credentials: 'same-origin'});
const finalThen = (arg)=>{
arg.imports = imports;
sims.instantiateWasm = arg /* used by sqlite3-api-prologue.c-pp.js */;
onSuccess(arg.instance, arg.module);
};
const loadWasm = WebAssembly.instantiateStreaming
? async ()=>
WebAssembly
.instantiateStreaming(wfetch(), imports)
.then(finalThen)
: async ()=>// Safari < v15
wfetch()
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports))
.then(finalThen)
return loadWasm();
}.bind(sIMS);
//#endif not wasmfs
//#endif Module.instantiateWasm
})(Module);
/* END FILE: api/pre-js.js. */
+57 -40
View File
@@ -15,52 +15,69 @@
that it can finalize any setup and clean up any global symbols
temporarily used for setting up the API's various subsystems.
In Emscripten builds it's run in the context of a Module.postRun
handler.
In Emscripten builds it's run in the context of what amounts to a
Module.postRun handler, though it's no longer actually a postRun
handler because Emscripten 4.0 changed postRun semantics in an
incompatible way.
In terms of amalgamation code placement, this file is appended
immediately after the final sqlite3-api-*.js piece. Those files
cooperate to prepare sqlite3ApiBootstrap() and this file calls it.
It is run within a context which gives it access to Emscripten's
Module object, after sqlite3.wasm is loaded but before
sqlite3ApiBootstrap() has been called.
Because this code resides (after building) inside the function
installed by post-js-header.js, it has access to the
*/
'use strict';
if('undefined' !== typeof Module){ // presumably an Emscripten build
/**
Install a suitable default configuration for sqlite3ApiBootstrap().
*/
const SABC = Object.assign(
Object.create(null), {
exports: ('undefined'===typeof wasmExports)
? Module['asm']/* emscripten <=3.1.43 */
: wasmExports /* emscripten >=3.1.44 */,
memory: Module.wasmMemory /* gets set if built with -sIMPORTED_MEMORY */
},
globalThis.sqlite3ApiConfig || {}
if( 'undefined' === typeof EmscriptenModule/*from post-js-header.js*/ ){
console.warn("This is not running in the context of Module.runSQLite3PostLoadInit()");
throw new Error("sqlite3-api-cleanup.js expects to be running in the "+
"context of its Emscripten module loader.");
}
try{
/* Config options for sqlite3ApiBootstrap(). */
const bootstrapConfig = Object.assign(
Object.create(null),
globalThis.sqlite3ApiBootstrap.defaultConfig, // default options
globalThis.sqlite3ApiConfig || {}, // optional client-provided options
/** The WASM-environment-dependent configuration for sqlite3ApiBootstrap() */
{
memory: ('undefined'!==typeof wasmMemory)
? wasmMemory
: EmscriptenModule['wasmMemory'],
exports: ('undefined'!==typeof wasmExports)
? wasmExports /* emscripten >=3.1.44 */
: (Object.prototype.hasOwnProperty.call(EmscriptenModule,'wasmExports')
? EmscriptenModule['wasmExports']
: EmscriptenModule['asm']/* emscripten <=3.1.43 */)
}
);
/** Figure out if this is a 32- or 64-bit WASM build. */
bootstrapConfig.wasmPtrIR =
'number'===(typeof bootstrapConfig.exports.sqlite3_libversion())
? 'i32' :'i64';
const sIMS = sqlite3InitScriptInfo;
sIMS.debugModule("Bootstrapping lib config", sIMS);
/**
For current (2022-08-22) purposes, automatically call
sqlite3ApiBootstrap(). That decision will be revisited at some
point, as we really want client code to be able to call this to
configure certain parts. Clients may modify
For purposes of the Emscripten build, call sqlite3ApiBootstrap().
Ideally clients should be able to inject their own config here,
but that's not practical in this particular build constellation
because of the order everything happens in. Clients may either
define globalThis.sqlite3ApiConfig or modify
globalThis.sqlite3ApiBootstrap.defaultConfig to tweak the default
configuration used by a no-args call to sqlite3ApiBootstrap(),
but must have first loaded their WASM module in order to be
able to provide the necessary configuration state.
but must have first loaded their WASM module in order to be able
to provide the necessary configuration state.
*/
//console.warn("globalThis.sqlite3ApiConfig = ",globalThis.sqlite3ApiConfig);
globalThis.sqlite3ApiConfig = SABC;
let sqlite3;
try{
sqlite3 = globalThis.sqlite3ApiBootstrap();
}catch(e){
console.error("sqlite3ApiBootstrap() error:",e);
throw e;
}finally{
delete globalThis.sqlite3ApiBootstrap;
delete globalThis.sqlite3ApiConfig;
}
Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
pass the sqlite3 object off to the client. */;
}else{
console.warn("This is not running in an Emscripten module context, so",
"globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack",
"of config info for the WASM environment.",
"It must be called manually.");
const p = globalThis.sqlite3ApiBootstrap(bootstrapConfig);
delete globalThis.sqlite3ApiBootstrap;
return p /* the eventual result of globalThis.sqlite3InitModule() */;
}catch(e){
console.error("sqlite3ApiBootstrap() error:",e);
throw e;
}
throw new Error("Maintenance required: this line should never be reached");
+126 -86
View File
@@ -243,21 +243,21 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
purpose. For example:
const pAuxDtor = wasm.installFunction('v(p)', function(ptr){
//free ptr
//free ptr
});
myDb.onclose = {
after: ()=>{
wasm.uninstallFunction(pAuxDtor);
}
after: ()=>{
wasm.uninstallFunction(pAuxDtor);
}
};
Then pass pAuxDtor as the final argument to appropriate
sqlite3_set_auxdata() calls.
Note that versions prior to 3.49.0 ostensibly had automatic
Prior to 3.49.0 this binding 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
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, [
@@ -323,7 +323,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
["sqlite3_vfs_register", "int", "sqlite3_vfs*", "int"],
["sqlite3_vfs_unregister", "int", "sqlite3_vfs*"]
/* This list gets extended below */
/* This list gets extended with optional pieces below */
]/*.core*/,
/**
Functions which require BigInt (int64) support are separated
@@ -358,12 +358,13 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
["sqlite3_serialize","*", "sqlite3*", "string", "*", "int"],
["sqlite3_set_last_insert_rowid", undefined, ["sqlite3*", "i64"]],
["sqlite3_status64", "int", "int", "*", "*", "int"],
["sqlite3_db_status64", "int", "sqlite3*", "int", "*", "*", "int"],
["sqlite3_total_changes64", "i64", ["sqlite3*"]],
["sqlite3_update_hook", "*", [
"sqlite3*",
new wasm.xWrap.FuncPtrAdapter({
name: 'sqlite3_update_hook',
signature: "v(iippj)",
name: 'sqlite3_update_hook::callback',
signature: "v(pippj)",
contextKey: (argv)=>argv[0/* sqlite3* */],
callProxy: (callback)=>{
return (p,op,z0,z1,rowid)=>{
@@ -375,7 +376,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
]],
["sqlite3_uri_int64", "i64", ["sqlite3_filename", "string", "i64"]],
["sqlite3_value_int64","i64", "sqlite3_value*"]
/* This list gets extended below */
/* This list gets extended with optional pieces below */
]/*.int64*/,
/**
Functions which are intended solely for API-internal use by the
@@ -435,12 +436,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
name: "sqlite3_set_authorizer::xAuth",
signature: "i(pi"+"ssss)",
contextKey: (argv, argIndex)=>argv[0/*(sqlite3*)*/],
/**
We use callProxy here to ensure (A) that exceptions
thrown from callback() have well-defined behavior and (B)
that its result is coerced to an integer.
*/
callProxy: (callback)=>{
return (pV, iCode, s0, s1, s2, s3)=>{
try{
s0 = s0 && wasm.cstrToJs(s0); s1 = s1 && wasm.cstrToJs(s1);
s2 = s2 && wasm.cstrToJs(s2); s3 = s3 && wasm.cstrToJs(s3);
return callback(pV, iCode, s0, s1, s2, s3) || 0;
return callback(pV, iCode, s0, s1, s2, s3) | 0;
}catch(e){
return e.resultCode || capi.SQLITE_ERROR;
}
@@ -470,12 +476,14 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
//#if enable-see
if( !!wasm.exports.sqlite3_key_v2 ){
/**
This code is capable of using an SEE build but note that an SEE
WASM build is generally incompatible with SEE's license
conditions. It is permitted for use internally in organizations
which have licensed SEE, but not for public sites because
exposing an SEE build of sqlite3.wasm effectively provides all
clients with a working copy of the commercial SEE code.
This code is capable of using an SEE build but an SEE WASM
build is generally incompatible with SEE's license conditions.
The project's official stance on WASM builds of SEE is: it is
permitted for use internally within organizations which have
licensed SEE, but not for sites made available to the public or
to unlicensed end users because exposing an SEE build of
sqlite3.wasm effectively provides all clients with a working
copy of SEE.
*/
bindingSignatures.core.push(
["sqlite3_key", "int", "sqlite3*", "string", "int"],
@@ -496,12 +504,12 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
["sqlite3_declare_vtab", "int", ["sqlite3*", "string:flexible"]],
["sqlite3_drop_modules", "int", ["sqlite3*", "**"]],
["sqlite3_vtab_collation","string","sqlite3_index_info*","int"],
/*["sqlite3_vtab_config" is variadic and requires a hand-written
proxy.] */
["sqlite3_vtab_distinct","int", "sqlite3_index_info*"],
["sqlite3_vtab_in","int", "sqlite3_index_info*", "int", "int"],
["sqlite3_vtab_in_first", "int", "sqlite3_value*", "**"],
["sqlite3_vtab_in_next", "int", "sqlite3_value*", "**"],
/*["sqlite3_vtab_config" is variadic and requires a hand-written
proxy.] */
["sqlite3_vtab_nochange","int", "sqlite3_context*"],
["sqlite3_vtab_on_conflict","int", "sqlite3*"],
["sqlite3_vtab_rhs_value","int", "sqlite3_index_info*", "int", "**"]
@@ -622,6 +630,31 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}),
'void*', '**', 'int*', 'int'
]],
['sqlite3changeset_apply_v3', 'int', [
'sqlite3*', 'int', 'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(pp)', bindScope: 'transient'
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
}),
'void*', '**', 'int*', 'int'
]],
['sqlite3changeset_apply_v3_strm', 'int', [
'sqlite3*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xInput', signature: 'i(ppp)', bindScope: 'transient'
}),
'void*',
new wasm.xWrap.FuncPtrAdapter({
name: 'xFilter', signature: 'i(pp)', bindScope: 'transient'
}),
new wasm.xWrap.FuncPtrAdapter({
name: 'xConflict', signature: 'i(pip)', bindScope: 'transient'
}),
'void*', '**', 'int*', 'int'
]],
['sqlite3changeset_concat', 'int', ['int','void*', 'int', 'void*', 'int*', '**']],
['sqlite3changeset_concat_strm', 'int', [
new wasm.xWrap.FuncPtrAdapter({
@@ -713,16 +746,19 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}/*session/changeset APIs*/
/**
Install JS<->C struct bindings for the non-opaque struct types we
Prepare JS<->C struct bindings for the non-opaque struct types we
need...
*/
sqlite3.StructBinder = globalThis.Jaccwabyt({
heap: 0 ? wasm.memory : wasm.heap8u,
heap: wasm.heap8u,
alloc: wasm.alloc,
dealloc: wasm.dealloc,
bigIntEnabled: wasm.bigIntEnabled,
pointerIR: wasm.ptr.ir,
memberPrefix: /* Never change this: this prefix is baked into any
amount of code and client-facing docs. */ '$'
amount of code and client-facing docs. (Much
later: it probably should have been '$$', but see
the previous sentence.) */ '$'
});
delete globalThis.Jaccwabyt;
@@ -745,16 +781,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
- Anything else: gets coerced to a JS string for use as a map
key. If a matching entry is found (as described next), it is
returned, else wasm.allocCString() is used to create a a new
string, map its pointer to (''+v) for the remainder of the
application's life, and returns that pointer value for this
call and all future calls which are passed a
string, map its pointer to a copy of (''+v) for the remainder
of the application's life, and returns that pointer value for
this call and all future calls which are passed a
string-equivalent argument.
Use case: sqlite3_bind_pointer() and sqlite3_result_pointer()
call for "a static string and preferably a string
literal." This converter is used to ensure that the string
value seen by those functions is long-lived and behaves as they
need it to.
Use case: sqlite3_bind_pointer(), sqlite3_result_pointer(), and
sqlite3_value_pointer() call for "a static string and
preferably a string literal". This converter is used to ensure
that the string value seen by those functions is long-lived and
behaves as they need it to, at the cost of a one-time leak of
each distinct key.
*/
wasm.xWrap.argAdapter(
'string:static',
@@ -822,6 +859,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
);
}
/**
Alias `T*` to `*` for return type conversions for common T
types, primarily to improve legibility of their binding
signatures.
*/
const __xRcPtr = wasm.xWrap.resultAdapter('*');
wasm.xWrap.resultAdapter('sqlite3*', __xRcPtr)
('sqlite3_context*', __xRcPtr)
@@ -834,15 +876,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Populate api object with sqlite3_...() by binding the "raw" wasm
exports into type-converting proxies using wasm.xWrap().
*/
if(0 === wasm.exports.sqlite3_step.length){
/* This environment wraps exports in nullary functions, which means
we must disable the arg-count validation we otherwise perform
on the wrappers. */
wasm.xWrap.doArgcCheck = false;
sqlite3.config.warn(
"Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks."
);
}
for(const e of bindingSignatures.core){
capi[e[0]] = wasm.xWrap.apply(null, e);
}
@@ -854,18 +887,16 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
wasm.bigIntEnabled is true, install a bogus impl which throws
if called when bigIntEnabled is false. The alternative would be
to elide these functions altogether, which seems likely to
cause more confusion. */
const fI64Disabled = function(fname){
return ()=>toss(fname+"() is unavailable due to lack",
"of BigInt support in this build.");
};
cause more confusion, as documented APIs would resolve to the
undefined value in incompatible builds. */
for(const e of bindingSignatures.int64){
capi[e[0]] = wasm.bigIntEnabled
? wasm.xWrap.apply(null, e)
: fI64Disabled(e[0]);
: ()=>toss(e[0]+"() is unavailable due to lack",
"of BigInt support in this build.");
}
/* We don't need these anymore... */
/* We're done with bindingSignatures but it's const, so... */
delete bindingSignatures.core;
delete bindingSignatures.int64;
delete bindingSignatures.wasmInternal;
@@ -910,7 +941,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
toss("Maintenance required: increase sqlite3__wasm_enum_json()'s",
"static buffer size!");
}
//console.debug('wasm.ctype length =',wasm.cstrlen(cJson));
wasm.ctype = JSON.parse(wasm.cstrToJs(cJson));
// Groups of SQLITE_xyz macros...
const defineGroups = ['access', 'authorizer',
@@ -949,6 +979,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
string, or undefined if no such mapping is found.
*/
capi.sqlite3_js_rc_str = (rc)=>__rcMap[rc];
/* Bind all registered C-side structs... */
const notThese = Object.assign(Object.create(null),{
// For each struct to NOT register, map its name to true:
@@ -968,7 +999,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
if(capi.sqlite3_index_info){
/* Move these inner structs into sqlite3_index_info. Binding
** them to WASM requires that we create global-scope structs to
** them to WASM requires that we create top-level structs to
** model them with, but those are no longer needed after we've
** passed them to StructBinder. */
for(const k of ['sqlite3_index_constraint',
@@ -1087,35 +1118,39 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
wasm.uninstallFunction() any WASM function bindings it has
installed for pDb.
*/
const closeArgs = [pDb];
for(const name of [
'sqlite3_busy_handler',
'sqlite3_commit_hook',
'sqlite3_preupdate_hook',
'sqlite3_progress_handler',
'sqlite3_rollback_hook',
'sqlite3_set_authorizer',
'sqlite3_trace_v2',
'sqlite3_update_hook'
for(const obj of [
/* pairs of [funcName, itsArityInC] */
['sqlite3_busy_handler',3],
['sqlite3_commit_hook',3],
['sqlite3_preupdate_hook',3],
['sqlite3_progress_handler',4],
['sqlite3_rollback_hook',3],
['sqlite3_set_authorizer',3],
['sqlite3_trace_v2', 4],
['sqlite3_update_hook',3]
/*
We do not yet have a way to clean up automatically-converted
sqlite3_set_auxdata() finalizers.
*/
]) {
]){
const [name, arity] = obj;
const x = wasm.exports[name];
if( !x ){
/* assume it was built without this API */
continue;
}
closeArgs.length = x.length/*==argument count*/
|| 1 /* Recall that: (A) undefined entries translate to 0 when
passed to WASM and (B) Safari wraps wasm.exports.* in
nullary functions so x.length is 0 there. */;
const closeArgs = [pDb];
closeArgs.length = arity
/* Recall that: (A) undefined entries translate to 0 when
passed to WASM and (B) Safari wraps wasm.exports.* in
nullary functions so x.length is 0 there. */;
//wasm.xWrap.debug = true;
try{ capi[name](...closeArgs) }
catch(e){
/* This "cannot happen" unless something is well and truly sideways. */
sqlite3.config.warn("close-time call of",name+"(",closeArgs,") threw:",e);
}
//wasm.xWrap.debug = false;
}
const m = __dbCleanupMap(pDb, 0);
if(!m) return;
@@ -1463,16 +1498,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
Helper for string:flexible conversions which requires a
byte-length counterpart argument. Passed a value and its
ostensible length, this function returns [V,N], where V is
either v or a transformed copy of v and N is either n (if v is
a WASM pointer), -1 (if v is a string or Array), or the byte
length of v (if it's a byte array or ArrayBuffer).
either v or a to-string transformed copy of v and N is either n
(if v is a WASM pointer, in which case n might be a BigInt), -1
(if v is a string or Array), or the byte length of v (if it's a
byte array or ArrayBuffer).
*/
const __flexiString = (v,n)=>{
if('string'===typeof v){
n = -1;
}else if(util.isSQLableTypedArray(v)){
n = v.byteLength;
v = util.typedArrayToString(
v = wasm.typedArrayToString(
(v instanceof ArrayBuffer) ? new Uint8Array(v) : v
);
}else if(Array.isArray(v)){
@@ -1517,15 +1553,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(f.length!==arguments.length){
return __dbArgcMismatch(pDb,"sqlite3_prepare_v3",f.length);
}
const [xSql, xSqlLen] = __flexiString(sql, sqlLen);
const [xSql, xSqlLen] = __flexiString(sql, Number(sqlLen));
switch(typeof xSql){
case 'string': return __prepare.basic(pDb, xSql, xSqlLen, prepFlags, ppStmt, null);
case 'number': return __prepare.full(pDb, xSql, xSqlLen, prepFlags, ppStmt, pzTail);
default:
return util.sqlite3__wasm_db_error(
pDb, capi.SQLITE_MISUSE,
"Invalid SQL argument type for sqlite3_prepare_v2/v3()."
);
case 'string': return __prepare.basic(pDb, xSql, xSqlLen, prepFlags, ppStmt, null);
case (typeof wasm.ptr.null):
return __prepare.full(pDb, wasm.ptr.coerce(xSql), xSqlLen, prepFlags,
ppStmt, pzTail);
default:
return util.sqlite3__wasm_db_error(
pDb, capi.SQLITE_MISUSE,
"Invalid SQL argument type for sqlite3_prepare_v2/v3(). typeof="+(typeof xSql)
);
}
};
@@ -1733,9 +1771,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
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);
@@ -1743,11 +1781,13 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
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), wasm.ptr.addn(zV, nBuf,- 1)
);
wasm.poke(wasm.ptr.add(zBuf, nBuf, -1), 0);
return nBuf - 1;
}catch(e){
console.error("kvstorageRead()",e);
sqlite3.config.error("kvstorageRead()",e);
return -2;
}finally{
pstack.restore(stack);
@@ -1763,7 +1803,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
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);
@@ -1777,7 +1817,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
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);
@@ -1874,7 +1914,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(this.ondispose.__removeFuncList){
this.ondispose.__removeFuncList.forEach(
(v,ndx)=>{
if('number'===typeof v){
if(wasm.isPtr(v)){
try{wasm.uninstallFunction(v)}
catch(e){/*ignore*/}
}
@@ -1904,7 +1944,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}
tgt[memKey] = fProxy;
}else{
const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name, true));
const pFunc = wasm.installFunction(fProxy, tgt.memberSignature(name));
tgt[memKey] = pFunc;
if(!tgt.ondispose || !tgt.ondispose.__removeFuncList){
tgt.addOnDispose('ondispose.__removeFuncList handler',
+37 -39
View File
@@ -1,4 +1,4 @@
//#ifnot omit-oo1
//#if not omit-oo1
/*
2022-07-22
@@ -263,13 +263,13 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
this.filename = capi.sqlite3_db_filename(pDb,'main');
}else{
let fn = opt.filename, vfsName = opt.vfs, flagsStr = opt.flags;
if(('string'!==typeof fn && 'number'!==typeof fn)
|| 'string'!==typeof flagsStr
|| (vfsName && ('string'!==typeof vfsName && 'number'!==typeof vfsName))){
if( ('string'!==typeof fn && !wasm.isPtr(fn))
|| 'string'!==typeof flagsStr
|| (vfsName && ('string'!==typeof vfsName && !wasm.isPtr(vfsName))) ){
sqlite3.config.error("Invalid DB ctor args",opt,arguments);
toss3("Invalid arguments for DB constructor.");
toss3("Invalid arguments for DB constructor:", arguments, "opts:", opt);
}
let fnJs = ('number'===typeof fn) ? wasm.cstrToJs(fn) : fn;
let fnJs = wasm.isPtr(fn) ? wasm.cstrToJs(fn) : fn;
const vfsCheck = ctor._name2vfs[fnJs];
if(vfsCheck){
vfsName = vfsCheck.vfs;
@@ -285,7 +285,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const stack = wasm.pstack.pointer;
try {
const pPtr = wasm.pstack.allocPtr() /* output (sqlite3**) arg */;
let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || 0);
let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || wasm.ptr.null);
pDb = wasm.peekPtr(pPtr);
checkSqlite3Rc(pDb, rc);
capi.sqlite3_extended_result_codes(pDb, 1);
@@ -747,12 +747,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
closed when onclose.after is called. If this db is not opened
when close() is called, neither of the handlers are called. Any
exceptions the handlers throw are ignored because "destructors
must not throw."
must not throw".
Note that garbage collection of a db handle, if it happens at
all, will never trigger close(), so onclose handlers are not a
reliable way to implement close-time cleanup or maintenance of
a db.
Garbage collection of a db handle, if it happens at all, will
never trigger close(), so onclose handlers are not a reliable
way to implement close-time cleanup or maintenance of a db.
If this instance was created using DB.wrapHandle() and does not
own this.pointer then it does not close the db handle but it
@@ -1052,14 +1051,14 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
let sqlByteLen = isTA ? arg.sql.byteLength : wasm.jstrlen(arg.sql);
const ppStmt = wasm.scopedAlloc(
/* output (sqlite3_stmt**) arg and pzTail */
(2 * wasm.ptrSizeof) + (sqlByteLen + 1/* SQL + NUL */)
(2 * wasm.ptr.size) + (sqlByteLen + 1/* SQL + NUL */)
);
const pzTail = ppStmt + wasm.ptrSizeof /* final arg to sqlite3_prepare_v2() */;
let pSql = pzTail + wasm.ptrSizeof;
const pSqlEnd = pSql + sqlByteLen;
const pzTail = wasm.ptr.add(ppStmt, wasm.ptr.size) /* final arg to sqlite3_prepare_v2() */;
let pSql = wasm.ptr.add(pzTail, wasm.ptr.size);
const pSqlEnd = wasm.ptr.add(pSql, sqlByteLen);
if(isTA) wasm.heap8().set(arg.sql, pSql);
else wasm.jstrcpy(arg.sql, wasm.heap8(), pSql, sqlByteLen, false);
wasm.poke(pSql + sqlByteLen, 0/*NUL terminator*/);
wasm.poke(wasm.ptr.add(pSql, sqlByteLen), 0/*NUL terminator*/);
while(pSql && wasm.peek(pSql, 'i8')
/* Maintenance reminder:^^^ _must_ be 'i8' or else we
will very likely cause an endless loop. What that's
@@ -1074,8 +1073,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
));
const pStmt = wasm.peekPtr(ppStmt);
pSql = wasm.peekPtr(pzTail);
sqlByteLen = pSqlEnd - pSql;
sqlByteLen = Number(wasm.ptr.add(pSqlEnd,-pSql));
if(!pStmt) continue;
//sqlite3.config.debug("exec() pSql =",capi.sqlite3_sql(pStmt));
if(saveSql) saveSql.push(capi.sqlite3_sql(pStmt).trim());
stmt = new Stmt(this, pStmt, BindTypes);
if(bind && stmt.parameterCount){
@@ -1130,11 +1130,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
sqlite3.config.warn("DB.exec() is propagating exception",opt,e);
throw e;
}*/finally{
wasm.scopedAllocPop(stack);
if(stmt){
__execLock.delete(stmt);
stmt.finalize();
}
wasm.scopedAllocPop(stack);
}
return arg.returnVal();
}/*exec()*/,
@@ -1283,9 +1283,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
toss3("xValue must be provided if xInverse is.");
}
const pApp = opt.pApp;
if(undefined!==pApp &&
null!==pApp &&
(('number'!==typeof pApp) || !util.isInt32(pApp))){
if( undefined!==pApp
&& null!==pApp
&& !wasm.isPtr(pApp) ){
toss3("Invalid value for pApp property. Must be a legal WASM pointer value.");
}
const xDestroy = opt.xDestroy || 0;
@@ -1586,18 +1586,17 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
If key is a number and within range of stmt's bound parameter
count, key is returned.
If key is not a number then it is checked against named
parameters. If a match is found, its index is returned.
If key is not a number then it must be a JS string (not a WASM
string) and it is checked against named parameters. If a match is
found, its index is returned.
Else it throws.
*/
const affirmParamIndex = function(stmt,key){
const n = ('number'===typeof key)
? key : capi.sqlite3_bind_parameter_index(stmt.pointer, key);
if(0===n || !util.isInt32(n)){
toss3("Invalid bind() parameter name: "+key);
}
else if(n<1 || n>stmt.parameterCount) toss3("Bind index",key,"is out of range.");
if( 0===n || !util.isInt32(n) ) toss3("Invalid bind() parameter name: "+key);
else if( n<1 || n>stmt.parameterCount ) toss3("Bind index",key,"is out of range.");
return n;
};
@@ -1708,7 +1707,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
"that it be a string, Uint8Array, Int8Array, or ArrayBuffer.");
}
const pBlob = wasm.alloc(val.byteLength || 1);
wasm.heap8().set(val.byteLength ? val : [0], pBlob)
wasm.heap8().set(val.byteLength ? val : [0], Number(pBlob))
rc = capi.sqlite3_bind_blob(stmt.pointer, ndx, pBlob, val.byteLength,
capi.SQLITE_WASM_DEALLOC);
break;
@@ -2092,15 +2091,14 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
const n = capi.sqlite3_column_bytes(this.pointer, ndx),
ptr = capi.sqlite3_column_blob(this.pointer, ndx),
rc = new Uint8Array(n);
//heap = n ? wasm.heap8() : false;
if(n) rc.set(wasm.heap8u().slice(ptr, ptr+n), 0);
//for(let i = 0; i < n; ++i) rc[i] = heap[ptr + i];
if(n && this.db._blobXfer instanceof Array){
/* This is an optimization soley for the
Worker-based API. These values will be
transfered to the main thread directly
instead of being copied. */
this.db._blobXfer.push(rc.buffer);
if(n){
rc.set(wasm.heap8u().slice(Number(ptr), Number(ptr)+n), 0);
if(this.db._blobXfer instanceof Array){
/* This is an optimization soley for the Worker1 API. It
will transfer these to the main thread directly
instead of copying them. */
this.db._blobXfer.push(rc.buffer);
}
}
return rc;
}
@@ -2349,4 +2347,4 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
});
//#else
/* Built with the omit-oo1 flag. */
//#endif ifnot omit-oo1
//#endif if not omit-oo1
+198 -174
View File
@@ -49,7 +49,8 @@
- `exports`[^1]: the "exports" object for the current WASM
environment. In an Emscripten-based build, this should be set to
`Module['asm']`.
`Module['asm']` (versions <=3.1.43) or `Module['wasmExports']`
(versions >=3.1.44).
- `memory`[^1]: optional WebAssembly.Memory object, defaulting to
`exports.memory`. In Emscripten environments this should be set
@@ -57,6 +58,10 @@
left undefined/falsy to default to `exports.memory` when using
WASM-exported memory.
- `functionTable`[^1]: optional WebAssembly.Table object holding
the indirect function table. If not set then the table is assumed
to be in `exports.__indirect_function_table`.
- `bigIntEnabled`: true if BigInt support is enabled. Defaults to
true if `globalThis.BigInt64Array` is available, else false. Some APIs
will throw exceptions if called without BigInt support, as BigInt
@@ -113,15 +118,21 @@
called, an alternative option for setting the configuration is to
define globalThis.sqlite3ApiConfig to an object. If it is set, it
is used instead of sqlite3ApiBootstrap.defaultConfig if
sqlite3ApiBootstrap() is called without arguments.
sqlite3ApiBootstrap() is called without arguments. Setting the
`exports` and `memory` parts require already having loaded the WASM
module, though.
Both sqlite3ApiBootstrap.defaultConfig and
globalThis.sqlite3ApiConfig get deleted by sqlite3ApiBootstrap()
because any changes to them made after that point would have no
useful effect.
This function returns a Promise to the sqlite3 namespace object,
which resolves after the async pieces of the library init are
complete.
*/
'use strict';
globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
globalThis.sqlite3ApiBootstrap = async function sqlite3ApiBootstrap(
apiConfig = (globalThis.sqlite3ApiConfig || sqlite3ApiBootstrap.defaultConfig)
){
if(sqlite3ApiBootstrap.sqlite3){ /* already initialized */
@@ -154,12 +165,12 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
allocExportName: config.useStdAlloc ? 'malloc' : 'sqlite3_malloc',
deallocExportName: config.useStdAlloc ? 'free' : 'sqlite3_free',
reallocExportName: config.useStdAlloc ? 'realloc' : 'sqlite3_realloc'
}, config);
});
[
// If any of these config options are functions, replace them with
// the result of calling that function...
'exports', 'memory', 'wasmfsOpfsDir'
// the result of calling that function. They must not be async.
'exports', 'memory', 'functionTable', 'wasmfsOpfsDir'
].forEach((k)=>{
if('function' === typeof config[k]){
config[k] = config[k]();
@@ -207,7 +218,10 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
};
/** Internal helper for SQLite3Error ctor. */
const __isInt = (n)=>'number'===typeof n && n===(n | 0);
const isInt32 = (n)=>
'number'===typeof n
&& n===(n | 0)
&& n<=2147483647 && n>=-2147483648;
/**
An Error subclass specifically for reporting DB-level errors and
@@ -241,7 +255,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
constructor(...args){
let rc;
if(args.length){
if(__isInt(args[0])){
if(isInt32(args[0])){
rc = args[0];
if(1===args.length){
super(__rcStr(args[0]));
@@ -284,16 +298,6 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
toss3("config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.");
}
/**
Returns true if n is a 32-bit (signed) integer, else
false. This is used for determining when we need to switch to
double-type DB operations for integer values in order to keep
more precision.
*/
const isInt32 = (n)=>{
return ('bigint'!==typeof n /*TypeError: can't convert BigInt to number*/)
&& !!(n===(n|0) && n<=2147483647 && n>=-2147483648);
};
/**
Returns true if the given BigInt value is small enough to fit
into an int64 value, else false.
@@ -329,32 +333,6 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
return (v && v.constructor && isInt32(v.constructor.BYTES_PER_ELEMENT)) ? v : false;
};
/** Internal helper to use in operations which need to distinguish
between TypedArrays which are backed by a SharedArrayBuffer
from those which are not. */
const __SAB = ('undefined'===typeof SharedArrayBuffer)
? function(){} : SharedArrayBuffer;
/** Returns true if the given TypedArray object is backed by a
SharedArrayBuffer, else false. */
const isSharedTypedArray = (aTypedArray)=>(aTypedArray.buffer instanceof __SAB);
/**
Returns either aTypedArray.slice(begin,end) (if
aTypedArray.buffer is a SharedArrayBuffer) or
aTypedArray.subarray(begin,end) (if it's not).
This distinction is important for APIs which don't like to
work on SABs, e.g. TextDecoder, and possibly for our
own APIs which work on memory ranges which "might" be
modified by other threads while they're working.
*/
const typedArrayPart = (aTypedArray, begin, end)=>{
return isSharedTypedArray(aTypedArray)
? aTypedArray.slice(begin, end)
: aTypedArray.subarray(begin, end);
};
/**
Returns true if v appears to be one of our bind()-able TypedArray
types: Uint8Array or Int8Array or ArrayBuffer. Support for
@@ -363,11 +341,10 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
property can be used to pass them as an ArrayBuffer. If it's not
a bindable array type, a falsy value is returned.
*/
const isBindableTypedArray = (v)=>{
return v && (v instanceof Uint8Array
|| v instanceof Int8Array
|| v instanceof ArrayBuffer);
};
const isBindableTypedArray = (v)=>
v && (v instanceof Uint8Array
|| v instanceof Int8Array
|| v instanceof ArrayBuffer);
/**
Returns true if v appears to be one of the TypedArray types
@@ -378,43 +355,31 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
and friends to the isBindableTypedArray() list but not to the
isSQLableTypedArray() list.
*/
const isSQLableTypedArray = (v)=>{
return v && (v instanceof Uint8Array
|| v instanceof Int8Array
|| v instanceof ArrayBuffer);
};
const isSQLableTypedArray = (v)=>
v && (v instanceof Uint8Array
|| v instanceof Int8Array
|| v instanceof ArrayBuffer);
/** Returns true if isBindableTypedArray(v) does, else throws with a message
that v is not a supported TypedArray value. */
const affirmBindableTypedArray = (v)=>{
return isBindableTypedArray(v)
|| toss3("Value is not of a supported TypedArray type.");
};
const utf8Decoder = new TextDecoder('utf-8');
/**
Uses TextDecoder to decode the given half-open range of the
given TypedArray to a string. This differs from a simple
call to TextDecoder in that it accounts for whether the
first argument is backed by a SharedArrayBuffer or not,
and can work more efficiently if it's not (TextDecoder
refuses to act upon an SAB).
*/
const typedArrayToString = function(typedArray, begin, end){
return utf8Decoder.decode(typedArrayPart(typedArray, begin,end));
};
const affirmBindableTypedArray = (v)=>
isBindableTypedArray(v)
|| toss3("Value is not of a supported TypedArray type.");
/**
If v is-a Array, its join("") result is returned. If
isSQLableTypedArray(v) is true then typedArrayToString(v) is
isSQLableTypedArray(v) is true then wasm.typedArrayToString(v) is
returned. If it looks like a WASM pointer, wasm.cstrToJs(v) is
returned. Else v is returned as-is.
Reminder to self: the "return as-is" instead of returning ''+v is
arguably a design mistake but changing it is risky at this point.
*/
const flexibleString = function(v){
if(isSQLableTypedArray(v)){
return typedArrayToString(
(v instanceof ArrayBuffer) ? new Uint8Array(v) : v
return wasm.typedArrayToString(
(v instanceof ArrayBuffer) ? new Uint8Array(v) : v,
0, v.length
);
}
else if(Array.isArray(v)) return v.join("");
@@ -787,13 +752,11 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
bigIntFits32, bigIntFits64, bigIntFitsDouble,
isBindableTypedArray,
isInt32, isSQLableTypedArray, isTypedArray,
typedArrayToString,
isUIThread: ()=>(globalThis.window===globalThis && !!globalThis.document),
// is this true for ESM?: 'undefined'===typeof WorkerGlobalScope
isSharedTypedArray,
toss: function(...args){throw new Error(args.join(' '))},
toss3,
typedArrayPart,
typedArrayPart: wasm.typedArrayPart,
/**
Given a byte array or ArrayBuffer, this function throws if the
lead bytes of that buffer do not hold a SQLite3 database header,
@@ -831,20 +794,19 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
}
}/*util*/;
/**
wasm.X properties which are used for configuring the wasm
environment via whwashutil.js.
*/
Object.assign(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.
pointer-type values. If set then it MUST be one of 'i32' or
'i64' (else an exception will be thrown). If it's not set, it
will default to 'i32'.
*/
ptrIR: config.wasmPtrIR || "i32",
pointerIR: config.wasmPtrIR,
/**
True if BigInt support was enabled via (e.g.) the
Emscripten -sWASM_BIGINT flag, else false. When
@@ -853,6 +815,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
impedance mismatches.
*/
bigIntEnabled: !!config.bigIntEnabled,
/**
The symbols exported by the WASM environment.
*/
@@ -865,11 +828,18 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
the other way around. In this case, the memory is not
available via this.exports.memory.
*/
memory: config.memory || config.exports['memory']
memory: config.memory
|| config.exports['memory']
|| toss3("API config object requires a WebAssembly.Memory object",
"in either config.exports.memory (exported)",
"or config.memory (imported)."),
/**
WebAssembly.Table object holding the indirect function call
table. Defaults to exports.__indirect_function_table.
*/
functionTable: config.functionTable,
/**
The API's primary point of access to the WASM-side memory
allocator. Works like sqlite3_malloc() but throws a
@@ -888,8 +858,8 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
catch exceptions and convert them to appropriate error codes.
For cases where non-throwing allocation is required, use
this.alloc.impl(), which is direct binding of the
underlying C-level allocator.
this.alloc.impl(), which is the unadulterated WASM-exported
counterpart of this wrapper.
Design note: this function is not named "malloc" primarily
because Emscripten uses that name and we wanted to avoid any
@@ -952,9 +922,10 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
}
affirmBindableTypedArray(srcTypedArray);
const pRet = wasm.alloc(srcTypedArray.byteLength || 1);
wasm.heapForSize(srcTypedArray.constructor).set(
srcTypedArray.byteLength ? srcTypedArray : [0], pRet
);
wasm.heapForSize(srcTypedArray.constructor)
.set(srcTypedArray.byteLength ? srcTypedArray : [0], Number(pRet))
/* Maintenance note: the order of alloc() and heapForSize() calls
is significant: https://sqlite.org/forum/forumpost/05b77273be104532 */;
return pRet;
};
@@ -973,11 +944,14 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
};
wasm.alloc.impl = wasm.exports[keyAlloc];
wasm.realloc = function f(m,n){
const m2 = f.impl(m,n);
return n ? (m2 || WasmAllocError.toss("Failed to reallocate",n," bytes.")) : 0;
const m2 = f.impl(wasm.ptr.coerce(m)/*tag:64bit*/,n);
return n ? (m2 || WasmAllocError.toss("Failed to reallocate",n," bytes.")) : wasm.ptr.null;
};
wasm.realloc.impl = wasm.exports[keyRealloc];
wasm.dealloc = wasm.exports[keyDealloc];
wasm.dealloc = function f(m){
f.impl(wasm.ptr.coerce(m)/*tag:64bit*/);
};
wasm.dealloc.impl = wasm.exports[keyDealloc];
}
/**
@@ -1021,7 +995,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
rv[1] = m ? (f._rxInt.test(m[2]) ? +m[2] : m[2]) : true;
};
}
const rc = {}, ov = [0,0];
const rc = Object.create(null), ov = [0,0];
let i = 0, k;
while((k = capi.sqlite3_compileoption_get(i++))){
f._opt(k,ov);
@@ -1029,7 +1003,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
}
return f._result = rc;
}else if(Array.isArray(optName)){
const rc = {};
const rc = Object.create(null);
optName.forEach((v)=>{
rc[v] = capi.sqlite3_compileoption_used(v);
});
@@ -1046,10 +1020,16 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
}/*compileOptionUsed()*/;
/**
sqlite3.wasm.pstack (pseudo-stack) holds a special-case
stack-style allocator intended only for use with _small_ data of
not more than (in total) a few kb in size, managed as if it were
stack-based.
sqlite3.wasm.pstack (pseudo-stack) holds a special-case intended
solely for short-lived, small data. In practice, it's primarily
used to allocate output pointers. It mus not be used for any
memory which needs to outlive the scope in which it's obtained
from pstack.
The library guarantees only that a minimum of 2kb are available
in this allocator, and it may provide more (it's a build-time
value). pstack.quota and pstack.remaining can be used to get the
total resp. remaining amount of memory.
It has only a single intended usage:
@@ -1081,8 +1061,12 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
Sets the current pstack position to the given pointer. Results
are undefined if the passed-in value did not come from
this.pointer.
In debug builds this may trigger an assert() in the WASM
environment if passed an illegal value.
*/
restore: wasm.exports.sqlite3__wasm_pstack_restore,
/**
Attempts to allocate the given number of bytes from the
pstack. On success, it zeroes out a block of memory of the
@@ -1108,6 +1092,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|| WasmAllocError.toss("Could not allocate",n,
"bytes from the pstack.");
},
/**
alloc()'s n chunks, each sz bytes, as a single memory block and
returns the addresses as an array of n element, each holding
@@ -1120,7 +1105,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
Example:
```
const [p1, p2, p3] = wasm.pstack.allocChunks(3,4);
const [p1, p2, p3] = wasm.pstack.allocChunks(3, wasm.ptr.size);
```
*/
allocChunks: function(n,sz){
@@ -1128,14 +1113,15 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
WasmAllocError.toss("Invalid size value for allocChunks(",arguments[1],")");
}
const mem = wasm.pstack.alloc(n * sz);
const rc = [];
let i = 0, offset = 0;
for(; i < n; ++i, offset += sz) rc.push(mem + offset);
const rc = [mem];
let i = 1, offset = sz;
for(; i < n; ++i, offset += sz) rc.push(wasm.ptr.add(mem, offset));
return rc;
},
/**
A convenience wrapper for allocChunks() which sizes each chunk
as either 8 bytes (safePtrSize is truthy) or wasm.ptrSizeof (if
as either 8 bytes (safePtrSize is truthy) or wasm.ptr.size (if
safePtrSize is falsy).
How it returns its result differs depending on its first
@@ -1154,8 +1140,8 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
*/
allocPtr: (n=1,safePtrSize=true)=>{
return 1===n
? wasm.pstack.alloc(safePtrSize ? 8 : wasm.ptrSizeof)
: wasm.pstack.allocChunks(n, safePtrSize ? 8 : wasm.ptrSizeof);
? wasm.pstack.alloc(safePtrSize ? 8 : wasm.ptr.size)
: wasm.pstack.allocChunks(n, safePtrSize ? 8 : wasm.ptr.size);
},
/**
@@ -1168,39 +1154,41 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
*/
call: function(f){
const stackPos = wasm.pstack.pointer;
try{ return f(sqlite3) } finally{
wasm.pstack.restore(stackPos);
}
try{ return f(sqlite3) }
finally{ wasm.pstack.restore(stackPos); }
}
})/*wasm.pstack*/;
Object.defineProperties(wasm.pstack, {
/**
sqlite3.wasm.pstack.pointer resolves to the current pstack
position pointer. This value is intended _only_ to be saved
for passing to restore(). Writing to this memory, without
first reserving it via wasm.pstack.alloc() and friends, leads
to undefined results.
Resolves to the current pstack position pointer either as a
Number (32-bit WASM) or BigInt (64-bit WASM). This value is
intended _only_ to be saved for passing to restore(). Writing
to this memory, without first reserving it via
wasm.pstack.alloc() and friends, leads to undefined results.
*/
pointer: {
configurable: false, iterable: true, writeable: false,
get: wasm.exports.sqlite3__wasm_pstack_ptr
//Whether or not a setter as an alternative to restore() is
//clearer or would just lead to confusion is unclear.
//clearer or would just lead to confusion or misuse is unclear.
//set: wasm.exports.sqlite3__wasm_pstack_restore
},
/**
sqlite3.wasm.pstack.quota to the total number of bytes
available in the pstack, including any space which is currently
Resolves to the total number of bytes available in the pstack
allocator, including any space which is currently
allocated. This value is a compile-time constant.
*/
quota: {
configurable: false, iterable: true, writeable: false,
get: wasm.exports.sqlite3__wasm_pstack_quota
},
/**
sqlite3.wasm.pstack.remaining resolves to the amount of space
remaining in the pstack.
Resolves to the number of bytes remaining in the pstack
allocator.
*/
remaining: {
configurable: false, iterable: true, writeable: false,
@@ -1209,11 +1197,12 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
})/*wasm.pstack properties*/;
capi.sqlite3_randomness = (...args)=>{
if(1===args.length && util.isTypedArray(args[0])
&& 1===args[0].BYTES_PER_ELEMENT){
if(1===args.length
&& util.isTypedArray(args[0])
&& 1===args[0].BYTES_PER_ELEMENT){
const ta = args[0];
if(0===ta.byteLength){
wasm.exports.sqlite3_randomness(0,0);
wasm.exports.sqlite3_randomness(0,wasm.ptr.null);
return ta;
}
const stack = wasm.pstack.pointer;
@@ -1226,13 +1215,13 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
do{
const j = (n>nAlloc ? nAlloc : n);
r(j, ptr);
ta.set(typedArrayPart(heap, ptr, ptr+j), offset);
ta.set(wasm.typedArrayPart(heap, ptr, wasm.ptr.add(ptr,j)), offset);
n -= j;
offset += j;
} while(n > 0);
}catch(e){
console.error("Highly unexpected (and ignored!) "+
"exception in sqlite3_randomness():",e);
config.error("Highly unexpected (and ignored!) "+
"exception in sqlite3_randomness():",e);
}finally{
wasm.pstack.restore(stack);
}
@@ -1249,22 +1238,21 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
does not then it returns "" (noting that "" is a falsy value).
The first time this is called, this function inspects the current
environment to determine whether persistence support is available
and, if it is, enables it (if needed). After the first call it
always returns the cached result.
environment to determine whether WASMFS persistence support is
available and, if it is, enables it (if needed). After the first
call it always returns the cached result.
If the returned string is not empty, any files stored under the
given path (recursively) are housed in OPFS storage. If the
returned path (recursively) are housed in OPFS storage. If the
returned string is empty, this particular persistent storage
option is not available on the client.
Though the mount point name returned by this function is intended
to remain stable, clients should not hard-coded it
anywhere. Always call this function to get the path.
to remain stable, clients should not hard-coded it anywhere.
Always call this function to get the path.
Note that this function is a no-op in most builds of this
library, as the WASMFS capability requires a custom
build.
This function is a no-op in most builds of this library, as the
WASMFS capability requires a custom build.
*/
capi.sqlite3_wasmfs_opfs_dir = function(){
if(undefined !== __wasmfsOpfsDir) return __wasmfsOpfsDir;
@@ -1273,7 +1261,8 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
if(!pdir
|| !globalThis.FileSystemHandle
|| !globalThis.FileSystemDirectoryHandle
|| !globalThis.FileSystemFileHandle){
|| !globalThis.FileSystemFileHandle
|| !wasm.exports.sqlite3__wasm_init_wasmfs){
return __wasmfsOpfsDir = "";
}
try{
@@ -1305,11 +1294,10 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
(defaulting to "main"), returns a truthy value (see below) if
that db uses that VFS, else returns false. If pDb is falsy then
the 3rd argument is ignored and this function returns a truthy
value if the default VFS name matches that of the 2nd
argument. Results are undefined if pDb is truthy but refers to an
invalid pointer. The 3rd argument specifies the database name of
the given database connection to check, defaulting to the main
db.
value if the default VFS name matches that of the 2nd argument.
Results are undefined if pDb is truthy but refers to an invalid
pointer. The 3rd argument specifies the database name of the
given database connection to check, defaulting to the main db.
The 2nd and 3rd arguments may either be a JS string or a WASM
C-string. If the 2nd argument is a NULL WASM pointer, the default
@@ -1320,9 +1308,9 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
object.
To permit safe use of this function from APIs which may be called
via the C stack (like SQL UDFs), this function does not throw: if
bad arguments cause a conversion error when passing into
wasm-space, false is returned.
via C (like SQL UDFs), this function does not throw: if bad
arguments cause a conversion error when passing into wasm-space,
false is returned.
*/
capi.sqlite3_js_db_uses_vfs = function(pDb,vfsName,dbName=0){
try{
@@ -1345,7 +1333,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
*/
capi.sqlite3_js_vfs_list = function(){
const rc = [];
let pVfs = capi.sqlite3_vfs_find(0);
let pVfs = capi.sqlite3_vfs_find(wasm.ptr.coerce(0));
while(pVfs){
const oVfs = new capi.sqlite3_vfs(pVfs);
rc.push(wasm.cstrToJs(oVfs.$zName));
@@ -1371,12 +1359,12 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
capi.sqlite3_js_db_export = function(pDb, schema=0){
pDb = wasm.xWrap.testConvertArg('sqlite3*', pDb);
if(!pDb) toss3('Invalid sqlite3* argument.');
if(!wasm.bigIntEnabled) toss3('BigInt64 support is not enabled.');
if(!wasm.bigIntEnabled) toss3('BigInt support is not enabled.');
const scope = wasm.scopedAllocPush();
let pOut;
try{
const pSize = wasm.scopedAlloc(8/*i64*/ + wasm.ptrSizeof);
const ppOut = pSize + 8;
const pSize = wasm.scopedAlloc(8/*i64*/ + wasm.ptr.size);
const ppOut = wasm.ptr.add(pSize, 8);
/**
Maintenance reminder, since this cost a full hour of grief
and confusion: if the order of pSize/ppOut are reversed in
@@ -1386,7 +1374,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
*/
const zSchema = schema
? (wasm.isPtr(schema) ? schema : wasm.scopedAllocCString(''+schema))
: 0;
: wasm.ptr.null;
let rc = wasm.exports.sqlite3__wasm_db_serialize(
pDb, zSchema, ppOut, pSize, 0
);
@@ -1397,7 +1385,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
pOut = wasm.peekPtr(ppOut);
const nOut = wasm.peek(pSize, 'i64');
rc = nOut
? wasm.heap8u().slice(pOut, pOut + Number(nOut))
? wasm.heap8u().slice(Number(pOut), Number(pOut) + Number(nOut))
: new Uint8Array();
return rc;
}finally{
@@ -1437,8 +1425,8 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
It may behave differently in other environments.
The first argument must be either a JS string or WASM C-string
holding the filename. Note that this routine does _not_ create
intermediary directories if the filename has a directory part.
holding the filename. This routine does _not_ create intermediary
directories if the filename has a directory part.
The 2nd argument may either a valid WASM memory pointer, an
ArrayBuffer, or a Uint8Array. The 3rd must be the length, in
@@ -1475,7 +1463,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
if(rc) SQLite3Error.toss("Creation of file failed with sqlite3 result code",
capi.sqlite3_js_rc_str(rc));
}finally{
wasm.dealloc(pData);
if( pData && pData!==data ) wasm.dealloc(pData);
}
};
@@ -1484,12 +1472,13 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
debug builds of sqlite3 because its out-of-scope use of the
sqlite3_vfs API triggers assertions in the core library. That
was unfortunately not discovered until 2023-08-11. This function
is now deprecated and should not be used in new code.
is now deprecated. It should not be used in new code and should
be removed from existing code.
Alternative options:
- "unix" VFS and its variants can get equivalent functionality
with sqlite3_js_posix_create_file().
- The "unix" VFS and its variants can get equivalent
functionality with sqlite3_js_posix_create_file().
- OPFS: use either sqlite3.oo1.OpfsDb.importDb(), for the "opfs"
VFS, or the importDb() method of the PoolUtil object provided
@@ -1498,6 +1487,8 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
from here because the former is necessarily asynchronous and
the latter requires information not available to this function.
Historical (deprecated) behaviour:
Creates a file using the storage appropriate for the given
sqlite3_vfs. The first argument may be a VFS name (JS string
only, NOT a WASM C-string), WASM-managed `sqlite3_vfs*`, or
@@ -1540,7 +1531,10 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
- "unix" and related: will use the WASM build's equivalent of the
POSIX I/O APIs. This will work so long as neither a specific
VFS nor the WASM environment imposes requirements which break it.
VFS nor the WASM environment imposes requirements which break
it. (Much later: it turns out that debug builds of the library
impose such requirements, in that they assert() that dataLen is
an even multiple of a valid db page size.)
- "opfs": uses OPFS storage and creates directory parts of the
filename. It can only be used to import an SQLite3 database
@@ -1785,7 +1779,9 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
if(n && !pBlob) sqlite3.WasmAllocError.toss(
"Cannot allocate memory for blob argument of",n,"byte(s)"
);
arg = n ? wasm.heap8u().slice(pBlob, pBlob + Number(n)) : null;
arg = n
? wasm.heap8u().slice(Number(pBlob), Number(pBlob) + Number(n))
: null;
break;
}
case capi.SQLITE_NULL:
@@ -1819,7 +1815,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
do not.
*/
tgt.push(capi.sqlite3_value_to_js(
wasm.peekPtr(pArgv + (wasm.ptrSizeof * i)),
wasm.peekPtr(wasm.ptr.add(pArgv, wasm.ptr.size * i)),
throwIfCannotConvert
));
}
@@ -2012,7 +2008,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
WasmAllocError: WasmAllocError,
SQLite3Error: SQLite3Error,
capi,
util,
util /* internal: will get removed after library init */,
wasm,
config,
/**
@@ -2052,9 +2048,9 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
Ideally this function is called as part of the Promise chain
which handles the loading and bootstrapping of the API. If not
then it must be called by client-level code, which must not use
the library until the returned promise resolves.
the library until the returned Promise resolves.
If called multiple times it will return the same promise on
If called multiple times it will return the same Promise on
subsequent calls. The current build setup precludes that
possibility, so it's only a hypothetical problem if/when this
function ever needs to be invoked by clients.
@@ -2121,28 +2117,54 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
}
delete sqlite3ApiBootstrap.initializers;
sqlite3ApiBootstrap.sqlite3 = sqlite3;
return sqlite3;
delete globalThis.sqlite3ApiBootstrap;
delete globalThis.sqlite3ApiConfig;
sqlite3InitScriptInfo.debugModule(
"sqlite3ApiBootstrap() complete", sqlite3
);
sqlite3.scriptInfo /* used by some async init code */ =
sqlite3InitScriptInfo /* from post-js-header.js */;
if( (sqlite3.__isUnderTest = sqlite3IsUnderTest /* from post-js-header.js */) ){
sqlite3.config.emscripten = EmscriptenModule;
const iw = sqlite3InitScriptInfo.instantiateWasm;
if( iw ){
/* Metadata injected by the custom Module.instantiateWasm()
in pre-js.c-pp.js. */
sqlite3.wasm.module = iw.module;
sqlite3.wasm.instance = iw.instance;
sqlite3.wasm.imports = iw.imports;
}
}
return sqlite3.asyncPostInit().then((s)=>{
sqlite3InitScriptInfo.debugModule(
"sqlite3.asyncPostInit() complete", sqlite3
);
delete s.asyncPostInit;
delete s.scriptInfo;
delete s.emscripten;
return s;
});
}/*sqlite3ApiBootstrap()*/;
/**
globalThis.sqlite3ApiBootstrap.initializers is an internal detail used by
the various pieces of the sqlite3 API's amalgamation process. It
must not be modified by client code except when plugging such code
into the amalgamation process.
globalThis.sqlite3ApiBootstrap.initializers is an internal detail
used by the various pieces of the sqlite3 API's amalgamation
process. It must not be modified by client code except when plugging
such code into the amalgamation process.
Each component of the amalgamation is expected to append a function
to this array. When sqlite3ApiBootstrap() is called for the first
time, each such function will be called (in their appended order)
and passed the sqlite3 namespace object, into which they can install
their features (noting that most will also require that certain
features alread have been installed). At the end of that process,
this array is deleted.
their features. At the end of that process, this array is deleted.
Note that the order of insertion into this array is significant for
The order of insertion into this array is significant for
some pieces. e.g. sqlite3.capi and sqlite3.wasm cannot be fully
utilized until the whwasmutil.js part is plugged in via
sqlite3-api-glue.js.
*/
globalThis.sqlite3ApiBootstrap.initializers = [];
/**
globalThis.sqlite3ApiBootstrap.initializersAsync is an internal detail
used by the sqlite3 API's amalgamation process. It must not be
@@ -2165,6 +2187,7 @@ globalThis.sqlite3ApiBootstrap.initializers = [];
this list.
*/
globalThis.sqlite3ApiBootstrap.initializersAsync = [];
/**
Client code may assign sqlite3ApiBootstrap.defaultConfig an
object-type value before calling sqlite3ApiBootstrap() (without
@@ -2175,6 +2198,7 @@ globalThis.sqlite3ApiBootstrap.initializersAsync = [];
global-scope symbol.
*/
globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null);
/**
Placeholder: gets installed by the first call to
globalThis.sqlite3ApiBootstrap(). However, it is recommended that the
+2 -2
View File
@@ -1,4 +1,4 @@
//#ifnot omit-oo1
//#if not omit-oo1
/**
2022-07-22
@@ -677,4 +677,4 @@ sqlite3.initWorker1API = function(){
});
//#else
/* Built with the omit-oo1 flag. */
//#endif ifnot omit-oo1
//#endif if not omit-oo1
@@ -1,4 +1,4 @@
//#ifnot target=node
//#if not target:node
/*
2023-07-14
@@ -232,11 +232,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
pool.log(`xRead ${file.path} ${n} @ ${offset64}`);
try {
const nRead = file.sah.read(
wasm.heap8u().subarray(pDest, pDest+n),
wasm.heap8u().subarray(Number(pDest), Number(pDest)+n),
{at: HEADER_OFFSET_DATA + Number(offset64)}
);
if(nRead < n){
wasm.heap8u().fill(0, pDest + nRead, pDest + n);
wasm.heap8u().fill(0, Number(pDest) + nRead, Number(pDest) + n);
return capi.SQLITE_IOERR_SHORT_READ;
}
return 0;
@@ -287,7 +287,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
pool.log(`xWrite ${file.path} ${n} ${offset64}`);
try{
const nBytes = file.sah.write(
wasm.heap8u().subarray(pSrc, pSrc+n),
wasm.heap8u().subarray(Number(pSrc), Number(pSrc)+n),
{ at: HEADER_OFFSET_DATA + Number(offset64) }
);
return n===nBytes ? 0 : toss("Unknown write() failure.");
@@ -452,7 +452,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
vfsMethods.xRandomness = function(pVfs, nOut, pOut){
const heap = wasm.heap8u();
let i = 0;
for(; i < nOut; ++i) heap[pOut + i] = (Math.random()*255000) & 0xFF;
const npOut = Number(pOut);
for(; i < nOut; ++i) heap[npOut + i] = (Math.random()*255000) & 0xFF;
return i;
};
}
@@ -493,7 +494,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
/* Maps SAH to an abstract File Object which contains
various metadata about that handle. */
//#mapSAHToMeta = new Map();
/** Buffer used by [sg]etAssociatedPath(). */
#apBody = new Uint8Array(HEADER_CORPUS_SIZE);
@@ -1006,7 +1006,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
try{
while( undefined !== (chunk = await callback()) ){
if(chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk);
if( 0===nWrote && chunk.byteLength>=15 ){
if( !checkedHeader && 0===nWrote && chunk.byteLength>=15 ){
util.affirmDbHeader(chunk);
checkedHeader = true;
}
@@ -1459,4 +1459,4 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
The OPFS SAH Pool VFS parts are elided from builds targeting
node.js.
*/
//#endif target=node
//#endif target:node
+11 -8
View File
@@ -1,4 +1,4 @@
//#ifnot target=node
//#if not target:node
/*
2022-09-18
@@ -209,9 +209,9 @@ const installOpfsVfs = function callee(options){
return promiseResolve_(sqlite3);
};
const W =
//#if target=es6-bundler-friendly
//#if target:es6-bundler-friendly
new Worker(new URL("sqlite3-opfs-async-proxy.js", import.meta.url));
//#elif target=es6-module
//#elif target:es6-module
new Worker(new URL(options.proxyUri, import.meta.url));
//#else
new Worker(options.proxyUri);
@@ -805,7 +805,7 @@ const installOpfsVfs = function callee(options){
Because the heap is _not_ a SharedArrayBuffer, we have
to copy the results. TypedArray.set() seems to be the
fastest way to copy this. */
wasm.heap8u().set(f.sabView.subarray(0, n), pDest);
wasm.heap8u().set(f.sabView.subarray(0, n), Number(pDest));
}
}catch(e){
error("xRead(",arguments,") failed:",e,f);
@@ -844,7 +844,9 @@ const installOpfsVfs = function callee(options){
const f = __openFiles[pFile];
let rc;
try {
f.sabView.set(wasm.heap8u().subarray(pSrc, pSrc+n));
f.sabView.set(wasm.heap8u().subarray(
Number(pSrc), Number(pSrc) + n
));
rc = opRun('xWrite', pFile, n, Number(offset64));
}catch(e){
error("xWrite(",arguments,") failed:",e,f);
@@ -951,7 +953,8 @@ const installOpfsVfs = function callee(options){
vfsSyncWrappers.xRandomness = function(pVfs, nOut, pOut){
const heap = wasm.heap8u();
let i = 0;
for(; i < nOut; ++i) heap[pOut + i] = (Math.random()*255000) & 0xFF;
const npOut = Number(pOut);
for(; i < nOut; ++i) heap[npOut + i] = (Math.random()*255000) & 0xFF;
return i;
};
}
@@ -1195,7 +1198,7 @@ const installOpfsVfs = function callee(options){
sah.truncate(0);
while( undefined !== (chunk = await callback()) ){
if(chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk);
if( 0===nWrote && chunk.byteLength>=15 ){
if( !checkedHeader && 0===nWrote && chunk.byteLength>=15 ){
util.affirmDbHeader(chunk);
checkedHeader = true;
}
@@ -1454,4 +1457,4 @@ globalThis.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
}/*sqlite3ApiBootstrap.initializers.push()*/);
//#else
/* The OPFS VFS parts are elided from builds targeting node.js. */
//#endif target=node
//#endif target:node
+8 -4
View File
@@ -34,7 +34,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
*/
sii.prototype.nthConstraint = function(n, asPtr=false){
if(n<0 || n>=this.$nConstraint) return false;
const ptr = this.$aConstraint + (
const ptr = wasm.ptr.add(
this.$aConstraint,
sii.sqlite3_index_constraint.structInfo.sizeof * n
);
return asPtr ? ptr : new sii.sqlite3_index_constraint(ptr);
@@ -48,7 +49,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
*/
sii.prototype.nthConstraintUsage = function(n, asPtr=false){
if(n<0 || n>=this.$nConstraint) return false;
const ptr = this.$aConstraintUsage + (
const ptr = wasm.ptr.add(
this.$aConstraintUsage,
sii.sqlite3_index_constraint_usage.structInfo.sizeof * n
);
return asPtr ? ptr : new sii.sqlite3_index_constraint_usage(ptr);
@@ -64,7 +66,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
*/
sii.prototype.nthOrderBy = function(n, asPtr=false){
if(n<0 || n>=this.$nOrderBy) return false;
const ptr = this.$aOrderBy + (
const ptr = wasm.ptr.add(
this.$aOrderBy,
sii.sqlite3_index_orderby.structInfo.sizeof * n
);
return asPtr ? ptr : new sii.sqlite3_index_orderby(ptr);
@@ -246,7 +249,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
else if(err instanceof sqlite3.SQLite3Error) rc = err.resultCode;
return rc || capi.SQLITE_ERROR;
};
vtab.xError.errorReporter = 1 ? console.error.bind(console) : false;
vtab.xError.errorReporter = 1 ? sqlite3.config.error.bind(sqlite3.config) : false;
/**
A helper for sqlite3_vtab::xRowid() and xUpdate()
@@ -405,6 +408,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(0===mod.$iVersion){
let v;
if('number'===typeof opt.iVersion) v = opt.iVersion;
else if(mod.$xIntegrity) v = 4;
else if(mod.$xShadowName) v = 3;
else if(mod.$xSavePoint || mod.$xRelease || mod.$xRollbackTo) v = 2;
else v = 1;
+33 -10
View File
@@ -146,6 +146,7 @@
# undef SQLITE_ENABLE_EXPLAIN_COMMENTS
# undef SQLITE_ENABLE_FTS5
# undef SQLITE_ENABLE_OFFSET_SQL_FUNC
# undef SQLITE_ENABLE_PERCENTILE
# undef SQLITE_ENABLE_PREUPDATE_HOOK
# undef SQLITE_ENABLE_RTREE
# undef SQLITE_ENABLE_SESSION
@@ -230,7 +231,8 @@
** Which sqlite3.c we're using needs to be configurable to enable
** building against a custom copy, e.g. the SEE variant. We #include
** the .c file, rather than the header, so that the WASM extensions
** have access to private API internals.
** have access to private API internals (namely for kvvfs and
** SQLTester pieces).
**
** The caveat here is that custom variants need to account for
** exporting any necessary symbols (e.g. sqlite3_activate_see()). We
@@ -299,7 +301,10 @@ SQLITE_WASM_EXPORT void * sqlite3__wasm_stack_alloc(int n){
** enough for general-purpose string conversions because some of our
** tests use input files (strings) of 16MB+.
*/
static unsigned char PStack_mem[512 * 8] = {0};
static unsigned char PStack_mem[
1024 * 4 /* API docs guaranty at least 2kb and it's been set at 4kb
since it was introduced. */
] = {0};
static struct {
unsigned const char * const pBegin;/* Start (inclusive) of memory */
unsigned const char * const pEnd; /* One-after-the-end of memory */
@@ -373,13 +378,21 @@ typedef struct WasmTestStruct WasmTestStruct;
SQLITE_WASM_EXPORT
void sqlite3__wasm_test_struct(WasmTestStruct * s){
if(s){
if( 0 ){
/* Do not be alarmed by the small (and odd) pointer values.
Function pointers in WASM are their index into the
indirect function table, not their address. */
fprintf(stderr,"%s:%s()@%p s=@%p xFunc=@%p\n",
__FILE__, __func__,
(void*)sqlite3__wasm_test_struct,
s, (void*)s->xFunc);
}
s->v4 *= 2;
s->v8 = s->v4 * 2;
s->ppV = s;
s->cstr = __FILE__;
if(s->xFunc) s->xFunc(s);
}
return;
}
#endif /* SQLITE_WASM_ENABLE_C_TESTS */
@@ -397,10 +410,18 @@ void sqlite3__wasm_test_struct(WasmTestStruct * s){
** If this function returns NULL then it means that the internal
** buffer is not large enough for the generated JSON and needs to be
** increased. In debug builds that will trigger an assert().
**
** 2025-09-19: for reasons entirely not understood, building with emcc
** -sMEMORY64=2 causes this function to fail (return 0). -sMEMORY64=1
** fails to compile with "tables may not be 64-bit" but does not tell
** us where it's happening.
*/
SQLITE_WASM_EXPORT
const char * sqlite3__wasm_enum_json(void){
static char aBuffer[1024 * 20] = {0} /* where the JSON goes */;
static char aBuffer[1024 * 20] =
{0} /* where the JSON goes. 2025-09-19: output size=19295, but
that can vary slightly from build to build, so a little
leeway is needed here. */;
int n = 0, nChildren = 0, nStruct = 0
/* output counters for figuring out where commas go */;
char * zPos = &aBuffer[1] /* skip first byte for now to help protect
@@ -592,6 +613,7 @@ const char * sqlite3__wasm_enum_json(void){
DefInt(SQLITE_DBSTATUS_DEFERRED_FKS);
DefInt(SQLITE_DBSTATUS_CACHE_USED_SHARED);
DefInt(SQLITE_DBSTATUS_CACHE_SPILL);
DefInt(SQLITE_DBSTATUS_TEMPBUF_SPILL);
DefInt(SQLITE_DBSTATUS_MAX);
} _DefGroup;
@@ -970,8 +992,8 @@ const char * sqlite3__wasm_enum_json(void){
** }
** }
**
** Detailed documentation for those bits are in the docs for the
** Jaccwabyt JS-side component.
** Detailed documentation for those bits are in the Jaccwabyt
** JS-side component.
*/
/** Macros for emitting StructBinder description. */
@@ -1008,8 +1030,8 @@ const char * sqlite3__wasm_enum_json(void){
M(xDelete, "i(ppi)");
M(xAccess, "i(ppip)");
M(xFullPathname, "i(ppip)");
M(xDlOpen, "p(pp)");
M(xDlError, "p(pip)");
M(xDlOpen, "v(pp)");
M(xDlError, "v(pip)");
M(xDlSym, "p()");
M(xDlClose, "v(pp)");
M(xRandomness, "i(pip)");
@@ -1062,7 +1084,6 @@ const char * sqlite3__wasm_enum_json(void){
} _StructBinder;
#undef CurrentStruct
#if SQLITE_WASM_HAS_VTAB
#define CurrentStruct sqlite3_vtab
StructBinder {
@@ -1106,6 +1127,8 @@ const char * sqlite3__wasm_enum_json(void){
M(xRollbackTo, "i(pi)");
// ^^^ v2. v3+ follows...
M(xShadowName, "i(s)");
// ^^^ v3. v4+ follows...
M(xIntegrity, "i(pppip)");
} _StructBinder;
#undef CurrentStruct
@@ -1753,7 +1776,7 @@ int sqlite3__wasm_init_wasmfs(const char *zMountPoint){
SQLITE_WASM_EXPORT
int sqlite3__wasm_init_wasmfs(const char *zUnused){
//emscripten_console_warn("WASMFS OPFS is not compiled in.");
if(zUnused){/*unused*/}
(void)zUnused;
return SQLITE_NOTFOUND;
}
#endif /* __EMSCRIPTEN__ && SQLITE_ENABLE_WASMFS */
@@ -1,4 +1,4 @@
//#ifnot omit-oo1
//#if not omit-oo1
/*
2022-08-24
@@ -252,10 +252,12 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
globalThis.sqlite3Worker1Promiser.defaultConfig = {
worker: function(){
//#if target=es6-module
//#if target:es6-bundler-friendly
return new Worker(new URL("sqlite3-worker1-bundler-friendly.mjs", import.meta.url),{
type: 'module'
});
//#elif target:es6-module
return new Worker(new URL("sqlite3-worker1.js", import.meta.url));
//#else
let theJs = "sqlite3-worker1.js";
if(this.currentScript){
@@ -273,7 +275,7 @@ globalThis.sqlite3Worker1Promiser.defaultConfig = {
return new Worker(theJs + globalThis.location.search);
//#endif
}
//#ifnot target=es6-module
//#if not target:es6-module
.bind({
currentScript: globalThis?.document?.currentScript
})
@@ -332,7 +334,7 @@ globalThis.sqlite3Worker1Promiser.v2 = function callee(config = callee.defaultCo
globalThis.sqlite3Worker1Promiser.v2.defaultConfig =
globalThis.sqlite3Worker1Promiser.defaultConfig;
//#if target=es6-module
//#if target:es6-module
/**
When built as a module, we export sqlite3Worker1Promiser.v2()
instead of sqlite3Worker1Promise() because (A) its interface is more
@@ -341,7 +343,7 @@ globalThis.sqlite3Worker1Promiser.v2.defaultConfig =
incompatibility.
*/
export default sqlite3Worker1Promiser.v2;
//#endif /* target=es6-module */
//#endif /* target:es6-module */
//#else
/* Built with the omit-oo1 flag. */
//#endif ifnot omit-oo1
//#endif if not omit-oo1
+5 -3
View File
@@ -1,4 +1,4 @@
//#ifnot omit-oo1
//#if not omit-oo1
/*
2022-05-23
@@ -32,8 +32,10 @@
- `sqlite3.dir`, if set, treats the given directory name as the
directory from which `sqlite3.js` will be loaded.
*/
//#if target=es6-bundler-friendly
//#if target:es6-bundler-friendly
import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs';
//#elif target:es6-module
return new Worker(new URL("sqlite3.js", import.meta.url));
//#else
"use strict";
{
@@ -51,4 +53,4 @@ import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs';
sqlite3InitModule().then(sqlite3 => sqlite3.initWorker1API());
//#else
/* Built with the omit-oo1 flag. */
//#endif ifnot omit-oo1
//#endif if not omit-oo1
-86
View File
@@ -1,86 +0,0 @@
<!doctype html>
<html lang="en-us">
<head>
<meta 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="stylesheet" href="common/testing.css"/>
<title>sqlite3-api batch SQL runner for the SAHPool VFS</title>
</head>
<body>
<header id='titlebar'><span>sqlite3-api batch SQL runner for the SAHPool VFS</span></header>
<div>
<span class='input-wrapper'>
<input type='checkbox' class='disable-during-eval' id='cb-reverse-log-order' checked></input>
<label for='cb-reverse-log-order' id='lbl-reverse-log-order'>Reverse log order</label>
</span>
</div>
<div id='test-output' class='reverse'></div>
<script>
(function(){
const E = (sel)=>document.querySelector(sel);
const eOut = E('#test-output');
const log2 = function(cssClass,...args){
let ln;
if(1 || cssClass){
ln = document.createElement('div');
if(cssClass) ln.classList.add(cssClass);
ln.append(document.createTextNode(args.join(' ')));
}else{
// This doesn't work with the "reverse order" option!
ln = document.createTextNode(args.join(' ')+'\n');
}
eOut.append(ln);
};
const log = (...args)=>{
//console.log(...args);
log2('', ...args);
};
const logErr = function(...args){
console.error(...args);
log2('error', ...args);
};
const logWarn = function(...args){
console.warn(...args);
log2('warning', ...args);
};
const cbReverseLog = E('#cb-reverse-log-order');
const lblReverseLog = E('#lbl-reverse-log-order');
if(cbReverseLog.checked){
lblReverseLog.classList.add('warning');
eOut.classList.add('reverse');
}
cbReverseLog.addEventListener('change', function(){
if(this.checked){
eOut.classList.add('reverse');
lblReverseLog.classList.add('warning');
}else{
eOut.classList.remove('reverse');
lblReverseLog.classList.remove('warning');
}
}, false);
const w = new Worker('batch-runner-sahpool.js?sqlite3.dir=jswasm');
w.onmessage = function(msg){
msg = msg.data;
switch(msg.type){
case 'stdout': log(...msg.data); break;
case 'warn': logWarn(...msg.data); break;
case 'error': logErr(...msg.data); break;
default:
logErr("Unhandled worker message type:",msg);
break;
}
};
})();
</script>
<style>
#test-output {
white-space: break-spaces;
overflow: auto;
}
</style>
</body>
</html>
-341
View File
@@ -1,341 +0,0 @@
/*
2023-11-30
The author disclaims copyright to this source code. In place of a
legal notice, here is a blessing:
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
***********************************************************************
A basic batch SQL runner for the SAHPool VFS. This file must be run in
a worker thread. This is not a full-featured app, just a way to get some
measurements for batch execution of SQL for the OPFS SAH Pool VFS.
*/
'use strict';
const wMsg = function(msgType,...args){
postMessage({
type: msgType,
data: args
});
};
const toss = function(...args){throw new Error(args.join(' '))};
const warn = (...args)=>{ wMsg('warn',...args); };
const error = (...args)=>{ wMsg('error',...args); };
const log = (...args)=>{ wMsg('stdout',...args); }
let sqlite3;
const urlParams = new URL(globalThis.location.href).searchParams;
const cacheSize = (()=>{
if(urlParams.has('cachesize')) return +urlParams.get('cachesize');
return 200;
})();
/** Throws if the given sqlite3 result code is not 0. */
const checkSqliteRc = (dbh,rc)=>{
if(rc) toss("Prepare failed:",sqlite3.capi.sqlite3_errmsg(dbh));
};
const sqlToDrop = [
"SELECT type,name FROM sqlite_schema ",
"WHERE name NOT LIKE 'sqlite\\_%' escape '\\' ",
"AND name NOT LIKE '\\_%' escape '\\'"
].join('');
const clearDbSqlite = function(db){
// 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)
// open the same DB twice to clear it using that API, so...
const rc = sqlite3.wasm.exports.sqlite3_wasm_db_reset(db.handle);
log("reset db rc =",rc,db.id, db.filename);
};
const App = {
db: undefined,
cache:Object.create(null),
log: log,
warn: warn,
error: error,
metrics: {
fileCount: 0,
runTimeMs: 0,
prepareTimeMs: 0,
stepTimeMs: 0,
stmtCount: 0,
strcpyMs: 0,
sqlBytes: 0
},
fileList: undefined,
execSql: async function(name,sql){
const db = this.db;
const banner = "========================================";
this.log(banner,
"Running",name,'('+sql.length,'bytes)');
const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
let pStmt = 0, pSqlBegin;
const metrics = db.metrics = Object.create(null);
metrics.prepTotal = metrics.stepTotal = 0;
metrics.stmtCount = 0;
metrics.malloc = 0;
metrics.strcpy = 0;
if(this.gotErr){
this.error("Cannot run SQL: error cleanup is pending.");
return;
}
// Run this async so that the UI can be updated for the above header...
const endRun = ()=>{
metrics.evalSqlEnd = performance.now();
metrics.evalTimeTotal = (metrics.evalSqlEnd - metrics.evalSqlStart);
this.log("metrics:",JSON.stringify(metrics, undefined, ' '));
this.log("prepare() count:",metrics.stmtCount);
this.log("Time in prepare_v2():",metrics.prepTotal,"ms",
"("+(metrics.prepTotal / metrics.stmtCount),"ms per prepare())");
this.log("Time in step():",metrics.stepTotal,"ms",
"("+(metrics.stepTotal / metrics.stmtCount),"ms per step())");
this.log("Total runtime:",metrics.evalTimeTotal,"ms");
this.log("Overhead (time - prep - step):",
(metrics.evalTimeTotal - metrics.prepTotal - metrics.stepTotal)+"ms");
this.log(banner,"End of",name);
this.metrics.prepareTimeMs += metrics.prepTotal;
this.metrics.stepTimeMs += metrics.stepTotal;
this.metrics.stmtCount += metrics.stmtCount;
this.metrics.strcpyMs += metrics.strcpy;
this.metrics.sqlBytes += sql.length;
};
const runner = function(resolve, reject){
++this.metrics.fileCount;
metrics.evalSqlStart = performance.now();
const stack = wasm.scopedAllocPush();
try {
let t, rc;
let sqlByteLen = sql.byteLength;
const [ppStmt, pzTail] = wasm.scopedAllocPtr(2);
t = performance.now();
pSqlBegin = wasm.scopedAlloc( sqlByteLen + 1/*SQL + NUL*/) || toss("alloc(",sqlByteLen,") failed");
metrics.malloc = performance.now() - t;
metrics.byteLength = sqlByteLen;
let pSql = pSqlBegin;
const pSqlEnd = pSqlBegin + sqlByteLen;
t = performance.now();
wasm.heap8().set(sql, pSql);
wasm.poke(pSql + sqlByteLen, 0);
//log("SQL:",wasm.cstrToJs(pSql));
metrics.strcpy = performance.now() - t;
let breaker = 0;
while(pSql && wasm.peek8(pSql)){
wasm.pokePtr(ppStmt, 0);
wasm.pokePtr(pzTail, 0);
t = performance.now();
rc = capi.sqlite3_prepare_v2(
db.handle, pSql, sqlByteLen, ppStmt, pzTail
);
metrics.prepTotal += performance.now() - t;
checkSqliteRc(db.handle, rc);
pStmt = wasm.peekPtr(ppStmt);
pSql = wasm.peekPtr(pzTail);
sqlByteLen = pSqlEnd - pSql;
if(!pStmt) continue/*empty statement*/;
++metrics.stmtCount;
t = performance.now();
rc = capi.sqlite3_step(pStmt);
capi.sqlite3_finalize(pStmt);
pStmt = 0;
metrics.stepTotal += performance.now() - t;
switch(rc){
case capi.SQLITE_ROW:
case capi.SQLITE_DONE: break;
default: checkSqliteRc(db.handle, rc); toss("Not reached.");
}
}
resolve(this);
}catch(e){
if(pStmt) capi.sqlite3_finalize(pStmt);
this.gotErr = e;
reject(e);
}finally{
capi.sqlite3_exec(db.handle,"rollback;",0,0,0);
wasm.scopedAllocPop(stack);
}
}.bind(this);
const p = new Promise(runner);
return p.catch(
(e)=>this.error("Error via execSql("+name+",...):",e.message)
).finally(()=>{
endRun();
});
},
/**
Loads batch-runner.list and populates the selection list from
it. Returns a promise which resolves to nothing in particular
when it completes. Only intended to be run once at the start
of the app.
*/
loadSqlList: async function(){
const infile = 'batch-runner.list';
this.log("Loading list of SQL files:", infile);
let txt;
try{
const r = await fetch(infile);
if(404 === r.status){
toss("Missing file '"+infile+"'.");
}
if(!r.ok) toss("Loading",infile,"failed:",r.statusText);
txt = await r.text();
}catch(e){
this.error(e.message);
throw e;
}
App.fileList = txt.split(/\n+/).filter(x=>!!x);
this.log("Loaded",infile);
},
/** Fetch ./fn and return its contents as a Uint8Array. */
fetchFile: async function(fn, cacheIt=false){
if(cacheIt && this.cache[fn]) return this.cache[fn];
this.log("Fetching",fn,"...");
let sql;
try {
const r = await fetch(fn);
if(!r.ok) toss("Fetch failed:",r.statusText);
sql = new Uint8Array(await r.arrayBuffer());
}catch(e){
this.error(e.message);
throw e;
}
this.log("Fetched",sql.length,"bytes from",fn);
if(cacheIt) this.cache[fn] = sql;
return sql;
}/*fetchFile()*/,
/**
Converts this.metrics() to a form which is suitable for easy conversion to
CSV. It returns an array of arrays. The first sub-array is the column names.
The 2nd and subsequent are the values, one per test file (only the most recent
metrics are kept for any given file).
*/
metricsToArrays: function(){
const rc = [];
Object.keys(this.dbs).sort().forEach((k)=>{
const d = this.dbs[k];
const m = d.metrics;
delete m.evalSqlStart;
delete m.evalSqlEnd;
const mk = Object.keys(m).sort();
if(!rc.length){
rc.push(['db', ...mk]);
}
const row = [k.split('/').pop()/*remove dir prefix from filename*/];
rc.push(row);
row.push(...mk.map((kk)=>m[kk]));
});
return rc;
},
metricsToBlob: function(colSeparator='\t'){
const ar = [], ma = this.metricsToArrays();
if(!ma.length){
this.error("Metrics are empty. Run something.");
return;
}
ma.forEach(function(row){
ar.push(row.join(colSeparator),'\n');
});
return new Blob(ar);
},
/**
Fetch file fn and eval it as an SQL blob. This is an async
operation and returns a Promise which resolves to this
object on success.
*/
evalFile: async function(fn){
const sql = await this.fetchFile(fn);
return this.execSql(fn,sql);
}/*evalFile()*/,
/**
Fetches the handle of the db associated with
this.e.selImpl.value, opening it if needed.
*/
initDb: function(){
const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
const stack = wasm.scopedAllocPush();
let pDb = 0;
const d = Object.create(null);
d.filename = "/batch.db";
try{
const oFlags = capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE;
const ppDb = wasm.scopedAllocPtr();
const rc = capi.sqlite3_open_v2(d.filename, ppDb, oFlags, this.PoolUtil.vfsName);
pDb = wasm.peekPtr(ppDb)
if(rc) toss("sqlite3_open_v2() failed with code",rc);
capi.sqlite3_exec(pDb, "PRAGMA cache_size="+cacheSize, 0, 0, 0);
this.log("cache_size =",cacheSize);
}catch(e){
if(pDb) capi.sqlite3_close_v2(pDb);
throw e;
}finally{
wasm.scopedAllocPop(stack);
}
d.handle = pDb;
this.log("Opened db:",d.filename,'@',d.handle);
return d;
},
closeDb: function(){
if(this.db.handle){
this.sqlite3.capi.sqlite3_close_v2(this.db.handle);
this.db.handle = undefined;
}
},
run: async function(sqlite3){
delete this.run;
this.sqlite3 = sqlite3;
const capi = sqlite3.capi, wasm = sqlite3.wasm;
this.log("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
this.log("WASM heap size =",wasm.heap8().length);
let timeStart;
sqlite3.installOpfsSAHPoolVfs({
clearOnInit: true, initialCapacity: 4,
name: 'batch-sahpool',
verbosity: 2
}).then(PoolUtil=>{
App.PoolUtil = PoolUtil;
App.db = App.initDb();
})
.then(async ()=>this.loadSqlList())
.then(async ()=>{
timeStart = performance.now();
for(let i = 0; i < App.fileList.length; ++i){
const fn = App.fileList[i];
await App.evalFile(fn);
if(App.gotErr) throw App.gotErr;
}
})
.then(()=>{
App.metrics.runTimeMs = performance.now() - timeStart;
App.log("total metrics:",JSON.stringify(App.metrics, undefined, ' '));
App.log("Reload the page to run this again.");
App.closeDb();
App.PoolUtil.removeVfs();
})
.catch(e=>this.error("ERROR:",e));
}/*run()*/
}/*App*/;
let sqlite3Js = 'sqlite3.js';
if(urlParams.has('sqlite3.dir')){
sqlite3Js = urlParams.get('sqlite3.dir') + '/' + sqlite3Js;
}
importScripts(sqlite3Js);
globalThis.sqlite3InitModule().then(async function(sqlite3_){
log("Done initializing. Running batch runner...");
sqlite3 = sqlite3_;
App.run(sqlite3_);
});
-90
View File
@@ -1,90 +0,0 @@
<!doctype html>
<html lang="en-us">
<head>
<meta 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="stylesheet" href="common/emscripten.css"/>
<link rel="stylesheet" href="common/testing.css"/>
<title>sqlite3-api batch SQL runner</title>
</head>
<body>
<header id='titlebar'><span>sqlite3-api batch SQL runner</span></header>
<!-- emscripten bits -->
<figure id="module-spinner">
<div class="spinner"></div>
<div class='center'><strong>Initializing app...</strong></div>
<div class='center'>
On a slow internet connection this may take a moment. If this
message displays for "a long time", intialization may have
failed and the JavaScript console may contain clues as to why.
</div>
</figure>
<div class="emscripten" id="module-status">Downloading...</div>
<div class="emscripten">
<progress value="0" max="100" id="module-progress" hidden='1'></progress>
</div><!-- /emscripten bits -->
<p>
This page is for batch-running extracts from the output
of <tt>speedtest1 --script</tt>, as well as other standalone SQL
scripts.
</p>
<p id='warn-list' class='warning'>ACHTUNG: this file requires a generated input list
file. Run "make batch" from this directory to generate it.
</p>
<p id='warn-opfs' class='warning hidden'>WARNING: if the WASMFS/OPFS layer crashes, this page may
become completely unresponsive and need to be closed and reloaded to recover.
</p>
<p id='warn-websql' class='warning hidden'>WARNING: WebSQL's limited API requires that
this app split up SQL batches into separate statements for execution. That will
only work so long as semicolon characters are <em>only</em> used to terminate
SQL statements, and not used within string literals or the like.
</p>
<hr>
<fieldset id='toolbar'>
<div>
<select class='disable-during-eval' id='sql-select'>
<option disabled selected>Populated via script code</option>
</select>
<button class='disable-during-eval' id='sql-run'>Run selected SQL</button>
<button class='disable-during-eval' id='sql-run-next'>Run next...</button>
<button class='disable-during-eval' id='sql-run-remaining'>Run all remaining...</button>
<button class='disable-during-eval' id='export-metrics' disabled>Export metrics (WIP)<br>(broken by refactoring)</button>
<button class='disable-during-eval' id='db-reset'>Reset db</button>
<button id='output-clear'>Clear output</button>
<span class='input-wrapper flex-col'>
<label for='select-impl'>Storage impl:</label>
<select id='select-impl'>
<option value='virtualfs'>Virtual filesystem</option>
<option value='memdb'>:memory:</option>
<option value='wasmfs-opfs'>WASMFS OPFS</option>
<option value='websql'>WebSQL</option>
</select>
</span>
</fieldset>
</div>
<hr>
<span class='input-wrapper'>
<input type='checkbox' class='disable-during-eval' id='cb-reverse-log-order' checked></input>
<label for='cb-reverse-log-order'>Reverse log order (newest first)</label>
</span>
<div id='test-output'></div>
<script src="jswasm/sqlite3.js"></script>
<script src="common/SqliteTestUtil.js"></script>
<script src="batch-runner.js"></script>
<style>
.flex-col {
display: flex;
flex-direction: column;
}
#toolbar > div {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
#toolbar > div > * {
margin: 0.25em;
}
</style>
</body>
</html>
-604
View File
@@ -1,604 +0,0 @@
/*
2022-08-29
The author disclaims copyright to this source code. In place of a
legal notice, here is a blessing:
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
***********************************************************************
A basic batch SQL runner for sqlite3-api.js. This file must be run in
main JS thread and sqlite3.js must have been loaded before it.
*/
'use strict';
(function(){
const toss = function(...args){throw new Error(args.join(' '))};
const warn = console.warn.bind(console);
let sqlite3;
const urlParams = new URL(self.location.href).searchParams;
const cacheSize = (()=>{
if(urlParams.has('cachesize')) return +urlParams.get('cachesize');
return 200;
})();
/** Throws if the given sqlite3 result code is not 0. */
const checkSqliteRc = (dbh,rc)=>{
if(rc) toss("Prepare failed:",sqlite3.capi.sqlite3_errmsg(dbh));
};
const sqlToDrop = [
"SELECT type,name FROM sqlite_schema ",
"WHERE name NOT LIKE 'sqlite\\_%' escape '\\' ",
"AND name NOT LIKE '\\_%' escape '\\'"
].join('');
const clearDbWebSQL = function(db){
db.handle.transaction(function(tx){
const onErr = (e)=>console.error(e);
const callback = function(tx, result){
const rows = result.rows;
let i, n;
i = n = rows.length;
while(i--){
const row = rows.item(i);
const name = JSON.stringify(row.name);
const type = row.type;
switch(type){
case 'index': case 'table':
case 'trigger': case 'view': {
const sql2 = 'DROP '+type+' '+name;
tx.executeSql(sql2, [], ()=>{}, onErr);
break;
}
default:
warn("Unhandled db entry type:",type,'name =',name);
break;
}
}
};
tx.executeSql(sqlToDrop, [], callback, onErr);
db.handle.changeVersion(db.handle.version, "", ()=>{}, onErr, ()=>{});
});
};
const clearDbSqlite = function(db){
// 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)
// open the same DB twice to clear it using that API, so...
const rc = sqlite3.wasm.exports.sqlite3_wasm_db_reset(db.handle);
App.logHtml("reset db rc =",rc,db.id, db.filename);
};
const E = (s)=>document.querySelector(s);
const App = {
e: {
output: E('#test-output'),
selSql: E('#sql-select'),
btnRun: E('#sql-run'),
btnRunNext: E('#sql-run-next'),
btnRunRemaining: E('#sql-run-remaining'),
btnExportMetrics: E('#export-metrics'),
btnClear: E('#output-clear'),
btnReset: E('#db-reset'),
cbReverseLog: E('#cb-reverse-log-order'),
selImpl: E('#select-impl'),
fsToolbar: E('#toolbar')
},
db: Object.create(null),
dbs: Object.create(null),
cache:{},
metrics: {
fileCount: 0,
runTimeMs: 0,
prepareTimeMs: 0,
stepTimeMs: 0,
stmtCount: 0,
strcpyMs: 0,
sqlBytes: 0
},
log: console.log.bind(console),
warn: console.warn.bind(console),
cls: function(){this.e.output.innerHTML = ''},
logHtml2: function(cssClass,...args){
const ln = document.createElement('div');
if(cssClass) ln.classList.add(cssClass);
ln.append(document.createTextNode(args.join(' ')));
this.e.output.append(ln);
//this.e.output.lastElementChild.scrollIntoViewIfNeeded();
},
logHtml: function(...args){
console.log(...args);
if(1) this.logHtml2('', ...args);
},
logErr: function(...args){
console.error(...args);
if(1) this.logHtml2('error', ...args);
},
execSql: async function(name,sql){
const db = this.getSelectedDb();
const banner = "========================================";
this.logHtml(banner,
"Running",name,'('+sql.length,'bytes) using',db.id);
const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
let pStmt = 0, pSqlBegin;
const metrics = db.metrics = Object.create(null);
metrics.prepTotal = metrics.stepTotal = 0;
metrics.stmtCount = 0;
metrics.malloc = 0;
metrics.strcpy = 0;
this.blockControls(true);
if(this.gotErr){
this.logErr("Cannot run SQL: error cleanup is pending.");
return;
}
// Run this async so that the UI can be updated for the above header...
const endRun = ()=>{
metrics.evalSqlEnd = performance.now();
metrics.evalTimeTotal = (metrics.evalSqlEnd - metrics.evalSqlStart);
this.logHtml(db.id,"metrics:",JSON.stringify(metrics, undefined, ' '));
this.logHtml("prepare() count:",metrics.stmtCount);
this.logHtml("Time in prepare_v2():",metrics.prepTotal,"ms",
"("+(metrics.prepTotal / metrics.stmtCount),"ms per prepare())");
this.logHtml("Time in step():",metrics.stepTotal,"ms",
"("+(metrics.stepTotal / metrics.stmtCount),"ms per step())");
this.logHtml("Total runtime:",metrics.evalTimeTotal,"ms");
this.logHtml("Overhead (time - prep - step):",
(metrics.evalTimeTotal - metrics.prepTotal - metrics.stepTotal)+"ms");
this.logHtml(banner,"End of",name);
this.metrics.prepareTimeMs += metrics.prepTotal;
this.metrics.stepTimeMs += metrics.stepTotal;
this.metrics.stmtCount += metrics.stmtCount;
this.metrics.strcpyMs += metrics.strcpy;
this.metrics.sqlBytes += sql.length;
};
let runner;
if('websql'===db.id){
const who = this;
runner = function(resolve, reject){
/* WebSQL cannot execute multiple statements, nor can it execute SQL without
an explicit transaction. Thus we have to do some fragile surgery on the
input SQL. Since we're only expecting carefully curated inputs, the hope is
that this will suffice. PS: it also can't run most SQL functions, e.g. even
instr() results in "not authorized". */
if('string'!==typeof sql){ // assume TypedArray
sql = new TextDecoder().decode(sql);
}
sql = sql.replace(/-- [^\n]+\n/g,''); // comment lines interfere with our split()
const sqls = sql.split(/;+\n/);
const rxBegin = /^BEGIN/i, rxCommit = /^COMMIT/i;
try {
const nextSql = ()=>{
let x = sqls.shift();
while(sqls.length && !x) x = sqls.shift();
return x && x.trim();
};
const who = this;
const transaction = function(tx){
try {
let s;
/* Try to approximate the spirit of the input scripts
by running batches bound by BEGIN/COMMIT statements. */
for(s = nextSql(); !!s; s = nextSql()){
if(rxBegin.test(s)) continue;
else if(rxCommit.test(s)) break;
//console.log("websql sql again",sqls.length, s);
++metrics.stmtCount;
const t = performance.now();
tx.executeSql(s,[], ()=>{}, (t,e)=>{
console.error("WebSQL error",e,"SQL =",s);
who.logErr(e.message);
//throw e;
return false;
});
metrics.stepTotal += performance.now() - t;
}
}catch(e){
who.logErr("transaction():",e.message);
throw e;
}
};
const n = sqls.length;
const nextBatch = function(){
if(sqls.length){
console.log("websql sqls.length",sqls.length,'of',n);
db.handle.transaction(transaction, (e)=>{
who.logErr("Ignoring and contiuing:",e.message)
//reject(e);
return false;
}, nextBatch);
}else{
resolve(who);
}
};
metrics.evalSqlStart = performance.now();
nextBatch();
}catch(e){
//this.gotErr = e;
console.error("websql error:",e);
who.logErr(e.message);
//reject(e);
}
}.bind(this);
}else{/*sqlite3 db...*/
runner = function(resolve, reject){
++this.metrics.fileCount;
metrics.evalSqlStart = performance.now();
const stack = wasm.scopedAllocPush();
try {
let t;
let sqlByteLen = sql.byteLength;
const [ppStmt, pzTail] = wasm.scopedAllocPtr(2);
t = performance.now();
pSqlBegin = wasm.scopedAlloc( sqlByteLen + 1/*SQL + NUL*/) || toss("alloc(",sqlByteLen,") failed");
metrics.malloc = performance.now() - t;
metrics.byteLength = sqlByteLen;
let pSql = pSqlBegin;
const pSqlEnd = pSqlBegin + sqlByteLen;
t = performance.now();
wasm.heap8().set(sql, pSql);
wasm.poke(pSql + sqlByteLen, 0);
metrics.strcpy = performance.now() - t;
let breaker = 0;
while(pSql && wasm.peek(pSql,'i8')){
wasm.pokePtr(ppStmt, 0);
wasm.pokePtr(pzTail, 0);
t = performance.now();
let rc = capi.sqlite3_prepare_v3(
db.handle, pSql, sqlByteLen, 0, ppStmt, pzTail
);
metrics.prepTotal += performance.now() - t;
checkSqliteRc(db.handle, rc);
pStmt = wasm.peekPtr(ppStmt);
pSql = wasm.peekPtr(pzTail);
sqlByteLen = pSqlEnd - pSql;
if(!pStmt) continue/*empty statement*/;
++metrics.stmtCount;
t = performance.now();
rc = capi.sqlite3_step(pStmt);
capi.sqlite3_finalize(pStmt);
pStmt = 0;
metrics.stepTotal += performance.now() - t;
switch(rc){
case capi.SQLITE_ROW:
case capi.SQLITE_DONE: break;
default: checkSqliteRc(db.handle, rc); toss("Not reached.");
}
}
resolve(this);
}catch(e){
if(pStmt) capi.sqlite3_finalize(pStmt);
//this.gotErr = e;
reject(e);
}finally{
capi.sqlite3_exec(db.handle,"rollback;",0,0,0);
wasm.scopedAllocPop(stack);
}
}.bind(this);
}
let p;
if(1){
p = new Promise(function(res,rej){
setTimeout(()=>runner(res, rej), 0)/*give UI a chance to output the "running" banner*/;
});
}else{
p = new Promise(runner);
}
return p.catch(
(e)=>this.logErr("Error via execSql("+name+",...):",e.message)
).finally(()=>{
endRun();
this.blockControls(false);
});
},
clearDb: function(){
const db = this.getSelectedDb();
if('websql'===db.id){
this.logErr("TODO: clear websql db.");
return;
}
if(!db.handle) return;
const capi = this.sqlite3, wasm = this.sqlite3.wasm;
//const scope = wasm.scopedAllocPush(
this.logErr("TODO: clear db");
},
/**
Loads batch-runner.list and populates the selection list from
it. Returns a promise which resolves to nothing in particular
when it completes. Only intended to be run once at the start
of the app.
*/
loadSqlList: async function(){
const sel = this.e.selSql;
sel.innerHTML = '';
this.blockControls(true);
const infile = 'batch-runner.list';
this.logHtml("Loading list of SQL files:", infile);
let txt;
try{
const r = await fetch(infile);
if(404 === r.status){
toss("Missing file '"+infile+"'.");
}
if(!r.ok) toss("Loading",infile,"failed:",r.statusText);
txt = await r.text();
const warning = E('#warn-list');
if(warning) warning.remove();
}catch(e){
this.logErr(e.message);
throw e;
}finally{
this.blockControls(false);
}
const list = txt.split(/\n+/);
let opt;
if(0){
opt = document.createElement('option');
opt.innerText = "Select file to evaluate...";
opt.value = '';
opt.disabled = true;
opt.selected = true;
sel.appendChild(opt);
}
list.forEach(function(fn){
if(!fn) return;
opt = document.createElement('option');
opt.value = fn;
opt.innerText = fn.split('/').pop();
sel.appendChild(opt);
});
this.logHtml("Loaded",infile);
},
/** Fetch ./fn and return its contents as a Uint8Array. */
fetchFile: async function(fn, cacheIt=false){
if(cacheIt && this.cache[fn]) return this.cache[fn];
this.logHtml("Fetching",fn,"...");
let sql;
try {
const r = await fetch(fn);
if(!r.ok) toss("Fetch failed:",r.statusText);
sql = new Uint8Array(await r.arrayBuffer());
}catch(e){
this.logErr(e.message);
throw e;
}
this.logHtml("Fetched",sql.length,"bytes from",fn);
if(cacheIt) this.cache[fn] = sql;
return sql;
}/*fetchFile()*/,
/** Disable or enable certain UI controls. */
blockControls: function(disable){
//document.querySelectorAll('.disable-during-eval').forEach((e)=>e.disabled = disable);
this.e.fsToolbar.disabled = disable;
},
/**
Converts this.metrics() to a form which is suitable for easy conversion to
CSV. It returns an array of arrays. The first sub-array is the column names.
The 2nd and subsequent are the values, one per test file (only the most recent
metrics are kept for any given file).
*/
metricsToArrays: function(){
const rc = [];
Object.keys(this.dbs).sort().forEach((k)=>{
const d = this.dbs[k];
const m = d.metrics;
delete m.evalSqlStart;
delete m.evalSqlEnd;
const mk = Object.keys(m).sort();
if(!rc.length){
rc.push(['db', ...mk]);
}
const row = [k.split('/').pop()/*remove dir prefix from filename*/];
rc.push(row);
row.push(...mk.map((kk)=>m[kk]));
});
return rc;
},
metricsToBlob: function(colSeparator='\t'){
const ar = [], ma = this.metricsToArrays();
if(!ma.length){
this.logErr("Metrics are empty. Run something.");
return;
}
ma.forEach(function(row){
ar.push(row.join(colSeparator),'\n');
});
return new Blob(ar);
},
downloadMetrics: function(){
const b = this.metricsToBlob();
if(!b) return;
const url = URL.createObjectURL(b);
const a = document.createElement('a');
a.href = url;
a.download = 'batch-runner-js-'+((new Date().getTime()/1000) | 0)+'.csv';
this.logHtml("Triggering download of",a.download);
document.body.appendChild(a);
a.click();
setTimeout(()=>{
document.body.removeChild(a);
URL.revokeObjectURL(url);
}, 500);
},
/**
Fetch file fn and eval it as an SQL blob. This is an async
operation and returns a Promise which resolves to this
object on success.
*/
evalFile: async function(fn){
const sql = await this.fetchFile(fn);
return this.execSql(fn,sql);
}/*evalFile()*/,
/**
Clears all DB tables in all _opened_ databases. Because of
disparities between backends, we cannot simply "unlink" the
databases to clean them up.
*/
clearStorage: function(onlySelectedDb=false){
const list = onlySelectedDb
? [('boolean'===typeof onlySelectedDb)
? this.dbs[this.e.selImpl.value]
: onlySelectedDb]
: Object.values(this.dbs);
for(let db of list){
if(db && db.handle){
this.logHtml("Clearing db",db.id);
db.clear();
}
}
},
/**
Fetches the handle of the db associated with
this.e.selImpl.value, opening it if needed.
*/
getSelectedDb: function(){
if(!this.dbs.memdb){
for(let opt of this.e.selImpl.options){
const d = this.dbs[opt.value] = Object.create(null);
d.id = opt.value;
switch(d.id){
case 'virtualfs':
d.filename = 'file:/virtualfs.sqlite3?vfs=unix-none';
break;
case 'memdb':
d.filename = ':memory:';
break;
case 'wasmfs-opfs':
d.filename = 'file:'+(
this.sqlite3.capi.sqlite3_wasmfs_opfs_dir()
)+'/wasmfs-opfs.sqlite3b';
break;
case 'websql':
d.filename = 'websql.db';
break;
default:
this.logErr("Unhandled db selection option (see details in the console).",opt);
toss("Unhandled db init option");
}
}
}/*first-time init*/
const dbId = this.e.selImpl.value;
const d = this.dbs[dbId];
if(d.handle) return d;
if('websql' === dbId){
d.handle = self.openDatabase('batch-runner', '0.1', 'foo', 1024 * 1024 * 50);
d.clear = ()=>clearDbWebSQL(d);
d.handle.transaction(function(tx){
tx.executeSql("PRAGMA cache_size="+cacheSize);
App.logHtml(dbId,"cache_size =",cacheSize);
});
}else{
const capi = this.sqlite3.capi, wasm = this.sqlite3.wasm;
const stack = wasm.scopedAllocPush();
let pDb = 0;
try{
const oFlags = capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE;
const ppDb = wasm.scopedAllocPtr();
const rc = capi.sqlite3_open_v2(d.filename, ppDb, oFlags, null);
pDb = wasm.peekPtr(ppDb)
if(rc) toss("sqlite3_open_v2() failed with code",rc);
capi.sqlite3_exec(pDb, "PRAGMA cache_size="+cacheSize, 0, 0, 0);
this.logHtml(dbId,"cache_size =",cacheSize);
}catch(e){
if(pDb) capi.sqlite3_close_v2(pDb);
}finally{
wasm.scopedAllocPop(stack);
}
d.handle = pDb;
d.clear = ()=>clearDbSqlite(d);
}
d.clear();
this.logHtml("Opened db:",dbId,d.filename);
console.log("db =",d);
return d;
},
run: function(sqlite3){
delete this.run;
this.sqlite3 = sqlite3;
const capi = sqlite3.capi, wasm = sqlite3.wasm;
this.logHtml("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
this.logHtml("WASM heap size =",wasm.heap8().length);
this.loadSqlList();
if(capi.sqlite3_wasmfs_opfs_dir()){
E('#warn-opfs').classList.remove('hidden');
}else{
E('#warn-opfs').remove();
E('option[value=wasmfs-opfs]').disabled = true;
}
if('function' === typeof self.openDatabase){
E('#warn-websql').classList.remove('hidden');
}else{
E('option[value=websql]').disabled = true;
E('#warn-websql').remove();
}
const who = this;
if(this.e.cbReverseLog.checked){
this.e.output.classList.add('reverse');
}
this.e.cbReverseLog.addEventListener('change', function(){
who.e.output.classList[this.checked ? 'add' : 'remove']('reverse');
}, false);
this.e.btnClear.addEventListener('click', ()=>this.cls(), false);
this.e.btnRun.addEventListener('click', function(){
if(!who.e.selSql.value) return;
who.evalFile(who.e.selSql.value);
}, false);
this.e.btnRunNext.addEventListener('click', function(){
++who.e.selSql.selectedIndex;
if(!who.e.selSql.value) return;
who.evalFile(who.e.selSql.value);
}, false);
this.e.btnReset.addEventListener('click', function(){
who.clearStorage(true);
}, false);
this.e.btnExportMetrics.addEventListener('click', function(){
who.logHtml2('warning',"Triggering download of metrics CSV. Check your downloads folder.");
who.downloadMetrics();
//const m = who.metricsToArrays();
//console.log("Metrics:",who.metrics, m);
});
this.e.selImpl.addEventListener('change', function(){
who.getSelectedDb();
});
this.e.btnRunRemaining.addEventListener('click', async function(){
let v = who.e.selSql.value;
const timeStart = performance.now();
while(v){
await who.evalFile(v);
if(who.gotError){
who.logErr("Error handling script",v,":",who.gotError.message);
break;
}
++who.e.selSql.selectedIndex;
v = who.e.selSql.value;
}
const timeTotal = performance.now() - timeStart;
who.logHtml("Run-remaining time:",timeTotal,"ms ("+(timeTotal/1000/60)+" minute(s))");
who.clearStorage();
App.metrics.runTimeMs = timeTotal;
who.logHtml("Total metrics:",JSON.stringify(App.metrics,undefined,' '));
}, false);
}/*run()*/
}/*App*/;
self.sqlite3TestModule.initSqlite3().then(function(sqlite3_){
sqlite3 = sqlite3_;
self.App = App /* only to facilitate dev console access */;
App.run(sqlite3);
});
})();
+2767
View File
File diff suppressed because it is too large Load Diff
-1531
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -13,7 +13,7 @@
Demonstration of the sqlite3 Worker API #1 Promiser: a Promise-based
proxy for for the sqlite3 Worker #1 API.
*/
//#if target=es6-module
//#if target:es6-module
import {default as promiserFactory} from "./jswasm/sqlite3-worker1-promiser.mjs";
//#else
"use strict";
@@ -40,7 +40,7 @@ delete globalThis.sqlite3Worker1Promiser;
};
const promiserConfig = {
//#ifnot target=es6-module
//#if not target:es6-module
/**
The v1 interfaces uses an onready function. The v2 interface optionally
accepts one but does not require it. If provided, it is called _before_
-152
View File
@@ -1,152 +0,0 @@
#!/do/not/make
#^^^ help emacs select edit mode
#
# Intended to include'd by ./GNUmakefile.
#
# 'make dist' rules for creating a distribution archive of the SQLite
# WASM/JS deliverables.
#
# Use 'make snapshot' to create "snapshot" releases. They use
# distinctly different zip file and top directory names to distinguish
# them from release builds.
#######################################################################
MAKEFILE.dist = $(lastword $(MAKEFILE_LIST))
########################################################################
# Chicken/egg situation: we need $(bin.version-info) to get the
# version info for the archive name, but that binary may not yet be
# built, and won't be built until we expand the dependencies. Thus we
# have to use a temporary name for the archive until we can get
# that binary built.
ifeq (1,$(SQLITE_C_IS_SEE))
dist-name-extra = -see
else
dist-name-extra =
endif
ifeq (,$(filter snapshot,$(MAKECMDGOALS)))
dist-name-prefix = sqlite-wasm$(dist-name-extra)
else
dist-name-prefix = sqlite-wasm$(dist-name-extra)-snapshot-$(shell /usr/bin/date +%Y%m%d)
endif
dist-name = $(dist-name-prefix)-TEMP
########################################################################
# $(dist.build) must be the name of a target which triggers the build
# of the files to be packed into the dist archive. The intention is
# that it be one of (o0, o1, o2, o3, os, oz), each of which uses
# like-named -Ox optimization level flags. The o2 target provides the
# best overall runtime speeds. The oz target provides slightly slower
# speeds (roughly 10%) with significantly smaller WASM file sizes. -O2
# (the o2 target) consistently results in faster binaries than both
# -O3 and -Os (the o3 and os targets) in all tests run to date. Our
# general policy is that we want the smallest binaries for dist zip
# files, so use the oz build unless there is a compelling reason not
# to.
dist.build ?= oz
dist-dir.top = $(dist-name)
dist-dir.jswasm = $(dist-dir.top)/$(notdir $(dir.dout))
dist-dir.common = $(dist-dir.top)/common
dist.top.extras = \
demo-123.html demo-123-worker.html demo-123.js \
tester1.html tester1-worker.html tester1-esm.html \
tester1.js tester1.mjs \
demo-jsstorage.html demo-jsstorage.js \
demo-worker1.html demo-worker1.js \
demo-worker1-promiser.html demo-worker1-promiser.js \
demo-worker1-promiser-esm.html demo-worker1-promiser.mjs
dist.jswasm.extras = $(sqlite3.wasm) \
$(sqlite3-api.ext.jses)
dist.common.extras = \
$(wildcard $(dir.common)/*.css) \
$(dir.common)/SqliteTestUtil.js
.PHONY: dist snapshot
# DIST_STRIP_COMMENTS $(call)able to be used in stripping C-style
# from the dist copies of certain files.
#
# $1 = source js file
# $2 = flags for $(bin.stripcomments)
define DIST_STRIP_COMMENTS
$(bin.stripccomments) $(2) < $(1) > $(dist-dir.jswasm)/$(notdir $(1)) || exit;
endef
# STRIP_K1.js = list of JS files which need to be passed through
# $(bin.stripcomments) with a single -k flag.
STRIP_K1.js = $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) \
$(sqlite3-worker1-bundler-friendly.js) \
$(sqlite3-api.ext.jses)
# STRIP_K2.js = list of JS files which need to be passed through
# $(bin.stripcomments) with two -k flags.
STRIP_K2.js = $(sqlite3.js) $(sqlite3.mjs) \
$(sqlite3-bundler-friendly.mjs) $(sqlite3-node.mjs)
########################################################################
# dist: create the end-user deliverable archive.
#
# Maintenance reminder: because dist depends on $(dist.build), and
# $(dist.build) will depend on clean, having any deps on
# $(dist-archive) which themselves may be cleaned up by the clean
# target will lead to grief in parallel builds (-j #). Thus
# dist's deps must be trimmed to non-generated files or
# files which are _not_ cleaned up by the clean target.
#
# We require $(bin.version-info) in order to figure out the dist
# file's name, so cannot (without a recursive make) have the target
# name equal to the archive name.
#
# 2025-01-15: Emsdk 4.0.0 introduces, in its generated code, a regex
# which contains the pattern /*. That, of course, confuses any C-style
# comment-stripper which is not specifically JS-aware and smart enough
# to know that it's in a regex or string literal. Because of that,
# comment-stripping was briefly disabled, resulting in functionally
# identical but significantly larger JS files. That issue with the
# comment-stripper has been resolved, but $(apply_comment_stripper)
# can be set to false to disable it if a similar problem arises.
#
#apply_comment_stripper = false
apply_comment_stripper = true
# ^^^ shell command true or false
dist: \
$(bin.stripccomments) $(bin.version-info) \
$(dist.build) $(STRIP_K1.js) $(STRIP_K2.js) \
$(dist.jswasm.extras) $(dist.common.extras) \
$(MAKEFILE) $(MAKEFILE.dist)
@echo "Making end-user deliverables..."
@rm -fr $(dist-dir.top)
@mkdir -p $(dist-dir.jswasm) $(dist-dir.common)
@cp -p $(dist.top.extras) $(dist-dir.top)
@cp -p README-dist.txt $(dist-dir.top)/README.txt
@cp -p index-dist.html $(dist-dir.top)/index.html
@cp -p $(dist.jswasm.extras) $(dist-dir.jswasm)
@if $(apply_comment_stripper); then $(foreach JS,$(STRIP_K1.js),$(call DIST_STRIP_COMMENTS,$(JS),-k)) fi
@if $(apply_comment_stripper); then $(foreach JS,$(STRIP_K2.js),$(call DIST_STRIP_COMMENTS,$(JS),-k -k)) fi
@cp -p $(dist.common.extras) $(dist-dir.common)
@set -e; \
vnum=$$($(bin.version-info) --download-version); \
vdir=$(dist-name-prefix)-$$vnum; \
arczip=$$vdir.zip; \
echo "Making $$arczip ..."; \
rm -fr $$arczip $$vdir; \
mv $(dist-dir.top) $$vdir; \
zip -qr $$arczip $$vdir; \
rm -fr $$vdir; \
ls -la $$arczip; \
set +e; \
unzip -lv $$arczip || echo "Missing unzip app? Not fatal."
ifeq (,$(wasm.docs.found))
snapshot: dist
@echo "To upload the snapshot build to the wasm docs server:"; \
echo "1) move $(dist-name-prefix)*.zip to the top of a wasm docs checkout."; \
echo "2) From that checkout run 'make uv-sync'"
else
snapshot: dist
@echo "Moving snapshot to [$(wasm.docs.found)]..."; \
mv $(dist-name-prefix)*.zip $(wasm.docs.found)/.
@echo "Run 'make uv-sync' from $(wasm.docs.found) to upload it."
endif
# We need a separate `clean` rule to account for weirdness in
# a sub-make, where we get a copy of the $(dist-name) dir
# copied into the new $(dist-name) dir.
.PHONY: dist-clean
clean: dist-clean
dist-clean: # not to be confused with distclean
rm -fr $(dist-name) $(wildcard sqlite-wasm-*.zip)
-184
View File
@@ -1,184 +0,0 @@
#!/do/not/make
#^^^ help emacs select edit mode
#
# Intended to include'd by ./GNUmakefile.
#######################################################################
########################################################################
# shell.c and its build flags...
ifneq (1,$(MAKING_CLEAN))
make-np-0 = make -C $(dir.top) -n -p
make-np-1 = sed -e 's/(TOP)/(dir.top)/g'
# Extract SHELL_OPT and SHELL_DEP from the top-most makefile and import
# them as vars here...
$(eval $(shell $(make-np-0) | grep -e '^SHELL_OPT ' | $(make-np-1)))
$(eval $(shell $(make-np-0) | grep -e '^SHELL_DEP ' | $(make-np-1)))
# ^^^ can't do that in 1 invocation b/c newlines get stripped
ifeq (,$(SHELL_OPT))
$(error Could not parse SHELL_OPT from $(dir.top)/Makefile.)
endif
ifeq (,$(SHELL_DEP))
$(error Could not parse SHELL_DEP from $(dir.top)/Makefile.)
endif
$(dir.top)/shell.c: $(SHELL_DEP) $(dir.tool)/mkshellc.tcl $(sqlite3.c)
$(MAKE) -C $(dir.top) shell.c
endif
# /shell.c
########################################################################
EXPORTED_FUNCTIONS.fiddle = $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
fiddle.emcc-flags = \
$(emcc.cflags) $(emcc_opt_full) \
--minify 0 \
-sALLOW_TABLE_GROWTH \
-sABORTING_MALLOC \
-sSTRICT_JS=0 \
-sENVIRONMENT=web,worker \
-sMODULARIZE \
-sDYNAMIC_EXECUTION=0 \
-sWASM_BIGINT=$(emcc.WASM_BIGINT) \
-sEXPORT_NAME=$(sqlite3.js.init-func) \
-Wno-limited-postlink-optimizations \
$(emcc.exportedRuntimeMethods),FS \
-sEXPORTED_FUNCTIONS=@$(abspath $(EXPORTED_FUNCTIONS.fiddle)) \
$(SQLITE_OPT.full-featured) \
$(SQLITE_OPT.common) \
$(SHELL_OPT) \
-UHAVE_READLINE -UHAVE_EDITLINE -UHAVE_LINENOISE \
-USQLITE_HAVE_ZLIB \
-USQLITE_WASM_BARE_BONES \
-DSQLITE_SHELL_FIDDLE
# Flags specifically for debug builds of fiddle. Performance suffers
# greatly in debug builds.
fiddle.emcc-flags.debug = $(fiddle.emcc-flags) \
-DSQLITE_DEBUG \
-DSQLITE_ENABLE_SELECTTRACE \
-DSQLITE_ENABLE_WHERETRACE
fiddle.EXPORTED_FUNCTIONS.in = \
EXPORTED_FUNCTIONS.fiddle.in \
$(dir.api)/EXPORTED_FUNCTIONS.sqlite3-core \
$(dir.api)/EXPORTED_FUNCTIONS.sqlite3-extras
$(EXPORTED_FUNCTIONS.fiddle): $(MKDIR.bld) $(fiddle.EXPORTED_FUNCTIONS.in) \
$(MAKEFILE.fiddle)
sort -u $(fiddle.EXPORTED_FUNCTIONS.in) > $@
fiddle.cses = $(dir.top)/shell.c $(sqlite3-wasm.c)
clean: clean-fiddle
clean-fiddle:
rm -f $(dir.fiddle)/fiddle-module.js \
$(dir.fiddle)/*.wasm \
$(dir.fiddle)/sqlite3-opfs-*.js \
$(dir.fiddle)/*.gz \
EXPORTED_FUNCTIONS.fiddle
rm -fr $(dir.fiddle-debug)
.PHONY: fiddle fiddle.debug
all: fiddle
########################################################################
# fiddle_remote is the remote destination for the fiddle app. It must
# be a [user@]HOST:/path for rsync. The target "should probably"
# contain a symlink of index.html -> fiddle.html.
fiddle_remote ?=
ifeq (,$(fiddle_remote))
ifneq (,$(wildcard /home/stephan))
fiddle_remote = wh:www/wasm-testing/fiddle/.
else ifneq (,$(wildcard /home/drh))
#fiddle_remote = if appropriate, add that user@host:/path here
endif
endif
push-fiddle: fiddle
@if [ x = "x$(fiddle_remote)" ]; then \
echo "fiddle_remote must be a [user@]HOST:/path for rsync"; \
exit 1; \
fi
rsync -va fiddle/ $(fiddle_remote)
# end fiddle remote push
########################################################################
########################################################################
# Explanation of the emcc build flags follows. Full docs for these can
# be found at:
#
# https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
#
# -sENVIRONMENT=web: elides bootstrap code related to non-web JS
# environments like node.js. Removing this makes the output a tiny
# tick larger but hypothetically makes it more portable to
# non-browser JS environments.
#
# -sMODULARIZE: changes how the generated code is structured to avoid
# declaring a global Module object and instead installing a function
# which loads and initializes the module. The function is named...
#
# -sEXPORT_NAME=jsFunctionName (see -sMODULARIZE)
#
# -sEXPORTED_RUNTIME_METHODS=@/absolute/path/to/file: a file
# containing a list of emscripten-supplied APIs, one per line, which
# must be exported into the generated JS. Must be an absolute path!
#
# -sEXPORTED_FUNCTIONS=@/absolute/path/to/file: a file containing a
# list of C functions, one per line, which must be exported via wasm
# so they're visible to JS. C symbols names in that file must all
# start with an underscore for reasons known only to the emcc
# developers. e.g., _sqlite3_open_v2 and _sqlite3_finalize. Must be
# an absolute path!
#
# -sSTRICT_JS ensures that the emitted JS code includes the 'use
# strict' option. Note that -sSTRICT is more broadly-scoped and
# results in build errors.
#
# -sALLOW_TABLE_GROWTH is required for (at a minimum) the UDF-binding
# feature. Without it, JS functions cannot be made to proxy C-side
# callbacks.
#
# -sABORTING_MALLOC causes the JS-bound _malloc() to abort rather than
# return 0 on OOM. If set to 0 then all code which uses _malloc()
# must, just like in C, check the result before using it, else
# they're likely to corrupt the JS/WASM heap by writing to its
# address of 0. It is, as of this writing, enabled in Emscripten by
# default but we enable it explicitly in case that default changes.
#
# -sDYNAMIC_EXECUTION=0 disables eval() and the Function constructor.
# If the build runs without these, it's preferable to use this flag
# because certain execution environments disallow those constructs.
# This flag is not strictly necessary, however.
#
# --no-entry: for compiling library code with no main(). If this is
# not supplied and the code has a main(), it is called as part of the
# module init process. Note that main() is #if'd out of shell.c
# (renamed) when building in wasm mode.
#
# --pre-js/--post-js=FILE relative or absolute paths to JS files to
# prepend/append to the emcc-generated bootstrapping JS. It's
# easier/faster to develop with separate JS files (reduces rebuilding
# requirements) but certain configurations, namely -sMODULARIZE, may
# require using at least a --pre-js file. They can be used
# individually and need not be paired.
#
# -O0..-O3 and -Oz: optimization levels affect not only C-style
# optimization but whether or not the resulting generated JS code
# gets minified. -O0 compiles _much_ more quickly than -O3 or -Oz,
# and doesn't minimize any JS code, so is recommended for
# development. -O3 or -Oz are recommended for deployment, but
# primarily because -Oz will shrink the wasm file notably. JS-side
# minification makes little difference in terms of overall
# distributable size.
#
# --minify 0: supposedly disables minification of the generated JS
# code, regardless of optimization level, but that's not quite true:
# search the main makefile for wasm-strip for details. Minification
# of the JS has minimal overall effect in the larger scheme of things
# and results in JS files which can neither be edited nor viewed as
# text files in Fossil (which flags them as binary because of their
# extreme line lengths). Interestingly, whether or not the comments
# in the generated JS file get stripped is unaffected by this setting
# and depends entirely on the optimization level. Higher optimization
# levels reduce the size of the JS considerably even without
# minification.
#
########################################################################
+92 -86
View File
@@ -167,6 +167,7 @@
lib: capi.sqlite3_libversion(),
srcId: capi.sqlite3_sourceid()
});
stdout("WASM pointer size: "+wasm.ptr.size);
stdout('Welcome to the "fiddle" shell. Tap the About button for more info.');
if(capi.sqlite3_vfs_find("opfs")){
stdout("\nOPFS is available. To open a persistent db, use:\n\n",
@@ -188,7 +189,7 @@
exec: function f(sql){
if(!f._){
if(!this.runMain()) return;
f._ = sqlite3.wasm.xWrap('fiddle_exec', null, ['string']);
f._ = sqlite3.wasm.xWrap('fiddle_exec', undefined, ['string']);
}
if(fiddleModule.isDead){
stderr("shell module has exit()ed. Cannot run SQL.");
@@ -201,15 +202,21 @@
}else if(sql){
if(Array.isArray(sql)) sql = sql.join('');
f._running = true;
//stdout("calling native exec:",sql);
f._(sql);
//stdout("returned from native exec",sql);
}
}finally{
delete f._running;
wMsg('working','end');
wMsg('wasm-info', {
pointerSize: sqlite3.wasm.ptr.size,
heapSize: sqlite3.wasm.heap8().byteLength
});
}
},
resetDb: function f(){
if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_reset_db', null);
if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_reset_db', undefined);
stdout("Resetting database.");
f._();
stdout("Reset",this.dbFilename());
@@ -217,7 +224,7 @@
/* 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: function f(){
if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_interrupt', null);
if(!f._) f._ = sqlite3.wasm.xWrap('fiddle_interrupt', undefined);
stdout("Requesting interrupt.");
f._();
}
@@ -232,92 +239,91 @@
}
//console.debug("worker: onmessage.data",ev);
switch(ev.type){
case 'shellExec': Sqlite3Shell.exec(ev.data); return;
case 'db-reset': Sqlite3Shell.resetDb(); return;
case 'interrupt': Sqlite3Shell.interrupt(); return;
/** Triggers the export of the current db. Fires an
event in the form:
case 'shellExec': Sqlite3Shell.exec(ev.data); return;
case 'db-reset': Sqlite3Shell.resetDb(); return;
case 'interrupt': Sqlite3Shell.interrupt(); return;
/** Triggers the export of the current db. Fires an
event in the form:
{type:'db-export',
data:{
filename: name of db,
buffer: contents of the db file (Uint8Array),
error: on error, a message string and no buffer property.
}
}
*/
case 'db-export': {
const fn = Sqlite3Shell.dbFilename();
stdout("Exporting",fn+".");
const fn2 = fn ? fn.split(/[/\\]/).pop() : null;
try{
if(!fn2) toss("DB appears to be closed.");
const buffer = sqlite3.capi.sqlite3_js_db_export(
Sqlite3Shell.dbHandle()
);
wMsg('db-export',{filename: fn2, buffer: buffer.buffer}, [buffer.buffer]);
}catch(e){
console.error("Export failed:",e);
/* Post a failure message so that UI elements disabled
during the export can be re-enabled. */
wMsg('db-export',{
filename: fn,
error: e.message
});
}
return;
}
case 'open': {
/* Expects: {
buffer: ArrayBuffer | Uint8Array,
filename: the filename for the db. Any dir part is
stripped.
}
*/
const opt = ev.data;
let buffer = opt.buffer;
stderr('open():',fixmeOPFS);
if(buffer instanceof ArrayBuffer){
buffer = new Uint8Array(buffer);
}else if(!(buffer instanceof Uint8Array)){
stderr("'open' expects {buffer:Uint8Array} containing an uploaded db.");
return;
}
buffer.set([1,1], 18)/*force db out of WAL mode*/;
const fn = (
opt.filename
? opt.filename.split(/[/\\]/).pop().replace('"','_')
: ("db-"+((Math.random() * 10000000) | 0)+
"-"+((Math.random() * 10000000) | 0)+".sqlite3")
{type:'db-export',
data:{
filename: name of db,
buffer: contents of the db file (Uint8Array),
error: on error, a message string and no buffer property.
}
}
*/
case 'db-export': {
const fn = Sqlite3Shell.dbFilename();
stdout("Exporting",fn+".");
const fn2 = fn ? fn.split(/[/\\]/).pop() : null;
try{
if(!fn2) toss("DB appears to be closed.");
const buffer = sqlite3.capi.sqlite3_js_db_export(
Sqlite3Shell.dbHandle()
);
try {
/* We cannot delete the existing db file until the new one
is installed, which means that we risk overflowing our
quota (if any) by having both the previous and current
db briefly installed in the virtual filesystem. */
const fnAbs = '/'+fn;
const oldName = Sqlite3Shell.dbFilename();
if(oldName && oldName===fnAbs){
/* We cannot create the replacement file while the current file
is opened, nor does the shell have a .close command, so we
must temporarily switch to another db... */
Sqlite3Shell.exec('.open :memory:');
fiddleModule.FS.unlink(fnAbs);
}
fiddleModule.FS.createDataFile("/", fn, buffer, true, true);
Sqlite3Shell.exec('.open "'+fnAbs+'"');
if(oldName && oldName!==fnAbs){
try{fiddleModule.fsUnlink(oldName)}
catch(e){/*ignored*/}
}
stdout("Replaced DB with",fn+".");
}catch(e){
stderr("Error installing db",fn+":",e.message);
}
wMsg('db-export',{filename: fn2, buffer: buffer.buffer}, [buffer.buffer]);
}catch(e){
console.error("Export failed:",e);
/* Post a failure message so that UI elements disabled
during the export can be re-enabled. */
wMsg('db-export',{
filename: fn,
error: e.message
});
}
return;
}
case 'open': {
/* Expects: {
buffer: ArrayBuffer | Uint8Array,
filename: the filename for the db. Any dir part is stripped.
}
*/
const opt = ev.data;
let buffer = opt.buffer;
stderr('open():',fixmeOPFS);
if(buffer instanceof ArrayBuffer){
buffer = new Uint8Array(buffer);
}else if(!(buffer instanceof Uint8Array)){
stderr("'open' expects {buffer:Uint8Array} containing an uploaded db.");
return;
}
buffer.set([1,1], 18)/*force db out of WAL mode*/;
const fn = (
opt.filename
? opt.filename.split(/[/\\]/).pop().replace(/["'\s]/g,'_')
: ("db-"+((Math.random() * 10000000) | 0)+
"-"+((Math.random() * 10000000) | 0)+".sqlite3")
);
try {
/* We cannot delete the existing db file until the new one
is installed, which means that we risk overflowing our
quota (if any) by having both the previous and current
db briefly installed in the virtual filesystem. */
const fnAbs = '/'+fn;
const oldName = Sqlite3Shell.dbFilename();
if(oldName && oldName===fnAbs){
/* We cannot create the replacement file while the current file
is opened, nor does the shell have a .close command, so we
must temporarily switch to another db... */
Sqlite3Shell.exec('.open :memory:');
fiddleModule.FS.unlink(fnAbs);
}
fiddleModule.FS.createDataFile("/", fn, buffer, true, true);
Sqlite3Shell.exec('.open '+fnAbs);
if(oldName && oldName!==fnAbs){
try{fiddleModule.fsUnlink(oldName)}
catch(e){/*ignored*/}
}
stdout("Replaced DB with",fn+".");
}catch(e){
stderr("Error installing db",fn+":",e.message);
}
return;
}
};
console.warn("Unknown fiddle-worker message type:",ev);
sqlite3.config.warn("Unknown fiddle-worker message type:",ev);
};
/**
@@ -372,8 +378,8 @@
*/
sqlite3InitModule(fiddleModule).then((_sqlite3)=>{
sqlite3 = _sqlite3;
console.warn("Installing sqlite3 module globally (in Worker)",
"for use in the dev console.", sqlite3);
sqlite3.config.warn("Installing sqlite3 module globally (in Worker)",
"for use in the dev console.", sqlite3);
globalThis.sqlite3 = sqlite3;
const dbVfs = sqlite3.wasm.xWrap('fiddle_db_vfs', "*", ['string']);
fiddleModule.fsUnlink = (fn)=>fiddleModule.FS.unlink(fn);
+17 -7
View File
@@ -344,6 +344,15 @@
].join(' ');
SF.echo("SQLite version",a.innerText);
});
SF.addMsgHandler('wasm-info', (ev)=>{
const v = ev.data;
SF.e.wasmInfo.innerText = 'WASM: '+(
4===v.pointerSize ? 32 : 64
)+'-bit'
//+' heap size: '+Number(v.heapSize)
// Heap size is not changing even when loading a huge db?
;
});
/* querySelectorAll() proxy */
const EAll = function(/*[element=document,] cssSelector*/){
@@ -409,6 +418,7 @@
SF.e ={
about: E('#view-about'),
split: E('#view-split'),
wasmInfo: E('#opt-wasm-info'),
terminal: E('#view-terminal'),
hideInTerminal: EAll('.hide-in-terminal'
/* Elements to hide when in terminal mode */)
@@ -633,13 +643,13 @@
SF.addMsgHandler('working',function f(ev){
switch(ev.data){
case 'start': /* See notes in preStartWork(). */; return;
case 'end':
preStartWork._.pageTitle.innerText = preStartWork._.pageTitleOrig;
btnShellExec.innerText = preStartWork._.btnLabel;
btnShellExec.removeAttribute('disabled');
btnInterrupt.setAttribute('disabled','disabled');
return;
case 'start': /* See notes in preStartWork(). */; return;
case 'end':
preStartWork._.pageTitle.innerText = preStartWork._.pageTitleOrig;
btnShellExec.innerText = preStartWork._.btnLabel;
btnShellExec.removeAttribute('disabled');
btnInterrupt.setAttribute('disabled','disabled');
return;
}
console.warn("Unhandled 'working' event:",ev.data);
});
+3
View File
@@ -384,6 +384,9 @@
data-config='autoClearOutput'>
<label for='opt-cb-autoclear'>Auto-clear output</label>
</span>
<span class='labeled-input'>
<span id='opt-wasm-info'>WASM: ???</span>
</span>
</div>
</fieldset><!-- .options -->
+3 -2
View File
@@ -97,8 +97,9 @@
wrapper is significantly easier to use, however.</li>
<li><a href='demo-worker1-promiser.html'>demo-worker1-promiser</a>:
a demo of the Promise-based wrapper of the Worker1 API.</li>
<!--li><a href='demo-worker1-promiser-esm.html'>demo-worker1-promiser-esm</a>:
same as the previous demo except loads the promiser from an ESM module.</li-->
<li><a href='module-symbols.html'>module-symbols</a> gives
a high-level overview of the symbols exposed by the JS
module.</li>
</ul>
</li>
</ul>
+45 -18
View File
@@ -49,20 +49,23 @@
<ul id='test-list'>
<li>Core-most tests
<ul>
<li><a href='tester1.html'>tester1</a>: Core unit and
<li>tester1 (<a href='tester1.html'>32-bit</a>
<a href='tester1-64bit.html'>64-bit</a>): Core unit and
regression tests for the various APIs and surrounding
utility code.</li>
<li><a href='tester1-worker.html'>tester1-worker</a>: same thing
but running in a Worker.</li>
<li><a href='tester1-esm.html'>tester1-esm</a>: same as
<li>tester1-esm (<a href='tester1-esm.html'>32-bit</a>
<a href='tester1-esm-64bit.html'>64-bit</a>): same as
<code>tester1</code> but loads sqlite3 in the main thread via
an ES6 module.
</li>
<li><a href='tester1-worker.html?esm'>tester1-worker?esm</a>:
same as <code>tester1-esm</code> but loads a Worker Module which
then loads the sqlite3 API via an ES6 module. Note that
not all browsers permit loading modules in Worker
threads.
<li>tester1-worker (<a href='tester1-worker.html'>32-bit</a>
<a href='tester1-worker-64bit.html'>64-bit</a>): same thing
but running in a Worker.</li>
<li>tester1-worker ESM (<a href='tester1-worker.html?esm'>32-bit</a>
<a href='tester1-worker-64bit.html?esm'>64-bit</a>): same as
tester1-worker but loads a Worker Module which then
loads the sqlite3 API via an ES6 module. Not all
browsers permit loading modules in Worker threads.
</li>
</ul>
</li>
@@ -90,12 +93,26 @@
</li>
<li>speedtest1 ports (sqlite3's primary benchmarking tool)...
<ul>
<li><a href='speedtest1.html'>speedtest1</a>: a main-thread WASM build of speedtest1.</li>
<li><a href='speedtest1.html?vfs=kvvfs'>speedtest1?vfs=kvvfs</a>: speedtest1 with the kvvfs.</li>
<li><a href='speedtest1-worker.html?size=15'>speedtest1-worker</a>: an interactive Worker-thread variant of speedtest1.</li>
<li><a href='speedtest1-worker.html?vfs=opfs&size=10'>speedtest1-worker?vfs=opfs</a>: speedtest1-worker with the
<li>speedtest1
(<a href='speedtest1.html'>32-bit</a>,
<a href='speedtest1-64bit.html'>64-bit</a>):
a main-thread WASM build of speedtest1.</li>
<li>speedtest1?vfs=kvvfs
(<a href='speedtest1.html?vfs=kvvfs'>32-bit</a>,
<a href='speedtest1-64bit.html?vfs=kvvfs'>64-bit</a>):
speedtest1 with the kvvfs.</li>
<li>speedtest1-worker
(<a href='speedtest1-worker.html?size=15'>32-bit</a>,
<a href='speedtest1-worker-64bit.html?size=15'>64-bit</a>):
an interactive Worker-thread variant of speedtest1.</li>
<li>speedtest1-worker?vfs=opfs
(<a href='speedtest1-worker.html?vfs=opfs&size=10'>32-bit</a>,
<a href='speedtest1-worker-64bit.html?vfs=opfs&size=10'>64-bit</a>):
speedtest1-worker with the
OPFS VFS preselected and configured for a moderate workload.</li>
<li><a href='speedtest1-worker.html?vfs=opfs-sahpool&size=10'>speedtest1-worker?vfs=opfs-sahpool</a>:
<li>speedtest1-worker?vfs=opfs-sahpool
(<a href='speedtest1-worker.html?vfs=opfs-sahpool&size=10'>32-bit</a>,
<a href='speedtest1-worker-64bit.html?vfs=opfs-sahpool&size=10'>64-bit</a>):
speedtest1-worker with the OPFS-SAHPOOL VFS preselected
and configured for a moderate workload.
</li>
@@ -123,19 +140,29 @@
demonstrates usage of the OPFS SAHPool VFS's "pause" feature to coordinate
access to a database.
</li>
<li><a href='SQLTester/index.html'>SQLTester</a> is
another testing tool for the library but making use of
it requires tests from an external, proprietary
project. Despite not being useful to the general public,
a link to it is in this list so that its developer has
easy access to it.
</li>
</ul>
</li>
<li><strong>WASMFS</strong>-specific tests which require that
the WASMFS build is available on this server (it is not by
default) and that this server emits the COOP/COEP headers.
<ul>
<!--li><a href='scratchpad-wasmfs.html'>scratchpad-wasmfs</a>:
<li><a href='scratchpad-wasmfs.html'>scratchpad-wasmfs</a>:
experimenting with WASMFS/OPFS-based persistence.
</li-->
<li><a href='speedtest1-wasmfs.html?flags=--size,10'>speedtest1-wasmfs</a>:
</li>
<!--speedtest1-wasmfs's build was broken in refactoring and it
has not been used in years, but it may be interesting
to revisit someday
li><a href='speedtest1-wasmfs.html?flags=--size,10'>speedtest1-wasmfs</a>:
a variant of speedtest1 built solely for the wasmfs/opfs
feature.
</li>
</li-->
</ul>
</li>
<!--li><a href='x.html'></a></li-->
+97 -56
View File
@@ -16,33 +16,20 @@
Project homes:
- https://fossil.wanderinghorse.net/r/jaccwabyt
- https://sqlite.org/src/dir/ext/wasm/jaccwabyt
*/
'use strict';
globalThis.Jaccwabyt = function StructBinderFactory(config){
/* ^^^^ it is recommended that clients move that object into wherever
they'd like to have it and delete the self-held copy ("self" being
the global window or worker object). This API does not require the
global reference - it is simply installed as a convenience for
connecting these bits to other co-developed code before it gets
removed from the global namespace.
they'd like to have it and delete the globalThis-held copy. This
API does not require the global reference - it is simply installed
as a convenience for connecting these bits to other co-developed
code before it gets removed from the global namespace.
*/
/** Throws a new Error, the message of which is the concatenation
all args with a space between each. */
const toss = (...args)=>{throw new Error(args.join(' '))};
/**
Implementing function bindings revealed significant
shortcomings in Emscripten's addFunction()/removeFunction()
interfaces:
https://github.com/emscripten-core/emscripten/issues/17323
Until those are resolved, or a suitable replacement can be
implemented, our function-binding API will be more limited
and/or clumsier to use than initially hoped.
*/
if(!(config.heap instanceof WebAssembly.Memory)
&& !(config.heap instanceof Function)){
toss("config.heap must be WebAssembly.Memory instance or a function.");
@@ -51,23 +38,54 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
(config[k] instanceof Function) ||
toss("Config option '"+k+"' must be a function.");
});
const __heap = config.heap;
const SBF = StructBinderFactory;
const heap = (config.heap instanceof Function)
? config.heap : (()=>new Uint8Array(config.heap.buffer)),
const heap = __heap ? __heap : ()=>new Uint8Array(__heap.buffer),
alloc = config.alloc,
dealloc = config.dealloc,
log = config.log || console.log.bind(console),
log = config.log || console.debug.bind(console),
memberPrefix = (config.memberPrefix || ""),
memberSuffix = (config.memberSuffix || ""),
bigIntEnabled = (undefined===config.bigIntEnabled
? !!globalThis['BigInt64Array'] : !!config.bigIntEnabled),
BigInt = globalThis['BigInt'],
BigInt64Array = globalThis['BigInt64Array'],
bigIntEnabled = config.bigIntEnabled ?? !!BigInt64Array,
ptrIR = config.pointerIR
|| config.ptrIR/*deprecated*/
|| 'i32',
/* Undocumented (on purpose) config options: */
ptrSizeof = config.ptrSizeof || 4,
ptrIR = config.ptrIR || 'i32'
ptrSize = config.ptrSize/*deprecated*/
|| ('i32'===ptrIR ? 4 : 8)
;
if(ptrIR!=='i32' && ptrIR!=='i64') toss("Invalid pointer representation:",ptrIR);
if(ptrSize!==4 && ptrSize!==8) toss("Invalid pointer size:",ptrSize);
/** Either BigInt or, if !bigIntEnabled, a function which
throws complaining that BigInt is not enabled. */
const __BigInt = (bigIntEnabled && BigInt)
? (v)=>BigInt(v || 0)
: (v)=>toss("BigInt support is disabled in this build.");
const __asPtrType = ('i32'==ptrIR) ? Number : __BigInt;
const __NullPtr = __asPtrType(0);
/**
Expects any number of numeric arguments, each one of either type
Number or BigInt. It sums them up (from an implicit starting
point of 0 or 0n) and returns them as a number of the same type
which target.asPtrType() uses.
This is a workaround for not being able to mix Number/BigInt in
addition/subtraction expressions (which we frequently need for
calculating pointer offsets).
*/
const __ptrAdd = function(...args){
let rc = __NullPtr;
for( let i = 0; i < args.length; ++i ){
rc += __asPtrType(args[i]);
}
return rc;
};
if(!SBF.debugFlags){
SBF.__makeDebugFlags = function(deriveFrom=null){
/* This is disgustingly overengineered. :/ */
@@ -103,12 +121,15 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
// Int16Array uses the platform's endianness.
return new Int16Array(buffer)[0] === 256;
})();
/**
Some terms used in the internal docs:
StructType: a struct-wrapping class generated by this
framework.
DEF: struct description object.
SIG: struct member signature string.
*/
@@ -118,6 +139,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
/** True if SIG s is-a pointer signature. */
const isPtrSig = (s)=>'p'===s || 'P'===s;
const isAutoPtrSig = (s)=>'P'===s /*EXPERIMENTAL*/;
/** Returns p if SIG s is a function SIG, else returns s[0]. */
const sigLetter = (s)=>isFuncSig(s) ? 'p' : s[0];
/** Returns the WASM IR form of the Emscripten-conventional letter
at SIG s[0]. Throws for an unknown SIG. */
@@ -140,7 +162,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
const sigDVGetter = function(s){
switch(sigLetter(s)) {
case 'p': case 'P': case 's': {
switch(ptrSizeof){
switch(ptrSize){
case 4: return 'getInt32';
case 8: return affirmBigIntArray() && 'getBigInt64';
}
@@ -160,7 +182,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
const sigDVSetter = function(s){
switch(sigLetter(s)){
case 'p': case 'P': case 's': {
switch(ptrSizeof){
switch(ptrSize){
case 4: return 'setInt32';
case 8: return affirmBigIntArray() && 'setBigInt64';
}
@@ -175,19 +197,20 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
}
toss("Unhandled DataView setter for signature:",s);
};
/**
Returns either Number of BigInt, depending on the given
SIG. This constructor is used in property setters to coerce
the being-set value to the correct size.
Returns a factory for either Number or BigInt, depending on the
given SIG. This constructor is used in property setters to coerce
the being-set value to the correct pointer size.
*/
const sigDVSetWrapper = function(s){
switch(sigLetter(s)) {
case 'i': case 'f': case 'c': case 'C': case 'd': return Number;
case 'j': return affirmBigIntArray() && BigInt;
case 'j': return __BigInt;
case 'p': case 'P': case 's':
switch(ptrSizeof){
switch(ptrSize){
case 4: return Number;
case 8: return affirmBigIntArray() && BigInt;
case 8: return __BigInt;
}
break;
}
@@ -203,20 +226,29 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
};
/**
In order to completely hide StructBinder-bound struct
pointers from JS code, we store them in a scope-local
WeakMap which maps the struct-bound objects to their WASM
pointers. The pointers are accessible via
boundObject.pointer, which is gated behind an accessor
function, but are not exposed anywhere else in the
object. The main intention of that is to make it impossible
for stale copies to be made.
In order to completely hide StructBinder-bound struct pointers
from JS code, we store them in a scope-local WeakMap which maps
the struct-bound objects to their WASM pointers. The pointers are
accessible via boundObject.pointer, which is gated behind a
property interceptor, but are not exposed anywhere else in the
object.
*/
const __instancePointerMap = new WeakMap();
/** Property name for the pointer-is-external marker. */
const xPtrPropName = '(pointer-is-external)';
const __isPtr32 = (ptr)=>('number'===typeof ptr && (ptr===(ptr|0)) && ptr>=0);
const __isPtr64 = (ptr)=>(
('bigint'===typeof ptr && ptr >= 0) || __isPtr32(ptr)
);
/**
isPtr() is an alias for isPtr32() or isPtr64(), depending on
ptrSize.
*/
const __isPtr = (4===ptrSize) ? __isPtr32 : __isPtr64;
/** Frees the obj.pointer memory and clears the pointer
property. */
const __freeStruct = function(ctor, obj, m){
@@ -229,7 +261,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
try{
if(x instanceof Function) x.call(obj);
else if(x instanceof StructType) x.dispose();
else if('number' === typeof x) dealloc(x);
else if(__isPtr(x)) dealloc(x);
// else ignore. Strings are permitted to annotate entries
// to assist in debugging.
}catch(e){
@@ -275,7 +307,9 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
ctor.structName,"instance:",
ctor.structInfo.sizeof,"bytes @"+m);
}
if(fill) heap().fill(0, m, m + ctor.structInfo.sizeof);
if(fill){
heap().fill(0, Number(m), Number(m) + ctor.structInfo.sizeof);
}
__instancePointerMap.set(obj, m);
}catch(e){
__freeStruct(ctor, obj, m);
@@ -286,7 +320,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
const __memoryDump = function(){
const p = this.pointer;
return p
? new Uint8Array(heap().slice(p, p+this.structInfo.sizeof))
? new Uint8Array(heap().slice(Number(p), Number(p) + this.structInfo.sizeof))
: null;
};
@@ -350,12 +384,17 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
const __SAB = ('undefined'===typeof SharedArrayBuffer)
? function(){} : SharedArrayBuffer;
const __utf8Decode = function(arrayBuffer, begin, end){
if( 8===ptrSize ){
begin = Number(begin);
end = Number(end);
}
return __utf8Decoder.decode(
(arrayBuffer.buffer instanceof __SAB)
? arrayBuffer.slice(begin, end)
: arrayBuffer.subarray(begin, end)
);
};
/**
Uses __lookupMember() to find the given obj.structInfo key.
Returns that member if it is a string, else returns false. If the
@@ -430,8 +469,8 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
const h = heap();
//let i = 0;
//for( ; i < u.length; ++i ) h[mem + i] = u[i];
h.set(u, mem);
h[mem + u.length] = 0;
h.set(u, Number(mem));
h[__ptrAdd(mem, u.length)] = 0;
//log("allocCString @",mem," =",u);
return mem;
};
@@ -500,7 +539,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
return __setMemberCString(this, memberName, str);
})
});
// Function-type non-Property inherited members
// Function-type non-Property inherited members
Object.assign(StructType.prototype,{
addOnDispose: function(...v){
__addOnDispose(this,...v);
@@ -518,8 +557,6 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
memberKey: __memberKeyProp
});
const isNumericValue = (v)=>Number.isFinite(v) || (v instanceof (BigInt || Number));
/**
Pass this a StructBinder-generated prototype, and the struct
member description object. It will define property accessors for
@@ -574,7 +611,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
xPropName,'@', this.pointer,'+',descr.offset,'sz',descr.sizeof);
}
let rc = (
new DataView(heap().buffer, this.pointer + descr.offset, descr.sizeof)
new DataView(heap().buffer, Number(this.pointer) + descr.offset, descr.sizeof)
)[f._.getters[sigGlyph]](0, isLittleEndian);
if(dbg.getter) log("debug.getter:",xPropName,"result =",rc);
return rc;
@@ -590,24 +627,25 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
if(!this.pointer){
toss("Cannot set struct property on disposed instance.");
}
if(null===v) v = 0;
else while(!isNumericValue(v)){
if(null===v) v = __NullPtr;
else while(!__isPtr(v)){
if(isAutoPtrSig(descr.signature) && (v instanceof StructType)){
// It's a struct instance: let's store its pointer value!
v = v.pointer || 0;
v = v.pointer || __NullPtr;
if(dbg.setter) log("debug.setter:",xPropName,"resolved to",v);
break;
}
toss("Invalid value for pointer-type",xPropName+'.');
}
(
new DataView(heap().buffer, this.pointer + descr.offset, descr.sizeof)
new DataView(heap().buffer, Number(this.pointer) + descr.offset,
descr.sizeof)
)[f._.setters[sigGlyph]](0, f._.sw[sigGlyph](v), isLittleEndian);
};
}
Object.defineProperty(ctor.prototype, key, prop);
}/*makeMemberWrapper*/;
/**
The main factory function which will be returned to the
caller.
@@ -652,12 +690,15 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
}
const debugFlags = rop(SBF.__makeDebugFlags(StructBinder.debugFlags));
/** Constructor for the StructCtor. */
const zeroAsPtr = __asPtrType(0);
const StructCtor = function StructCtor(externalMemory){
externalMemory = __asPtrType(externalMemory);
//console.warn("externalMemory",externalMemory,arguments[0]);
if(!(this instanceof StructCtor)){
toss("The",structName,"constructor may only be called via 'new'.");
}else if(arguments.length){
if(externalMemory!==(externalMemory|0) || externalMemory<=0){
toss("Invalid pointer value for",structName,"constructor.");
if(Number.isNaN(externalMemory) || externalMemory<=zeroAsPtr){
toss("Invalid pointer value",arguments[0],"for",structName,"constructor.");
}
__allocStruct(StructCtor, this, externalMemory);
}else{
+51 -35
View File
@@ -23,6 +23,14 @@ Firefox and Chrome on Linux and all claims of Safari compatibility
are based solely on feature compatibility tables provided at
[MDN][].
**Non-browser compatibility**: this code does not target non-browser
JS engines and is completely untested on them. That said, it "might
work".
**64-bit WASM:** as of 2025-09-21 this API supports 64-bit WASM builds
but it has to be configured for it (see [](#api-binderfactory) for
details).
**Formalities:**
- Author: [Stephan Beal][sgb]
@@ -43,9 +51,9 @@ project was spawned:
> The author disclaims copyright to this source code. In place of a
> legal notice, here is a blessing:
>
> May you do good and not evil.
> May you find forgiveness for yourself and forgive others.
> May you share freely, never taking more than you give.
> - May you do good and not evil.
> - May you find forgiveness for yourself and forgive others.
> - May you share freely, never taking more than you give.
-----
@@ -199,10 +207,13 @@ const MyBinder = StructBinderFactory({
heap: WebAssembly.Memory instance or a function which returns
a Uint8Array or Int8Array view of the WASM memory,
alloc: function(howMuchMemory){...},
dealloc: function(pointerToFree){...}
dealloc: function(pointerToFree){...},
pointerIR: 'i32' or 'i64' // WASM pointer type - default = 'i32'
});
```
See [](#api-binderfactory) for full details about the config options.
It also offers a number of other settings, but all are optional except
for the ones shown above. Those three config options abstract away
details which are specific to a given WASM environment. They provide
@@ -212,7 +223,7 @@ a conventional Emscripten setup, that config might simply look like:
>
```javascript
{
heap: Module['asm']['memory'],
heap: Module?.asm?.memory || Module['wasmMemory'],
//Or:
// heap: ()=>Module['HEAP8'],
alloc: (n)=>Module['_malloc'](n),
@@ -315,12 +326,13 @@ Noting that:
- **All of these types are numeric**. Attempting to set any
struct-bound property to a non-numeric value will trigger an
exception except in cases explicitly noted otherwise.
- **"Char" types**: WASM does not define an `int8` type, nor does it
distinguish between signed and unsigned. This API treats `c` as
`int8` and `C` as `uint8` for purposes of getting and setting values
when using the `DataView` class. It is _not_ recommended that client
code use these types in new WASM-capable code, but they were added
for the sake of binding some immutable legacy code to WASM.
- **"Char" types**: WASM does not define an `int8` type, nor does its
JS representation distinguish between signed and unsigned. This API
treats `c` as `int8` and `C` as `uint8` for purposes of getting and
setting values when using the `DataView` class. It is _not_
recommended that client code use these types in new WASM-capable
code, but they were added for the sake of binding some immutable
legacy code to WASM.
> Sidebar: Emscripten's public docs do not mention `p`, but their
generated code includes `p` as an alias for `i`, presumably to mean
@@ -328,11 +340,9 @@ generated code includes `p` as an alias for `i`, presumably to mean
is more descriptive, so this framework encourages the use of `p` for
pointer-type members. Using `p` for pointers also helps future-proof
the signatures against the eventuality that WASM eventually supports
64-bit pointers. Note that sometimes `p` really means
pointer-to-pointer, but the Emscripten JS/WASM glue does not offer
that level of expressiveness in these signatures. We simply have to be
aware of when we need to deal with pointers and pointers-to-pointers
in JS code.
64-bit pointers. Note that sometimes `p` _really_ means a
pointer-to-pointer. We simply have to be aware of when we need to deal
with pointers and pointers-to-pointers in JS code.
> Trivia: this API treates `p` as distinctly different from `i` in
some contexts, so its use is encouraged for pointer types.
@@ -356,17 +366,17 @@ signature.replace(/[^vipPsjfdcC]/g,'').replace(/[pPscC]/g,'i');
*This support is experimental and subject to change.*
The method signature letter `p` means "pointer," which, in WASM, means
"integer." `p` is treated as an integer for most contexts, while still
also being a separate type (analog to how pointers in C are just a
special use of unsigned numbers). A capital `P` changes the semantics
of plain member pointers (but not, as of this writing, function
pointer members) as follows:
either int32 or int64. `p` is treated as a point for most contexts,
while still also being a separate type for function signature purposes
(analog to how pointers in C are just a special use of unsigned
numbers). A capital `P` changes the semantics of plain member pointers
(but not, as of this writing, function pointer members) as follows:
- When a `P`-type member is **set** via `myStruct.x=y`, if
[`(y instanceof StructType)`][StructType] then the value of `y.pointer` is
stored in `myStruct.x`. If `y` is neither a number nor
a [StructType][], an exception is triggered (regardless of whether
`p` or `P` is used).
When a `P`-type member is **set** via `myStruct.x=y`, if
[`(y instanceof StructType)`][StructType] then the value of `y.pointer` is
stored in `myStruct.x`. If `y` is neither a pointer nor a
[StructType][], an exception is triggered (regardless of whether `p`
or `P` is used).
<a name='step-3'></a>
@@ -473,15 +483,19 @@ It returns a function which these docs refer to as a [StructBinder][]
The binder factory supports the following options in its
configuration object argument:
- `pointerIR` (Added 2025-09-21)
Optionally specify the WASM pointer size with the string `'i32'` or
`'i64'`, defaulting to the former. When using with 64-bit WASM
builds, this must be set to `'i64'` by the client. Any other value
triggers an exception.
- `heap`
Must be either a `WebAssembly.Memory` instance representing the WASM
heap memory OR a function which returns an Int8Array or Uint8Array
view of the WASM heap. In the latter case the function should, if
appropriate for the environment, account for the heap being able to
grow. Jaccwabyt uses this property in such a way that it "should" be
okay for the WASM heap to grow at runtime (that case is, however,
untested).
grow. Jaccwabyt uses this property in such a way that it is legal
for the WASM heap to grow at runtime.
- `alloc`
Must be a function semantically compatible with Emscripten's
@@ -523,12 +537,11 @@ configuration object argument:
- `log`
Optional function used for debugging output. By default
`console.log` is used but by default no debug output is generated.
`console.debug` is used but by default no debug output is generated.
This API assumes that the function will space-separate each argument
(like `console.log` does). See [Appendix D](#appendix-d) for info
(like `console.debug` does). See [Appendix D](#appendix-d) for info
about enabling debugging output.
<a name='api-structbinder'></a>
API: Struct Binder
------------------------------------------------------------
@@ -688,9 +701,12 @@ legally be called on concrete struct instances unless noted otherwise:
- `memoryDump()`
Returns a Uint8Array which contains the current state of this
object's raw memory buffer. Potentially useful for debugging, but
not much else. Note that the memory is necessarily, for
compatibility with C, written in the host platform's endianness and
is thus not useful as a persistent/portable serialization format.
not much else. The memory is necessarily, for compatibility with C,
written in the host platform's endianness. Since all WASM is
little-endian, it's the same everywhere. Even so: it should not be
used as a persistent serialization format because (A) any changes to
the struct will invalidate older serialized data and (B) serializing
member pointers is useless.
- `setMemberCString(memberName,str)`
Uses `StructType.allocCString()` to allocate a new C-style string,
+210
View File
@@ -0,0 +1,210 @@
#!/usr/bin/env bash
###
#
# Builds the SQLite JS/WASM distribution zip file.
#
# Usage: $0 build-name ?flags?
#
# build-name is the dir/archive name prefix for the
# build and defaults to sqlite-wasm.
#
# -?|--help = Show this text
#
# -0 = Use -O0 instead of ${optFlag}
#
# -1 = Use make -j1 instead of ${makeFlag}
#
# -64 = Include 64-bit builds
#
# --noclean = do not run 'make clean' first
#
# --snapshot = gives the archive name a distinctive suffix
#
###
function die(){
local rc=$1
shift
echo "Error: $@" 1>&2
exit $rc
}
dirTop=../..
buildName=
b64=0
optFlag=-Oz
clean=1
makeFlag=-j4
snapshotSuffix=
for arg in $@; do
case $arg in
-64) b64=1
;;
-0) optFlag=-O0
;;
-1) makeFlag=
;;
--noclean) clean=0
;;
--snapshot)
snapshotSuffix=$(date +%Y%m%d)
;;
-?|--help)
sed -n -e '2,/^###/p' $0
exit
;;
*) if [[ x != x${buildName} ]]; then
die 1 "Unhandled argument: $arg"
fi
buildName=$arg
;;
esac
done
make=
for i in gmake make; do
make=$(which $i 2>/dev/null)
[[ x != x${make} ]] && break
done
[[ x = x$make ]] && die 127 "Cannot find make"
[[ x = x${buildName} ]] && buildName=sqlite-wasm
buildName=${buildName}${snapshotSuffix}
echo "Creating the SQLite wasm dist bundle..."
#
# Generates files which, when built, will also build all of the pieces
# neaded for the dist bundle.
#
tgtFiles=(
demo-worker1-promiser.html
demo-worker1-promiser.js
demo-worker1-promiser-esm.html
demo-worker1-promiser.mjs
tester1.html
tester1-esm.html
tester1-worker.html
tester1.js
tester1.mjs
)
if [[ 1 = $b64 ]]; then
tgtFiles+=(
tester1-64bit.html
tester1-esm-64bit.html
tester1-worker-64bit.html
tester1-64bit.js
tester1-64bit.mjs
)
fi
[[ 1 = $clean ]] && $make clean
$make $makeFlag \
t-version-info t-stripccomments \
${tgtFiles[@]} \
"emcc_opt=${optFlag}" || die $?
dirTmp=d.dist
rm -fr $dirTmp
mkdir -p $dirTmp/jswasm || die $?
mkdir -p $dirTmp/common || die $?
# Static files for the top-most dir:
fTop=(
demo-123.html
demo-123-worker.html
demo-123.js
demo-worker1.html
demo-worker1.js
demo-jsstorage.html
demo-jsstorage.js
module-symbols.html
)
# Files for the jswasm subdir sans jswasm prefix:
#
# fJ1 = JS files to stripccomments -k on
# fJ2 = JS files to stripccomments -k -k on
fJ1=(
sqlite3-opfs-async-proxy.js
sqlite3-worker1.js
sqlite3-worker1.mjs
sqlite3-worker1-bundler-friendly.mjs
sqlite3-worker1-promiser.js
sqlite3-worker1-promiser.mjs
sqlite3-worker1-promiser-bundler-friendly.mjs
)
fJ2=(
sqlite3.js
sqlite3.mjs
)
# fW = list of wasm files to copy from jswasm/.
fW=(sqlite3.wasm)
if [[ 1 = $b64 ]]; then
fW+=(sqlite3-64bit.wasm)
fi
function fcp() {
cp -p $@ || die $?
chmod +w ${@: -1}
}
function scc(){
${dirTop}/tool/stripccomments $@ || die $?
}
jw=jswasm
fcp ${tgtFiles[@]} $dirTmp/.
fcp README-dist.txt $dirTmp/README.txt
fcp index-dist.html $dirTmp/index.html
fcp common/*.css common/SqliteTestUtil.js $dirTmp/common/.
for i in ${fTop[@]}; do
fcp $i $dirTmp/.
done
for i in ${fW[@]}; do
fcp $jw/$i $dirTmp/$jw/.
done
for i in ${fJ1[@]}; do
scc -k < $jw/$i > $dirTmp/$jw/$i || die $?
done
for i in ${fJ2[@]}; do
scc -k -k < $jw/$i > $dirTmp/$jw/$i || die $?
done
#
# Done copying files. Now zip it up...
#
svi=./version-info
vnum=$($svi --download-version)
[ "" = "$vnum" ] && die "version number is empty!"
vdir=${buildName}-${vnum}
fzip=${vdir}.zip
rm -fr ${vdir} ${fzip}
mv $dirTmp $vdir || die $?
zip -rq9 $fzip $(find $vdir -type f | sort) || die $?
ls -la $fzip
unzip -lv $fzip || die $?
cat <<EOF
**
** Unzipped files are in $vdir
**
EOF
+900 -299
View File
File diff suppressed because it is too large Load Diff
+13 -3
View File
@@ -58,9 +58,7 @@
border: 0 !important;
padding: 0 !important;
}
.func-wasm {
}
.func-wasm {}
.func-wasm::after {
content: "WASM";
color: saddlebrown;
@@ -117,6 +115,7 @@
</li>
<li><a href='#sqlite3.wasm'><code>sqlite3.wasm</code> namespace</a></li>
<li><a href='#sqlite3.wasm.pstack'><code>sqlite3.wasm.pstack</code> namespace</a></li>
<li><a href='#sqlite3.wasm.ptr'><code>sqlite3.wasm.ptr</code> namespace</a></li>
<li><a href='#compile-options'>Compilation options used in this module build</a></li>
</ul>
@@ -179,6 +178,14 @@
</p>
<div id='list-wasm-pstack' class='pseudolist'></div>
<a id="sqlite3.wasm.ptr"></a>
<h1><code>sqlite3.wasm.ptr</code> Namespace</h1>
<p>
The <code>sqlite3.wasm.ptr</code> namespace exposes the
following...
</p>
<div id='list-wasm-ptr' class='pseudolist'></div>
<a id="compile-options"></a>
<h1>Compilation Options</h1>
<p>
@@ -485,6 +492,9 @@
psKeys.push('pointer','quota','remaining');
renderX(E('#list-wasm-pstack'), wasm.pstack, psKeys);
const pwKeys = Object.keys(wasm.ptr);
renderX(E('#list-wasm-ptr'), wasm.ptr, pwKeys);
const cou = wasm.compileOptionUsed();
//const cou2 = Object.create(null);
//Object.entries(cou).forEach((e)=>cou2['SQLITE_'+e[0]] = e[1]);
+1 -1
View File
@@ -1,4 +1,4 @@
import sqlite3InitModule from './jswasm/speedtest1-wasmfs.mjs';
import sqlite3InitModule from './jswasm/sqlite3-wasmfs.mjs';
const wMsg = (type,...args)=>{
postMessage({type, args});
};
+4 -3
View File
@@ -170,9 +170,10 @@
const urlParams = new URL(self.location.href).searchParams;
const W = new Worker(
"speedtest1-worker.js?sqlite3.dir=jswasm"+
(urlParams.has('opfs-verbose') ? '&opfs-verbose' : '')+
(urlParams.has('opfs-disable') ? '&opfs-disable' : '')
"speedtest1-worker.js?sqlite3.dir=jswasm"+
'&sqlite3.debugModule'+
(urlParams.has('opfs-verbose') ? '&opfs-verbose' : '')+
(urlParams.has('opfs-disable') ? '&opfs-disable' : '')
);
const mPost = function(msgType,payload){
W.postMessage({type: msgType, data: payload});
+5
View File
@@ -80,6 +80,9 @@
}
App.wasm.xCall('wasm_main', argv.length,
App.wasm.scopedAllocMainArgv(argv));
log("WASM heap size:",App.wasm.heap8().byteLength,"bytes");
log("WASM pointer size:",App.wasm.ptr.size);
}catch(e){
mPost('error',e.message);
}finally{
@@ -113,6 +116,8 @@
log("Loaded speedtest1 module. Setting up...");
App.pDir = wasmfsDir(S.wasm);
App.wasm = S.wasm;
log("WASM heap size:",sqlite3.wasm.heap8().byteLength,"bytes");
log("WASM pointer size:",sqlite3.wasm.ptr.size);
//if(App.pDir) log("Persistent storage:",pDir);
//else log("Using transient storage.");
mPost('ready',true);
+4 -1
View File
@@ -79,7 +79,7 @@
logList.forEach((v)=>log2('',v));
logList.length = 0;
};
/* can't update DOM while speedtest is running unless we run
/* we cannot update DOM while speedtest is running unless we run
speedtest in a worker thread. */;
const log = (...args)=>{
console.log(...args);
@@ -147,6 +147,8 @@
// These log messages are not emitted to the UI until after main() returns. Fixing that
// requires moving the main() call and related cleanup into a timeout handler.
if(pDir) wasm.sqlite3_wasm_vfs_unlink(pVfs,dbFile);
log2('',"WASM heap size:",sqlite3.wasm.heap8().byteLength,"bytes");
log2('',"WASM pointer size:",sqlite3.wasm.ptr.size);
log2('',"Starting native app:\n ",argv.join(' '));
log2('',"This will take a while and the browser might warn about the runaway JS.",
"Give it time...");
@@ -162,6 +164,7 @@
if(pDir) wasm.sqlite3_wasm_vfs_unlink(pVfs,dbFile);
logList.unshift("Done running native main(). Output:");
dumpLogList();
log2('',"WASM heap size:",sqlite3.wasm.heap8().byteLength,"bytes");
}, 50);
}/*runTests()*/;
@@ -1,16 +1,17 @@
<!doctype html>
//#@policy error
<html lang="en-us">
<head>
<meta 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="stylesheet" href="../common/emscripten.css"/>
<link rel="stylesheet" href="../common/testing.css"/>
<title>sqlite3 tester #1: Worker thread</title>
<link rel="stylesheet" href="common/emscripten.css"/>
<link rel="stylesheet" href="common/testing.css"/>
<title>sqlite3 tester #1: Worker thread (@bitness@-bit WASM)</title>
<style></style>
</head>
<body>
<h1 id='color-target'>sqlite3 tester #1: Worker thread</h1>
<h1 id='color-target'>sqlite3 tester #1: Worker thread (@bitness@-bit WASM)</h1>
<div>Variants:
<a href='tester1.html' target='tester1.html'>conventional UI thread</a>,
<a href='tester1-worker.html' target='tester1-worker.html'>conventional worker</a>,
@@ -35,23 +36,29 @@
logTarget.append(ln);
};
const cbReverse = document.querySelector('#cb-log-reverse');
const cbReverseKey = 'tester1:cb-log-reverse';
const cbReverseIt = ()=>{
logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse');
localStorage.setItem(cbReverseKey, cbReverse.checked ? 1 : 0);
};
cbReverse.addEventListener('change',cbReverseIt,true);
if(localStorage.getItem(cbReverseKey)){
cbReverse.checked = !!(+localStorage.getItem(cbReverseKey));
}
cbReverseIt();
const urlParams = new URL(self.location.href).searchParams;
const workerArgs = [];
const baseName = "64"==="@bitness@" ? 'tester1-64bit' : 'tester1';
if(urlParams.has('esm')){
logHtml('warning',"Attempting to run an ES6 Worker Module, "+
"which is not supported by all browsers! "+
"e.g. Firefox (as of 2023-05) cannot do this.");
workerArgs.push("tester1.mjs",{type:"module"});
logHtml('warning',"Attempting to run an ES6 Worker Module, "+
"which is not supported by all browsers!.");
workerArgs.push(baseName+'.mjs', {type:"module"});
document.querySelectorAll('title,#color-target').forEach((e)=>{
e.innerText = "sqlite3 tester #1: ES6 Worker Module";
e.innerText =
"sqlite3 tester #1: ES6 Worker Module (@bitness@-bit WASM)";
});
}else{
workerArgs.push("tester1.js?sqlite3.dir=jswasm");
workerArgs.push(baseName+'.js?sqlite3.dir=jswasm');
}
const w = new Worker(...workerArgs);
w.onmessage = function({data}){
+6 -11
View File
@@ -1,4 +1,5 @@
<!doctype html>
//#@policy error
<html lang="en-us">
<head>
<meta charset="utf-8">
@@ -6,13 +7,7 @@
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<link rel="stylesheet" href="common/emscripten.css"/>
<link rel="stylesheet" href="common/testing.css"/>
<title>sqlite3 tester #1:
//#if target=es6-module
ES6 Module in UI thread
//#else
UI thread
//#endif
</title>
<title>sqlite3 tester #1: @title@ (@bitness@-bit WASM)</title>
<style></style>
</head>
<body><h1 id='color-target'></h1>
@@ -31,11 +26,11 @@ UI thread
document.querySelector('h1').innerHTML =
document.querySelector('title').innerHTML;
})();</script>
//#if target=es6-module
<script src="tester1.mjs" type="module"></script>
//#if target:es6-module
<script src="@tester1.js@" type="module"></script>
//#else
<script src="jswasm/sqlite3.js"></script>
<script src="tester1.js"></script>
<script src="@sqlite3.js@"></script>
<script src="@tester1.js@"></script>
//#endif
</body>
</html>
+355 -115
View File
@@ -41,10 +41,11 @@
ES6 worker module build:
./c-pp -f tester1.c-pp.js -o tester1-esm.mjs -Dtarget=es6-module
./c-pp -f tester1.c-pp.js -o tester1-esm.mjs -Dtarget:es6-module
*/
//#if target=es6-module
import {default as sqlite3InitModule} from './jswasm/sqlite3.mjs';
//#@policy error
//#if target:es6-module
import {default as sqlite3InitModule} from "@sqlite3.js@";
globalThis.sqlite3InitModule = sqlite3InitModule;
//#else
'use strict';
@@ -73,6 +74,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
&& navigator?.storage?.getDirectory;
};
let SQLite3 /* populated after module load */;
{
const mapToString = (v)=>{
switch(typeof v){
@@ -106,16 +109,15 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
logTarget.append(ln);
};
const cbReverse = document.querySelector('#cb-log-reverse');
//cbReverse.setAttribute('checked','checked');
const cbReverseKey = 'tester1:cb-log-reverse';
const cbReverseIt = ()=>{
logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse');
//localStorage.setItem(cbReverseKey, cbReverse.checked ? 1 : 0);
localStorage.setItem(cbReverseKey, cbReverse.checked ? 1 : 0);
};
cbReverse.addEventListener('change', cbReverseIt, true);
/*if(localStorage.getItem(cbReverseKey)){
if(localStorage.getItem(cbReverseKey)){
cbReverse.checked = !!(+localStorage.getItem(cbReverseKey));
}*/
}
cbReverseIt();
}else{ /* Worker thread */
console.log("Running in a Worker thread.");
@@ -136,6 +138,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}else{
postMessage({type:'test-result', payload:{pass}});
}
TestUtil.checkHeapSize(true);
};
const log = (...args)=>{
//console.log(...args);
@@ -160,6 +163,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const roundMs = (ms)=>Math.round(ms*100)/100;
const looksLikePtr = (v,positive=true)=> positive ? v>0 : v>=0;
/**
Helpers for writing sqlite3-specific tests.
*/
@@ -294,6 +299,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
logClass(['faded','one-test-summary'],
TestUtil.counter - tc, 'assertion(s) in',
roundMs(then-now),'ms');
TestUtil.checkHeapSize();
}
logClass(['green','group-end'],
"#"+this.number+":",
@@ -344,6 +350,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
reportFinalTestStatus(false);
}
}.bind(this));
},
checkHeapSize: function(force=false){
const heapSize = SQLite3.wasm.heap8().byteLength;
if( force || heapSize !== TestUtil.lastHeapSize ){
TestUtil.lastHeapSize = heapSize;
log('WASM heap size:', heapSize,'bytes');
}
}
}/*TestUtil*/;
const T = TestUtil;
@@ -405,7 +419,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
.assert(wasm.realloc.impl === wasm.exports.realloc);
}else{
T.assert(wasm.alloc.impl === wasm.exports.sqlite3_malloc)
.assert(wasm.dealloc === wasm.exports.sqlite3_free)
.assert(wasm.dealloc.impl === wasm.exports.sqlite3_free)
.assert(wasm.realloc.impl === wasm.exports.sqlite3_realloc);
}
}
@@ -502,7 +516,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
let m = w.alloc(14);
let m2 = w.realloc(m, 16);
T.assert(m === m2/* because of alignment */);
T.assert(0 === w.realloc(m, 0));
let x = w.realloc(m, 0);
T.assert(w.ptr.null === x);
m = m2 = 0;
// Check allocation limits and allocator's responses...
@@ -511,24 +526,26 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const tooMuch = sqlite3.capi.SQLITE_MAX_ALLOCATION_SIZE + 1,
isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError;
T.mustThrowMatching(()=>w.alloc(tooMuch), isAllocErr)
.assert(0 === w.alloc.impl(tooMuch))
.assert(w.ptr.null === w.alloc.impl(tooMuch))
.mustThrowMatching(()=>w.realloc(0, tooMuch), isAllocErr)
.assert(0 === w.realloc.impl(0, tooMuch));
.assert(w.ptr.null === w.realloc.impl(wasm.ptr.null, tooMuch));
}
// Check allocFromTypedArray()...
const byteList = [11,22,33]
const u = new Uint8Array(byteList);
m = w.allocFromTypedArray(u);
let mAsNumber = Number(m);
for(let i = 0; i < u.length; ++i){
T.assert(u[i] === byteList[i])
.assert(u[i] === w.peek8(m + i));
.assert(u[i] === w.peek8(mAsNumber + i));
}
w.dealloc(m);
m = w.allocFromTypedArray(u.buffer);
mAsNumber = Number(m);
for(let i = 0; i < u.length; ++i){
T.assert(u[i] === byteList[i])
.assert(u[i] === w.peek8(m + i));
.assert(u[i] === w.peek8(mAsNumber + i));
}
w.dealloc(m);
@@ -623,18 +640,19 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
try {
let cStr = w.scopedAllocCString("hello");
const n = w.cstrlen(cStr);
const nPtr = w.ptr.coerce(n);
let cpy = w.scopedAlloc(n+10);
let rc = w.cstrncpy(cpy, cStr, n+10);
T.assert(n+1 === rc).
assert("hello" === w.cstrToJs(cpy)).
assert(chr('o') === w.peek8(cpy+n-1)).
assert(0 === w.peek8(cpy+n));
assert(chr('o') === w.peek8( w.ptr.add(cpy,nPtr, -1))).
assert(0 === w.peek8( w.ptr.add(cpy,nPtr) ) );
let cStr2 = w.scopedAllocCString("HI!!!");
rc = w.cstrncpy(cpy, cStr2, 3);
T.assert(3===rc).
assert("HI!lo" === w.cstrToJs(cpy)).
assert(chr('!') === w.peek8(cpy+2)).
assert(chr('l') === w.peek8(cpy+3));
assert(chr('!') === w.peek8( w.ptr.add(cpy, 2) )).
assert(chr('l') === w.peek8( w.ptr.add(cpy, 3) ) );
}finally{
w.scopedAllocPop(scope);
}
@@ -657,8 +675,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const jstr = "hällo, world!";
const [cstr, n] = w.allocCString(jstr, true);
T.assert(14 === n)
.assert(0===w.peek8(cstr+n))
.assert(chr('!')===w.peek8(cstr+n-1));
.assert(0===w.peek8(w.ptr.add(cstr,n)))
.assert(chr('!')===w.peek8(w.ptr.add(cstr,n,-1)));
w.dealloc(cstr);
}
@@ -681,21 +699,21 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const p1 = w.scopedAlloc(16),
p2 = w.scopedAlloc(16);
T.assert(1===w.scopedAlloc.level)
.assert(Number.isFinite(p1))
.assert(Number.isFinite(p2))
.assert(looksLikePtr(p1))
.assert(looksLikePtr(p2))
.assert(asc[0] === p1)
.assert(asc[1]===p2);
asc2 = w.scopedAllocPush();
const p3 = w.scopedAlloc(16);
T.assert(2===w.scopedAlloc.level)
.assert(Number.isFinite(p3))
.assert(looksLikePtr(p3))
.assert(2===asc.length)
.assert(p3===asc2[0]);
const [z1, z2, z3] = w.scopedAllocPtr(3);
T.assert('number'===typeof z1).assert(z2>z1).assert(z3>z2)
.assert(0===w.peek32(z1), 'allocPtr() must zero the targets')
.assert(0===w.peek32(z3));
T.assert(typeof w.ptr.null===typeof z1).assert(z2>z1).assert(z3>z2)
.assert(w.ptr.null===w.peekPtr(z1), 'allocPtr() must zero the targets')
.assert(w.ptr.null===w.peekPtr(z3));
}finally{
// Pop them in "incorrect" order to make sure they behave:
w.scopedAllocPop(asc);
@@ -715,15 +733,15 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(1===w.scopedAlloc.level);
const [cstr, n] = w.scopedAllocCString("hello, world", true);
T.assert(12 === n)
.assert(0===w.peek8(cstr+n))
.assert(chr('d')===w.peek8(cstr+n-1));
.assert(0===w.peek8( w.ptr.add(cstr,n) ))
.assert(chr('d')===w.peek8( w.ptr.add(cstr, n, -1) ));
});
}/*scopedAlloc()*/
//log("xCall()...");
{
const pJson = w.xCall('sqlite3__wasm_enum_json');
T.assert(Number.isFinite(pJson)).assert(w.cstrlen(pJson)>300);
T.assert(looksLikePtr(pJson)).assert(w.cstrlen(pJson)>300);
}
//log("xWrap()...");
@@ -737,7 +755,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
let rc = fw();
T.assert('string'===typeof rc).assert(rc.length>5);
rc = w.xCallWrapped('sqlite3__wasm_enum_json','*');
T.assert(rc>0 && Number.isFinite(rc));
T.assert(rc>0 && looksLikePtr(rc));
rc = w.xCallWrapped('sqlite3__wasm_enum_json','utf8');
T.assert('string'===typeof rc).assert(rc.length>300);
@@ -753,8 +771,9 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
// 'string:flexible' argAdapter() sanity checks...
w.scopedAllocCall(()=>{
const argAd = w.xWrap.argAdapter('string:flexible');
const cj = (v)=>w.cstrToJs(argAd(v));
const toFlexStr = w.xWrap.argAdapter('string:flexible');
const cj = (v)=>w.cstrToJs(toFlexStr(v));
//console.debug("toFlexStr(new Uint8Array([72, 73]))",toFlexStr(new Uint8Array([72, 73])));
T.assert('Hi' === cj('Hi'))
.assert('hi' === cj(['h','i']))
.assert('HI' === cj(new Uint8Array([72, 73])));
@@ -836,8 +855,8 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(12n===rc);
w.scopedAllocCall(function(){
const pI1 = w.scopedAlloc(8), pI2 = pI1+4;
w.pokePtr([pI1, pI2], 0);
const pI1 = w.scopedAlloc(w.ptr.size), pI2 = w.ptr.add(pI1, w.ptr.size);
w.pokePtr([pI1, pI2], w.ptr.null);
const f = w.xWrap('sqlite3__wasm_test_int64_minmax',undefined,['i64*','i64*']);
const [r1, r2] = w.peek64([pI1, pI2]);
T.assert(!Number.isSafeInteger(r1)).assert(!Number.isSafeInteger(r2));
@@ -855,23 +874,36 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
test: function(sqlite3){
const S = sqlite3, W = S.wasm;
const MyStructDef = {
sizeof: 16,
members: {
p4: {offset: 0, sizeof: 4, signature: "i"},
pP: {offset: 4, sizeof: 4, signature: "P"},
ro: {offset: 8, sizeof: 4, signature: "i", readOnly: true},
cstr: {offset: 12, sizeof: 4, signature: "s"}
}
sizeof: 0, members: {}
};
const addMember = function(tgt, name, member){
member.offset = tgt.sizeof;
tgt.sizeof += member.sizeof;
tgt.members[name] = member;
};
const msd = MyStructDef;
addMember(msd, 'p4', {sizeof: 4, signature: "i"});
addMember(msd, 'pP', {sizeof: wasm.ptr.size, signature: "P"});
addMember(msd, 'ro', {
sizeof: 4,
signature: "i",
readOnly: true
});
addMember(msd, 'cstr', {
sizeof: wasm.ptr.size,
signature: "s"
});
if(W.bigIntEnabled){
const m = MyStructDef;
m.members.p8 = {offset: m.sizeof, sizeof: 8, signature: "j"};
m.sizeof += m.members.p8.sizeof;
addMember(msd, 'p8', {sizeof: 8, signature: "j"});
}
const StructType = S.StructBinder.StructType;
const K = S.StructBinder('my_struct',MyStructDef);
//K.debugFlags(0x03);
T.mustThrowMatching(()=>K(), /via 'new'/).
mustThrowMatching(()=>new K('hi'), /^Invalid pointer/);
mustThrowMatching(()=>new K('hi'), (err)=>{
return /^Invalid pointer/.test(err.message)/*32-bit*/
|| /.*bigint.*/i.test(err.message)/*64-bit*/;
});
const k1 = new K(), k2 = new K();
try {
T.assert(k1.constructor === K).
@@ -891,10 +923,10 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
"for "+key+" but got: "+k1[key]+
" from "+k1.memoryDump());
});
T.assert('number' === typeof k1.pointer).
T.assert(looksLikePtr(k1.pointer)).
mustThrowMatching(()=>k1.pointer = 1, /pointer/);
k1.$p4 = 1; k1.$pP = 2;
T.assert(1 === k1.$p4).assert(2 === k1.$pP);
T.assert(1 == k1.$p4).assert(2 == k1.$pP);
if(MyStructDef.members.$p8){
k1.$p8 = 1/*must not throw despite not being a BigInt*/;
k1.$p8 = BigInt(Number.MAX_SAFE_INTEGER * 2);
@@ -904,12 +936,12 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
k1.setMemberCString('cstr', "A C-string.");
T.assert(Array.isArray(k1.ondispose)).
assert(k1.ondispose[0] === k1.$cstr).
assert('number' === typeof k1.$cstr).
assert(looksLikePtr(k1.$cstr)).
assert('A C-string.' === k1.memberToJsString('cstr'));
k1.$pP = k2;
T.assert(k1.$pP === k2.pointer);
k1.$pP = null/*null is special-cased to 0.*/;
T.assert(0===k1.$pP);
T.assert(0==k1.$pP);
let ptr = k1.pointer;
k1.dispose();
T.assert(undefined === k1.pointer).
@@ -943,10 +975,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
assert(wts instanceof WTStruct).
assert(wts instanceof StructType).
assert(StructType.isA(wts)).
assert(wts.pointer>0).assert(0===wts.$v4).assert(0n===wts.$v8).
assert(0===wts.$ppV).assert(0===wts.$xFunc);
const testFunc =
W.xGet('sqlite3__wasm_test_struct'/*name gets mangled in -O3 builds!*/);
assert(looksLikePtr(wts.pointer)).assert(0==wts.$v4).assert(0n===wts.$v8).
assert(0==wts.$ppV).assert(0==wts.$xFunc);
const testFunc = 1
? W.xGet('sqlite3__wasm_test_struct'/*name gets mangled in -O3 builds!*/)
: W.xWrap('sqlite3__wasm_test_struct', undefined, '*');
let counter = 0;
//log("wts.pointer =",wts.pointer);
const wtsFunc = function(arg){
@@ -959,9 +992,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
wts.$v4 = 10; wts.$v8 = 20;
wts.$xFunc = W.installFunction(wtsFunc, wts.memberSignature('xFunc'))
//console.debug("wts.memberSignature('xFunc')",wts.memberSignature('xFunc'));
//console.debug("wts.$xFunc",wts.$xFunc, W.functionEntry(wts.$xFunc));
T.assert(0===counter).assert(10 === wts.$v4).assert(20n === wts.$v8)
.assert(0 === wts.$ppV).assert('number' === typeof wts.$xFunc)
.assert(0 === wts.$cstr)
.assert(0 == wts.$ppV).assert(looksLikePtr(wts.$xFunc))
.assert(0 == wts.$cstr)
.assert(wts.memberIsString('$cstr'))
.assert(!wts.memberIsString('$v4'))
.assert(null === wts.memberToJsString('$cstr'))
@@ -973,6 +1008,10 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
buffer, so merely reading them back is actually part of
testing the struct-wrapping API. */
if( 0 ){
console.debug("wts",wts,"wts.pointer",wts.pointer,
"testFunc",testFunc/*FF v142 emits the wrong function here!*/);
}
testFunc(wts.pointer);
//log("wts.pointer, wts.$ppV",wts.pointer, wts.$ppV);
T.assert(1===counter).assert(20 === wts.$v4).assert(40n === wts.$v8)
@@ -1026,7 +1065,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const P = wasm.pstack;
const isAllocErr = (e)=>e instanceof sqlite3.WasmAllocError;
const stack = P.pointer;
T.assert(0===stack % 8 /* must be 8-byte aligned */);
T.assert(0===Number(stack) % 8 /* must be 8-byte aligned */);
try{
const remaining = P.remaining;
T.assert(P.quota >= 4096)
@@ -1039,16 +1078,16 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
);
;
let p1 = P.alloc(12);
T.assert(p1 === stack - 16/*8-byte aligned*/)
T.assert(p1 == Number(stack) - 16/*8-byte aligned*/)
.assert(P.pointer === p1);
let p2 = P.alloc(7);
T.assert(p2 === p1-8/*8-byte aligned, stack grows downwards*/)
T.assert(p2 == Number(p1)-8/*8-byte aligned, stack grows downwards*/)
.mustThrowMatching(()=>P.alloc(remaining), isAllocErr)
.assert(24 === stack - p2)
.assert(24 == Number(stack) - Number(p2))
.assert(P.pointer === p2);
let n = remaining - (stack - p2);
let n = remaining - (Number(stack) - Number(p2));
let p3 = P.alloc(n);
T.assert(p3 === stack-remaining)
T.assert(p3 == Number(stack)-Number(remaining))
.mustThrowMatching(()=>P.alloc(1), isAllocErr);
}finally{
P.restore(stack);
@@ -1057,9 +1096,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(P.pointer === stack);
try {
const [p1, p2, p3] = P.allocChunks(3,'i32');
T.assert(P.pointer === stack-16/*always rounded to multiple of 8*/)
.assert(p2 === p1 + 4)
.assert(p3 === p2 + 4);
let sPos = wasm.ptr.add(stack,-16)/*pstack alloc always rounds to multiple of 8*/;
T.assert(P.pointer === sPos)
.assert(p1 === sPos)
.assert(p2 == Number(p1) + 4)
.assert(p3 == Number(p2) + 4);
T.mustThrowMatching(()=>P.allocChunks(1024, 1024 * 16),
(e)=>e instanceof sqlite3.WasmAllocError)
}finally{
@@ -1069,16 +1110,20 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(P.pointer === stack);
try {
let [p1, p2, p3] = P.allocPtr(3,false);
let sPos = stack-16/*always rounded to multiple of 8*/;
T.assert(P.pointer === sPos)
.assert(p2 === p1 + 4)
.assert(p3 === p2 + 4);
let sPos = wasm.ptr.add(stack,
-(4===wasm.ptr.size
? 16/*pstack alloc always rounds to multiple of 8*/
: 24));
T.assert(P.pointer === p1)
.assert(p1 === sPos)
.assert(p2 == Number(p1) + wasm.ptr.size)
.assert(p3 == Number(p2) + wasm.ptr.size);
[p1, p2, p3] = P.allocPtr(3);
T.assert(P.pointer === sPos-24/*3 x 8 bytes*/)
.assert(p2 === p1 + 8)
.assert(p3 === p2 + 8);
T.assert(P.pointer === wasm.ptr.add(sPos, -24)/*3 x 8 bytes*/)
.assert(p2 == Number(p1) + 8)
.assert(p3 == Number(p2) + 8);
p1 = P.allocPtr();
T.assert('number'===typeof p1);
T.assert(looksLikePtr(p1));
}finally{
P.restore(stack);
}
@@ -1092,19 +1137,19 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
try{
const n = 520;
const p = wasm.pstack.alloc(n);
T.assert(0===wasm.peek8(p))
.assert(0===wasm.peek8(p+n-1));
T.assert(0==wasm.peek8(p))
.assert(0==wasm.peek8(wasm.ptr.add(p,n,-1)));
T.assert(undefined === capi.sqlite3_randomness(n - 10, p));
let j, check = 0;
const heap = wasm.heap8u();
for(j = 0; j < 10 && 0===check; ++j){
check += heap[p + j];
check += heap[wasm.ptr.add(p, j)];
}
T.assert(check > 0);
check = 0;
// Ensure that the trailing bytes were not modified...
for(j = n - 10; j < n && 0===check; ++j){
check += heap[p + j];
check += heap[wasm.ptr.add(p, j)];
}
T.assert(0===check);
}finally{
@@ -1248,7 +1293,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const stack = wasm.pstack.pointer;
try {
const ppOut = wasm.pstack.allocPtr();
T.assert( 0===wasm.peekPtr(ppOut) );
T.assert( 0==wasm.peekPtr(ppOut) );
let rc = capi.sqlite3_open_v2( ":memory:", ppOut,
capi.SQLITE_OPEN_CREATE
| capi.SQLITE_OPEN_READWRITE,
@@ -1261,7 +1306,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
dw = sqlite3.oo1.DB.wrapHandle(pDb, true);
pDb = 0;
//sqlite3.config.debug("dw",dw);
T.assert( pTmp===dw.pointer, 'pDb===dw.pointer' );
T.assert( pTmp===dw.pointer, 'pTmp===dw.pointer' );
T.assert( dw.filename === "", "dw.filename == "+dw.filename );
let q = dw.prepare("select 1");
try {
@@ -1308,7 +1353,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
})/*oo1.DB/Stmt.wrapHandle()*/
////////////////////////////////////////////////////////////////////
.t('sqlite3_db_config() and sqlite3_db_status()', function(sqlite3){
.t('sqlite3_db_config() and sqlite3_status()', function(sqlite3){
let rc = capi.sqlite3_db_config(this.db, capi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, 0, 0);
T.assert(0===rc);
rc = capi.sqlite3_db_config(this.db, capi.SQLITE_DBCONFIG_MAX+1, 0);
@@ -1461,6 +1506,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
const db = this.db;
let list = [];
this.progressHandlerCount = 0;
//wasm.xWrap.debug = true;
let rc = db.exec({
sql:['CREATE TABLE t(a,b);',
// ^^^ using TEMP TABLE breaks the db export test
@@ -1812,7 +1858,17 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
name:'Scalar UDFs',
test: function(sqlite3){
const db = this.db;
db.createFunction("foo",(pCx,a,b)=>a+b);
db.createFunction(
"foo",
1 ? (pCx,a,b)=>a+b
: (pCx,a,b)=>{
/*return sqlite3.capi.sqlite3_result_error_js(
db, sqlite3.capi.SQLITE_ERROR, "foo???"
);*/
console.debug("foo UDF", pCx, a, b);
return Number(a)+Number(b);
}
);
T.assert(7===db.selectValue("select foo(3,4)")).
assert(5===db.selectValue("select foo(3,?)",2)).
assert(5===db.selectValue("select foo(?,?2)",[1,4])).
@@ -2152,7 +2208,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
.assert(wasm.isPtr(pVoid))
.assert(wasm.isPtr(aVals))
.assert(wasm.isPtr(aCols))
.assert(+wasm.cstrToJs(wasm.peekPtr(aVals + wasm.ptrSizeof))
.assert(+wasm.cstrToJs(wasm.peekPtr(wasm.ptr.add(aVals, wasm.ptr.size)))
=== 2 * +wasm.cstrToJs(wasm.peekPtr(aVals)));
return 0;
});
@@ -2259,7 +2315,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
in the call :/ */));
const pMin = w.scopedAlloc(16);
const pMax = pMin + 8;
const pMax = w.ptr.add(pMin, 8);
const g64 = (p)=>w.peek64(p);
w.poke64([pMin, pMax], 0);
const minMaxI64 = [
@@ -2299,7 +2355,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
////////////////////////////////////////////////////////////////////////
.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){
const VT = sqlite3.vtab;
const tmplCols = Object.assign(Object.create(null),{
@@ -2310,18 +2366,20 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
ext/misc/templatevtab.c.
*/
const tmplMod = new sqlite3.capi.sqlite3_module();
T.assert(0===tmplMod.$xUpdate);
T.assert(!tmplMod.$xUpdate);
const dbg = 1 ? ()=>{} : sqlite3.config.debug;
//tmplMod.debugFlags(0x03);
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)"
);
@@ -2340,6 +2398,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
},
xCreate: true /* just for testing. Will be removed afterwards. */,
xDisconnect: function(pVtab){
dbg("xDisconnect",...arguments);
try {
VT.xVtab.unget(pVtab).dispose();
return 0;
@@ -2348,6 +2407,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
xOpen: function(pVtab, ppCursor){
dbg("xOpen",...arguments);
try{
const t = VT.xVtab.get(pVtab),
c = VT.xCursor.create(ppCursor);
@@ -2360,6 +2420,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
xClose: function(pCursor){
dbg("xClose",...arguments);
try{
const c = VT.xCursor.unget(pCursor);
T.assert(c instanceof capi.sqlite3_vtab_cursor)
@@ -2371,6 +2432,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
xNext: function(pCursor){
dbg("xNext",...arguments);
try{
const c = VT.xCursor.get(pCursor);
++c._rowId;
@@ -2380,6 +2442,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
xColumn: function(pCursor, pCtx, iCol){
dbg("xColumn",...arguments);
try{
const c = VT.xCursor.get(pCursor);
switch(iCol){
@@ -2397,6 +2460,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
xRowid: function(pCursor, ppRowid64){
dbg("xRowid",...arguments);
try{
const c = VT.xCursor.get(pCursor);
VT.xRowid(ppRowid64, c._rowId);
@@ -2406,12 +2470,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
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;
@@ -2424,6 +2490,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
},
xBestIndex: function(pVtab, pIdxInfo){
dbg("xBestIndex",...arguments);
try{
//const t = VT.xVtab.get(pVtab);
const sii = capi.sqlite3_index_info;
@@ -2472,12 +2539,13 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
}
});
this.db.onclose.disposeAfter.push(tmplMod);
T.assert(0===tmplMod.$xUpdate)
.assert(tmplMod.$xCreate)
T.assert(!tmplMod.$xUpdate)
.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");
tmplMod.$xCreate = 0 /* make tmplMod eponymous-only */;
tmplMod.$xCreate = wasm.ptr.null /* make tmplMod eponymous-only */;
let rc = capi.sqlite3_create_module(
this.db, "testvtab", tmplMod, 0
);
@@ -2742,7 +2810,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
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();
@@ -2847,10 +2915,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
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.ptr.null === rc );
// Commit hook...
T.assert( 0!=capi.sqlite3_get_autocommit(db) );
@@ -2865,13 +2934,14 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
d.exec("create table t(a)");
});
T.assert(2 === countCommit);
T.assert(17 == capi.sqlite3_commit_hook(db, 0, 0));
// 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.ptr.null===rc );
T.mustThrowMatching(()=>{
db.transaction('drop table t',()=>{})
}, (e)=>{
@@ -2884,16 +2954,18 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
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);
T.assert(21 == capi.sqlite3_rollback_hook(db, 0, 0));
// Update hook...
const countUpdate = Object.create(null);
capi.sqlite3_update_hook(db, (p,op,dbName,tbl,rowid)=>{
T.assert('main' === dbName.toLowerCase())
.assert('t' === tbl.toLowerCase())
.assert(3===p)
.assert(33==p)
.assert('bigint' === typeof rowid);
switch(op){
case capi.SQLITE_INSERT:
@@ -2903,25 +2975,23 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
break;
default: toss("Unexpected hook operator:",op);
}
}, 3);
}, 33);
db.transaction((d)=>{
d.exec([
db.exec([
"insert into t(a) values(1);",
"update t set a=2;",
"update t set a=3;",
"delete from t where a=3"
"delete from t where a=3;"
// update hook is not called for an unqualified DELETE
]);
});
T.assert(1 === countRollback)
.assert(3 === countCommit)
.assert(2 === countCommit)
.assert(1 === countUpdate[capi.SQLITE_INSERT])
.assert(2 === countUpdate[capi.SQLITE_UPDATE])
.assert(1 === countUpdate[capi.SQLITE_DELETE]);
//wasm.xWrap.FuncPtrAdapter.debugFuncInstall = true;
T.assert(1 === capi.sqlite3_commit_hook(db, 0, 0));
T.assert(2 === capi.sqlite3_rollback_hook(db, 0, 0));
T.assert(3 === capi.sqlite3_update_hook(db, 0, 0));
T.assert(33 == capi.sqlite3_update_hook(db, 0, 0));
//wasm.xWrap.FuncPtrAdapter.debugFuncInstall = false;
db.close();
}
@@ -2934,7 +3004,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
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) );
@@ -3241,6 +3311,78 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
"entryExists(",testDir,") should have failed");
}
}/*OPFS util sanity checks*/)
//#if enable-see
.t({
name: 'OPFS with SEE encryption',
test: function(sqlite3){
const dbFile = 'file:///sqlite3-see.edb';
const dbCtor = sqlite3.oo1.OpfsDb;
const hexFoo = new Uint8Array([0x66,0x6f,0x6f]/*=="foo"*/);
let initDb = true;
const tryKey = function(keyKey, key, expectCount){
let db;
//console.debug('tryKey()',arguments);
const ctoropt = {
filename: dbFile,
flags: 'c'
};
try {
if (initDb) {
initDb = false;
const opt = {
...ctoropt,
[keyKey]: key
};
opt.filename += '?delete-before-open=1';
db = new dbCtor(opt);
db.exec([
"drop table if exists t;",
"create table t(a);"
]);
db.close();
// Ensure that it's actually encrypted...
let err;
try {
db = new dbCtor(ctoropt);
T.assert(db, 'db opened') /* opening is fine, but... */;
const rv = db.exec({
sql:"select count(*) from sqlite_schema",
returnValue: 'resultRows'
});
console.warn("(should not be reached) rv =",rv);
} catch (e) {
err = e;
} finally {
db.close()
}
T.assert(err, "Expecting an exception")
.assert(sqlite3.capi.SQLITE_NOTADB == err.resultCode,
"Expecting NOTADB");
}/*initDb*/
db = new dbCtor({
...ctoropt,
[keyKey]: key
});
db.exec("insert into t(a) values (1),(2)");
T.assert(expectCount === db.selectValue('select sum(a) from t'));
} finally {
if (db) db.close();
}
};
tryKey('textkey', 'foo', 3);
T.assert( !initDb );
tryKey('textkey', 'foo', 6);
initDb = true;
tryKey('key', 'foo', 3);
T.assert( !initDb );
tryKey('key', hexFoo, 6);
initDb = true;
tryKey('hexkey', hexFoo, 3);
T.assert( !initDb );
tryKey('hexkey', hexFoo, 6);
}
})/*OPFS with SEE*/
//#endif enable-see
;/* end OPFS tests */
////////////////////////////////////////////////////////////////////////
@@ -3279,6 +3421,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
T.assert(0 === u1.getFileCount());
const dbName = '/foo.db';
//wasm.xWrap.debug = true;
let db = new u1.OpfsSAHPoolDb(dbName);
T.assert(db instanceof sqlite3.oo1.DB)
.assert(1 === u1.getFileCount());
@@ -3320,13 +3463,13 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
db.close();
T.assert( u2===u2.pauseVfs() )
.assert( u2.isPaused() )
.assert( 0===capi.sqlite3_vfs_find(u2.vfsName) )
.assert( !capi.sqlite3_vfs_find(u2.vfsName) )
.mustThrowMatching(()=>new u2.OpfsSAHPoolDb(dbName),
/.+no such vfs: .+/,
"VFS is not available")
.assert( u2===await u2.unpauseVfs() )
.assert( u2===await u1.unpauseVfs(), "unpause is a no-op if the VFS is not paused" )
.assert( 0!==capi.sqlite3_vfs_find(u2.vfsName) );
.assert( !!capi.sqlite3_vfs_find(u2.vfsName) );
const fileNames = u1.getFileNames();
T.assert(1 === fileNames.length)
.assert(dbName === fileNames[0])
@@ -3421,7 +3564,94 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
.assert(true === await u3.removeVfs())
.assert(false === await P3b.removeVfs());
}
}/*OPFS SAH Pool sanity checks*/);
}/*OPFS SAH Pool sanity checks*/)
//#if enable-see
.t({
name: 'OPFS SAHPool with SEE encryption',
test: async function(sqlite3){
const inst = sqlite3.installOpfsSAHPoolVfs,
catcher = (e)=>{
error("Cannot load SAH pool VFS.",
"This might not be a problem,",
"depending on the environment.");
return false;
};
const poolConfig = {
name: 'opfs-sahpool-see',
clearOnInit: true,
initialCapacity: 6
}
let poolUtil;
const P1 = await inst(poolConfig).then(u=>poolUtil = u).catch(catcher);
const dbFile = '/sqlite3-see.edb';
const dbCtor = poolUtil.OpfsSAHPoolDb;
const hexFoo = new Uint8Array([0x66,0x6f,0x6f]/*=="foo"*/);
let initDb = true;
const tryKey = function(keyKey, key, expectCount){
let db;
//console.debug('tryKey()',arguments);
const ctoropt = {
filename: dbFile,
flags: 'c'
};
try {
if (initDb) {
initDb = false;
poolUtil.unlink(dbFile);
db = new dbCtor({
...ctoropt,
[keyKey]: key
});
db.exec([
"drop table if exists t;",
"create table t(a);"
]);
db.close();
// Ensure that it's actually encrypted...
let err;
try {
db = new dbCtor(ctoropt);
T.assert(db, 'db opened') /* opening is fine, but... */;
const rv = db.exec({
sql:"select count(*) from sqlite_schema",
returnValue: 'resultRows'
});
console.warn("(should not be reached) rv =",rv);
} catch (e) {
err = e;
} finally {
db.close()
}
T.assert(err, "Expecting an exception")
.assert(sqlite3.capi.SQLITE_NOTADB == err.resultCode,
"Expecting NOTADB");
}/*initDb*/
db = new dbCtor({
...ctoropt,
[keyKey]: key
});
db.exec("insert into t(a) values (1),(2)");
T.assert(expectCount === db.selectValue('select sum(a) from t'));
} finally {
if (db) db.close();
}
};
tryKey('textkey', 'foo', 3);
T.assert( !initDb );
tryKey('textkey', 'foo', 6);
initDb = true;
tryKey('key', 'foo', 3);
T.assert( !initDb );
tryKey('key', hexFoo, 6);
initDb = true;
tryKey('hexkey', hexFoo, 3);
T.assert( !initDb );
tryKey('hexkey', hexFoo, 6);
poolUtil.removeVfs();
}
})/*opfs-sahpool with SEE*/
//#endif enable-see
;
////////////////////////////////////////////////////////////////////////
T.g('Misc. APIs')
@@ -3567,9 +3797,12 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
name: 'Delete via bound parameter in subquery',
predicate: ()=>wasm.compileOptionUsed('ENABLE_FTS5') || "Missing FTS5",
test: function(sqlite3){
// Testing https://sqlite.org/forum/forumpost/40ce55bdf5
// with the exception that that post uses "external content"
// for the FTS index.
/**
Testing https://sqlite.org/forum/forumpost/40ce55bdf5 with
the exception that that post uses "external content" for
the FTS index. This isn't testing a fix, just confirming
that the bug report is not really a bug.
*/
const db = new sqlite3.oo1.DB();//(':memory:','wt');
db.exec([
"create virtual table f using fts5 (path);",
@@ -3586,10 +3819,10 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
//dump('Full fts table');
let rc = fetchEm();
T.assert(3===rc.length);
db.exec(`
delete from f where rowid in (
select rowid from f where path = :path
)`,
db.exec(
["delete from f where rowid in (",
"select rowid from f where path = :path",
")"],
{bind: {":path": "def"}}
);
//dump('After deleting one entry via subquery');
@@ -3726,7 +3959,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
error: ()=>{}
}
}
//#ifnot target=es6-module
//#if not target:es6-module
if(!globalThis.sqlite3InitModule && !isUIThread()){
/* Vanilla worker, as opposed to an ES6 module worker */
/*
@@ -3743,7 +3976,11 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
are simply lost, and such scripts see the globalThis.location of
_this_ script.
*/
let sqlite3Js = 'sqlite3.js';
let sqlite3Js = '@sqlite3.js@'
.split('/').pop()/*the build-injected name has a dir part and
we specifically want to test the following
support for locating the wasm, so remove
that dir part. */;
const urlParams = new URL(globalThis.location.href).searchParams;
if(urlParams.has('sqlite3.dir')){
sqlite3Js = urlParams.get('sqlite3.dir') + '/' + sqlite3Js;
@@ -3782,6 +4019,9 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
logClass('warning',"sqlite3__wasm_test_...() APIs unavailable.");
}
log("registered vfs list =",capi.sqlite3_js_vfs_list().join(', '));
SQLite3 = sqlite3;
log("WASM pointer size:",wasm.ptr.size,"bytes.");
TestUtil.checkHeapSize();
TestUtil.runTests(sqlite3);
});
})(self);
-107
View File
@@ -1,107 +0,0 @@
#!/usr/bin/make
#^^^^ help emacs select makefile mode
#
# This is a sub-make for building a standalone wasmfs-based
# sqlite3.wasm. It is intended to be "include"d from the main
# GNUMakefile.
########################################################################
MAKEFILE.wasmfs = $(lastword $(MAKEFILE_LIST))
# ensure that the following message starts on line 10 or higher for proper
# $(warning) alignment!
ifneq (1,$(MAKING_CLEAN))
$(warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
$(warning !! The WASMFS build is unsupported. Use at your own risk.
$(warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
endif
sqlite3-wasmfs.js = $(dir.wasmfs)/sqlite3-wasmfs.js
sqlite3-wasmfs.wasm = $(dir.wasmfs)/sqlite3-wasmfs.wasm
########################################################################
# emcc flags for .c/.o.
cflags.sqlite3-wasmfs =
cflags.sqlite3-wasmfs += -std=c99 -fPIC
cflags.sqlite3-wasmfs += -pthread
cflags.sqlite3-wasmfs += -DSQLITE_ENABLE_WASMFS
########################################################################
# emcc flags specific to building the final .js/.wasm file...
emcc.flags.sqlite3-wasmfs =
emcc.flags.sqlite3-wasmfs += \
-sEXPORTED_RUNTIME_METHODS=wasmMemory
# wasmMemory ==> for -sIMPORTED_MEMORY
# Some version of emcc between 3.1.60-ish(?) and 3.1.62 deprecated the
# use of (allocateUTF8OnStack,stringToUTF8OnStack). Earlier emcc
# versions will fail to build without those in the
# EXPORTED_RUNTIME_METHODS list.
emcc.flags.sqlite3-wasmfs += -sUSE_CLOSURE_COMPILER=0
emcc.flags.sqlite3-wasmfs += -Wno-limited-postlink-optimizations
# ^^^^^ emcc likes to warn when we have "limited optimizations" via the -g3 flag.
emcc.flags.sqlite3-wasmfs += -sMEMORY64=0
emcc.flags.sqlite3-wasmfs += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
# ^^^^ 64MB is not enough for WASMFS/OPFS test runs using batch-runner.js
sqlite3-wasmfs.fsflags = -pthread -sWASMFS \
-sPTHREAD_POOL_SIZE=1 \
-sERROR_ON_UNDEFINED_SYMBOLS=0 -sLLD_REPORT_UNDEFINED
# ^^^^^ why undefined symbols are necessary for the wasmfs build is anyone's guess.
emcc.flags.sqlite3-wasmfs += $(sqlite3-wasmfs.fsflags)
emcc.flags.sqlite3-wasmfs += -sALLOW_MEMORY_GROWTH=0
#^^^ using ALLOW_MEMORY_GROWTH produces a warning from emcc:
# USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly,
# see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]
# And, indeed, it runs slowly if memory is permitted to grow.
#emcc.flags.sqlite3-wasmfs.vanilla =
#emcc.flags.sqlite3-wasmfs.esm = -sEXPORT_ES6 -sUSE_ES6_IMPORT_META
$(sqlite3-wasmfs.js) $(dir.wasmfs)/sqlite3-wasmfs.mjs: $(MAKEFILE.wasmfs)
########################################################################
# Build quirk: we cannot build BOTH .js and .mjs with our current
# build infrastructure because the supplemental *.worker.js files get
# generated with the name of the main module file
# ($(sqlite3-wasmfs.{js,mjs})) hard-coded in them. Thus the last one
# to get built gets the *.worker.js files mapped to it. In order to
# build both modes they would need to have distinct base names or
# output directories. "The problem" with giving them distinct base
# names is that it means that the corresponding .wasm file is also
# built/saved multiple times. It is likely that anyone wanting to use
# WASMFS will want an ES6 module, so that's what we build here.
wasmfs.build.ext = mjs
$(sqlite3-wasmfs.js) $(dir.wasmfs)/sqlite3-wasmfs.mjs: $(SOAP.js.bld)
ifeq (js,$(wasmfs.build.ext))
$(sqlite3-wasmfs.wasm): $(sqlite3-wasmfs.js)
wasmfs: $(sqlite3-wasmfs.js)
else
$(sqlite3-wasmfs.wasm): $(dir.wasmfs)/sqlite3-wasmfs.mjs
wasmfs: $(dir.wasmfs)/sqlite3-wasmfs.mjs
endif
all: wasmfs
########################################################################
# speedtest1 for wasmfs.
speedtest1-wasmfs.mjs = $(dir.wasmfs)/speedtest1-wasmfs.mjs
speedtest1-wasmfs.wasm = $(subst .mjs,.wasm,$(speedtest1-wasmfs.mjs))
emcc.flags.speedtest1-wasmfs = $(sqlite3-wasmfs.fsflags)
emcc.flags.speedtest1-wasmfs += $(SQLITE_OPT)
emcc.flags.speedtest1-wasmfs += -sALLOW_MEMORY_GROWTH=0
emcc.flags.speedtest1-wasmfs += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
#$(info speedtest DEPS=pre-post-sqlite3-wasmfs-esm.deps=$(pre-post-sqlite3-wasmfs-esm.deps))
$(speedtest1-wasmfs.mjs): $(speedtest1.cfiles) $(sqlite3-wasmfs.js) \
$(MAKEFILE) $(MAKEFILE.wasmfs) $(pre-post-sqlite3-wasmfs-esm.deps) \
$(EXPORTED_FUNCTIONS.speedtest1)
@echo "Building $@ ..."
$(bin.emcc) \
$(pre-post-sqlite3-wasmfs-esm.flags) \
$(cflags.common) \
$(cflags.sqlite3-wasmfs) \
$(emcc.speedtest1.common) \
$(emcc.flags.speedtest1-vanilla) \
$(emcc.flags.sqlite3-wasmfs) \
$(emcc.flags.speedtest1-wasmfs) \
-o $@ $(speedtest1.cfiles) -lm
@$(call SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT,1,1)
$(maybe-wasm-strip) $(speedtest1-wasmfs.wasm)
chmod -x $(speedtest1-wasmfs.wasm)
ls -la $@ $(speedtest1-wasmfs.wasm)
wasmfs: $(speedtest1-wasmfs.mjs)
# end speedtest1.js
########################################################################
+12 -6
View File
@@ -535,7 +535,7 @@ clean: clean-sanity-check
#
LIBOBJS0 = alter.o analyze.o attach.o auth.o \
backup.o bitvec.o btmutex.o btree.o build.o \
callback.o complete.o ctime.o \
callback.o carray.o complete.o ctime.o \
date.o dbpage.o dbstat.o delete.o \
expr.o fault.o fkey.o \
fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o \
@@ -588,6 +588,7 @@ SRC = \
$(TOP)/src/btreeInt.h \
$(TOP)/src/build.c \
$(TOP)/src/callback.c \
$(TOP)/src/carray.c \
$(TOP)/src/complete.c \
ctime.c \
$(TOP)/src/date.c \
@@ -793,7 +794,6 @@ TESTSRC += \
$(TOP)/ext/misc/amatch.c \
$(TOP)/ext/misc/appendvfs.c \
$(TOP)/ext/misc/basexx.c \
$(TOP)/ext/misc/carray.c \
$(TOP)/ext/misc/cksumvfs.c \
$(TOP)/ext/misc/closure.c \
$(TOP)/ext/misc/csv.c \
@@ -809,7 +809,6 @@ TESTSRC += \
$(TOP)/ext/misc/mmapwarm.c \
$(TOP)/ext/misc/nextchar.c \
$(TOP)/ext/misc/normalize.c \
$(TOP)/ext/misc/percentile.c \
$(TOP)/ext/misc/prefixes.c \
$(TOP)/ext/misc/qpvtab.c \
$(TOP)/ext/misc/randomjson.c \
@@ -832,6 +831,7 @@ TESTSRC2 = \
$(TOP)/src/bitvec.c \
$(TOP)/src/btree.c \
$(TOP)/src/build.c \
$(TOP)/src/carray.c \
ctime.c \
$(TOP)/src/date.c \
$(TOP)/src/dbpage.c \
@@ -969,6 +969,7 @@ SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
SHELL_OPT += -DSQLITE_ENABLE_PERCENTILE
SHELL_OPT += -DSQLITE_STRICT_SUBTYPE=1
FUZZERSHELL_OPT =
FUZZCHECK_OPT += -I$(TOP)/test
@@ -976,6 +977,7 @@ FUZZCHECK_OPT += -I$(TOP)/ext/recover
FUZZCHECK_OPT += \
-DSQLITE_OSS_FUZZ \
-DSQLITE_ENABLE_BYTECODE_VTAB \
-DSQLITE_ENABLE_CARRAY \
-DSQLITE_ENABLE_DBPAGE_VTAB \
-DSQLITE_ENABLE_DBSTAT_VTAB \
-DSQLITE_ENABLE_DESERIALIZE \
@@ -988,6 +990,7 @@ FUZZCHECK_OPT += \
-DSQLITE_ENABLE_MEMSYS5 \
-DSQLITE_ENABLE_NORMALIZE \
-DSQLITE_ENABLE_OFFSET_SQL_FUNC \
-DSQLITE_ENABLE_PERCENTILE \
-DSQLITE_ENABLE_PREUPDATE_HOOK \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_SESSION \
@@ -1010,7 +1013,6 @@ FUZZCHECK_SRC += $(TOP)/test/fuzzinvariants.c
FUZZCHECK_SRC += $(TOP)/ext/recover/dbdata.c
FUZZCHECK_SRC += $(TOP)/ext/recover/sqlite3recover.c
FUZZCHECK_SRC += $(TOP)/test/vt02.c
FUZZCHECK_SRC += $(TOP)/ext/misc/percentile.c
FUZZCHECK_SRC += $(TOP)/ext/misc/randomjson.c
DBFUZZ_OPT =
ST_OPT = -DSQLITE_OS_KV_OPTIONAL
@@ -1207,6 +1209,9 @@ build.o: $(TOP)/src/build.c $(DEPS_OBJ_COMMON)
callback.o: $(TOP)/src/callback.c $(DEPS_OBJ_COMMON)
$(T.cc.sqlite) -c $(TOP)/src/callback.c
carray.o: $(TOP)/src/carray.c $(DEPS_OBJ_COMMON)
$(T.cc.sqlite) -c $(TOP)/src/carray.c
complete.o: $(TOP)/src/complete.c $(DEPS_OBJ_COMMON)
$(T.cc.sqlite) -c $(TOP)/src/complete.c
@@ -1788,6 +1793,8 @@ TESTFIXTURE_FLAGS += -DSQLITE_DEFAULT_PAGE_SIZE=1024
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_STMTVTAB
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DBPAGE_VTAB
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_BYTECODE_VTAB
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_CARRAY
TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_PERCENTILE
TESTFIXTURE_FLAGS += -DSQLITE_CKSUMVFS_STATIC
TESTFIXTURE_FLAGS += -DSQLITE_STATIC_RANDOMJSON
TESTFIXTURE_FLAGS += -DSQLITE_STRICT_SUBTYPE=1
@@ -1800,7 +1807,7 @@ TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
testfixture$(T.exe): $(T.tcl.env.sh) has_tclsh85 $(TESTFIXTURE_SRC)
$(T.link.tcl) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
-o $@ $(TESTFIXTURE_SRC) \
$$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $$TCL_LIBS \
$$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC \
$(LDFLAGS.libsqlite3)
coretestprogs: testfixture$(B.exe) sqlite3$(B.exe)
@@ -2358,7 +2365,6 @@ SHELL_DEP = \
$(TOP)/ext/misc/ieee754.c \
$(TOP)/ext/misc/memtrace.c \
$(TOP)/ext/misc/pcachetrace.c \
$(TOP)/ext/misc/percentile.c \
$(TOP)/ext/misc/regexp.c \
$(TOP)/ext/misc/series.c \
$(TOP)/ext/misc/sha1.c \
+186 -188
View File
@@ -1,14 +1,14 @@
C Merge\slatest\strunk\swith\sthis\sbranch.
D 2025-09-15T16:09:54.717
C Version\s3.51.2
D 2026-01-09T17:27:48.405
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
F LICENSE.md 6bc480fc673fb4acbc4094e77edb326267dd460162d7723c7f30bee2d3d9e97d
F Makefile.in 3ce07126d7e87c7464301482e161fdae6a51d0a2aa06b200b8f0000ef4d6163b
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
F Makefile.msc b87ac9041d87f61fabd6074e6d8b71dd7f78c884a2307bbb9301f9d436ce9242
F README.md e28077cfbef795e99c9c75ed95aa7257a1166709b562076441a8506ac421b7c1
F VERSION 16eddb43056a79c1977427ab7a05f3457c373fa159dcdced8754eb89ce7e06b8
F Makefile.msc d4459fad28b388063698cbb7a73bfce8684da998a844a04b21d4b9b10291196a
F README.md dae499194b75deed76a13a4a83c82493f2530331882d7dfe5754d63287d3f8f7
F VERSION 53fb08d314af314f884da9b33cabad229928aac28b53984a2c38fd4d7dc608ab
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d87031
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -17,12 +17,12 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531
F auto.def 44a0d1bf09d78355fc88251ccbf8e64e6341fd89c11de68a01c3645e53a2bade
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
F autoconf/Makefile.in 306f500fce8cae9e1af9459f1ac7fe89ce46999594ef3fdc62dc9d7d651fb091
F autoconf/Makefile.msc f15ad424ca2820df8e39d9157965710af0a64d87773706706a12ea4f96e3a0d8
F autoconf/Makefile.in 118aa2c4d49173672d065fdda19eb8a28642e2c684212d7a626d6db5e6762521
F autoconf/Makefile.msc 9c1ca648062fd5a4a83ba7590c4422090cccd6399002af0346b7572f086c7483
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807
F autoconf/auto.def 3d994f3a9cc9b712dbce92a5708570ddcf3b988141b6eb738f2ed16127a9f0ac
F autoconf/tea/Makefile.in bf6b43eafcd18766d81a8f0085cfc9cb051d8abae9031a8e7c3f5f1246e8f166
F autoconf/tea/Makefile.in 00e60cf3bf5580f31bfdcf3c914e9ba1831d676948363962de92ce65e5be4431
F autoconf/tea/README.txt 23475876343498ef2b514cc7510e8f1559a17e8e03fbc7a41c1c8a3b89e7b7e3
F autoconf/tea/_teaish.tester.tcl.in 8253b44be88e2e3f21de95a65d3a90c2be8e70b7bdd08a5b80e337ba7402f8f1
F autoconf/tea/auto.def ce95b9450e2fa4ba5dc857e208fe10f4e6f2d737796ac3278aee6079db417529
@@ -46,20 +46,20 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e
F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl ec30c4bc301b6e9eb937655744a7315f863f804fc66400d975bcf9352ac96a1d
F autosetup/sqlite-config.tcl b274cecb070f7e1b85c87b2e00afb0a3f3a28f373d8cd67d34ba40fa81482be7
F autosetup/proj.tcl 6fc14ef82b19b77a95788ffbcfad7989b4e3cb4ce96a21dcb5cf7312f362fba9
F autosetup/sqlite-config.tcl 5d779fce20c11fde3fe99d157dcd5b5569d729b301141b8dfb8d5aacf9d48cba
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
F autosetup/teaish/core.tcl aee092fc71986d1272b835ea7492bb55ffc213a289502e4f14da80cf67b7e3c3
F autosetup/teaish/core.tcl e014dd95900c7f9a34e8e0f460f47e94841059827bce8b4c49668b0c7ae3f1a0
F autosetup/teaish/feature.tcl 18194fb79a24d30e5bbdeab40999616f39278b53a27525349ded033af2fd73be
F autosetup/teaish/tester.tcl 1799514c2652db49561b3386c5242b94534d1663f2cfac861a955e071895fdd0
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
F doc/compile-for-unix.md c9dce1ddd4bf0d25efccc5c63eb047e78c01ce06a6ff29c73e0a8af4a0f4adbc
F doc/compile-for-windows.md 5141661e783c9ca9e3fd30e813345898712f5c311d71316f183db87038fa28a6
F doc/compile-for-windows.md f9e74d74da88f384edd5809f825035e071608f00f7f39c0e448df7b3982f979c
F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f
F doc/jsonb.md ede3238186e3a90bb79d20b2a6a06d0f9429a38e069e9da0efbad0f2ed48b924
F doc/jsonb.md acd77fc3a709f51242655ad7803510c886aa8304202fa9cf2abc5f5c4e9d7ae5
F doc/lemon.html 89ea833a6f71773ab1a9063fbb7fb9b32147bc0b1057b53ecab94a3b30c0aef5
F doc/pager-invariants.txt 83aa3a4724b2d7970cc3f3461f0295c46d4fc19a835a5781cbb35cb52feb0577
F doc/tcl-extension-testing.md b88861804fc1eaf83249f8e206334189b61e150c360e1b80d0dcf91af82354f5
@@ -72,7 +72,7 @@ F ext/README.md 6eb1ac267d917767952ed0ef63f55de003b6a5da433ce1fa389e1a9532e73132
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
F ext/expert/expert1.test 1d2da6606623b57bb47064e02140823ce1daecd4cacbf402c73ad3473d7f000c
F ext/expert/sqlite3expert.c cf4b1e5584862f486a4c6014ddb081831f1c512065dcf35644638d57179979d6
F ext/expert/sqlite3expert.c 546010043fbec93544f762de5161b3d553165859e6bd853c4b85c05f93484260
F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b
F ext/expert/test_expert.c c395134bd6d4efa594a7d26578a1cb624c4027b79b4b5fcd44736c5ef1f5f725
F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee
@@ -88,7 +88,7 @@ F ext/fts3/fts3_hash.c d9dba473741445789330c7513d4f65737c92df23c3212784312931641
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116
F ext/fts3/fts3_porter.c 024417020c57dd1ab39816f5fe6cf45222a857b78a1f6412f040ada1ceabd4ff
F ext/fts3/fts3_snippet.c 627d564878f82479ee3e040c89fb15aebf691d81e11c8e451241033c02b9810d
F ext/fts3/fts3_snippet.c abe3b2998e7cb6d1ab6019f87f021758a0df3ee4010fe144a174a524cff96fe6
F ext/fts3/fts3_term.c 6a96027ad364001432545fe43322b6af04ed28bb5619ec51af1f59d0710d6d69
F ext/fts3/fts3_test.c cc329471e573f95a6ea9fbca87e89dcfa1d355591c80172ffcd759ac521d25d8
F ext/fts3/fts3_tokenize_vtab.c 66eba6c2baa04b2b15e80d68341b8fd0b4d3831f6b2edb33916a2906ff2d4389
@@ -107,14 +107,14 @@ F ext/fts3/unicode/mkunicode.tcl cbf5f7b5c8ce8014bad731f246f2e520eece908465de477
F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a03cf1e6f52a6959fc77eb
F ext/fts5/extract_api_docs.tcl 009cf59c77afa86d137b0cca3e3b1a5efbe2264faa2df233f9a7aa8563926d15
F ext/fts5/fts5.h ff5d3cc88b29e41612bfb29eb723e29e38973de62ca75ba3e8f94ccb67f5b5f2
F ext/fts5/fts5Int.h 4bba2aeadbbd7378675b1fd2967c377fba3147c9a836350c437844b590068927
F ext/fts5/fts5Int.h 8d98f8e180fe28d6067e240ed45b9011735d29d5cfb5bac194e1e376baa7c708
F ext/fts5/fts5_aux.c da4a7a9a11ec15c6df0699d908915a209bcde48f0b04101461316b59f71abffb
F ext/fts5/fts5_buffer.c f1e6d0324d7c55329d340673befc26681a372a4d36086caa8d1ec7d7c53066c7
F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773c3384f7f8
F ext/fts5/fts5_expr.c b8c32da1127bafaf10d6b4768b0dcb92285798524bed2d87a8686f99a8e8d259
F ext/fts5/fts5_hash.c a6266cedd801ab7964fa9e74ebcdda6d30ec6a96107fa24148ec6b7b5b80f6e0
F ext/fts5/fts5_index.c 2a1be0fb3c1b185f84b08b8032ba332c82defa182ff125833c0fecba0a4938b0
F ext/fts5/fts5_main.c a6f8bea608b5f5ffc06bd1407e188bb2284437e7dd0e96b492ff7f3df2c32347
F ext/fts5/fts5_index.c 4e94cec64da9a61f8763f033fee310d3ce22805e1452fd4190e3f972ec60dfb0
F ext/fts5/fts5_main.c 42025174a556257287071e90516d3ab8115daf1dd525a301883544469a260014
F ext/fts5/fts5_storage.c 19bc7c4cbe1e6a2dd9849ef7d84b5ca1fcbf194cefc3e386b901e00e08bf05c2
F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329
F ext/fts5/fts5_test_mi.c 4308d5658cb1f5eee5998dcbaac7d5bdf7a2ef43c8192ca6e0c843f856ccee26
@@ -122,12 +122,12 @@ F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a
F ext/fts5/fts5_tokenize.c 49aea8cc400a690a6c4f83c4cedc67f4f8830c6789c4ee343404f62bcaebca7b
F ext/fts5/fts5_unicode2.c 536a6dae41d16edadd6a6b58c56e2ebbb133f0dfe757562a2edbcdc9b8362e50
F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80
F ext/fts5/fts5_vocab.c ff0441c4ea165081e8152dec6d29056faa0cdc281a9f218a00e3d7aacc1958bc
F ext/fts5/fts5_vocab.c 23e263ad94ac357cfffd19bd7e001c3f15c4420fb10fa35b5993142127e780e6
F ext/fts5/fts5parse.y eb526940f892ade5693f22ffd6c4f2702543a9059942772526eac1fde256bb05
F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba
F ext/fts5/test/fts5_common.tcl c5aa7cf7148b6dcffb5b61520ae18212baf169936af734ab265143f59db328fe
F ext/fts5/test/fts5aa.test cf4ff6180873bbc131666ba846ddd90148fcb61c20aad089711d3511cce24300
F ext/fts5/test/fts5ab.test 4bdb619fee409e11417e8827e320b857e42e926a01a0408fc9f143ec870a6ced
F ext/fts5/test/fts5ab.test c7e5c1519afb20366cb40d0179897a3c39d9fc06ba6b9c286d79df0ccd97e2ee
F ext/fts5/test/fts5ac.test 4a73626de86f3d17c95738034880c4f0de8d54741fb943d819b528373657e59b
F ext/fts5/test/fts5ad.test 058e616612964e61d19f70295f0e6eaedceb4b29b1fbf4f859615ef7e779dc22
F ext/fts5/test/fts5ae.test 3d49edbd50bb0684199a2e7568aeb30d1d29718f5c0f61751983740fa836d15f
@@ -162,12 +162,13 @@ F ext/fts5/test/fts5contentless4.test ec34dc69ef474ca9997dae6d91e072906e0e9a5a4b
F ext/fts5/test/fts5contentless5.test 38cd0392c730dc7090c550321ce3c24ba4c392bc97308b51a4180e9959dca7b5
F ext/fts5/test/fts5corrupt.test 237fce1c3261bb3a5bec333b0f0dbf5b105ec32627ef14cccbda3cfe13833193
F ext/fts5/test/fts5corrupt2.test 4a03a158c2cb617c9f76d26b35c1ef2534124bc0bbddcea38dfd5b170ebea27b
F ext/fts5/test/fts5corrupt3.test 43d6a836892d79ab738ab89b3b6f4ae46c07ee966193e4b357bbb14e7f81d5da
F ext/fts5/test/fts5corrupt3.test e489b51b6c4ded2a808e0f78bdbe126f6d369de41a59ac2717878e37fc3db0e8
F ext/fts5/test/fts5corrupt4.test dc08d19f5b8943e95a7778a7d8da592042504faf18dd93f68f7d7a0d7d7dd733
F ext/fts5/test/fts5corrupt5.test 73985d4fe6d8f0d5d5c7bcf79ae7c6522c376cd6ad710a0ff2f26e0c2e222abe
F ext/fts5/test/fts5corrupt6.test 2d72db743db7b5d9c9a6d0cfef24d799ed1aa5e8192b66c40e871a37ed9eed06
F ext/fts5/test/fts5corrupt7.test 814aab492d7a09abb5bfdd81cc66fc206d7f3868f9a3bae91876e02efc466fb3
F ext/fts5/test/fts5corrupt8.test 0b10750caf8aa23fa1c379ca4caf6130d41454505e4d5315590f4061eedcbe44
F ext/fts5/test/fts5corruptbig.test 9f95b40fa36e292feceab02b2ef06e21878bfa1ac7afefa138aae05518b51774
F ext/fts5/test/fts5delete.test 2a5008f8b1174ef41d1974e606928c20e4f9da77d9f8347aed818994d89cced4
F ext/fts5/test/fts5detail.test 54015e9c43ec4ba542cfb93268abdf280e0300f350efd08ee411284b03595cc4
F ext/fts5/test/fts5determin.test 1b77879b2ae818b5b71c859e534ee334dac088b7cf3ff3bf76a2c82b1c788d11
@@ -206,7 +207,7 @@ F ext/fts5/test/fts5leftjoin.test 1c14b51f4d1344a89e488160882f05a2246dd7e70c5cf0
F ext/fts5/test/fts5limits.test 8ab67cf5d311c124b6ceb0062d0297767176df4572d955fce79fa43004dff01c
F ext/fts5/test/fts5locale.test 83ba7ee12628b540d3098f39c39c1de0c0440eddff8f7512c8c698d0c4a3ae3c
F ext/fts5/test/fts5matchinfo.test bc9e74157773db7f00aec1e85587f1145956ebdf1672c136f0f04323b2752aa0
F ext/fts5/test/fts5merge.test 2654df0bcdb2d117c2d38b6aeb0168061be01c643f9e9194b36c43a2970e8082
F ext/fts5/test/fts5merge.test 088133e135ef7dcd6701753c95b8b10be3c52fa1a99507933e00756d6437489e
F ext/fts5/test/fts5merge2.test 3ebad1a59d6ad3fb66eff6523a09e95dc6367cbefb3cd73196801dea0425c8e2
F ext/fts5/test/fts5misc.test 83d6c5101a092c5db8fb631cfdd69a6482e20528b2750427641ac9050d9d0381
F ext/fts5/test/fts5multi.test a15bc91cdb717492e6e1b66fec1c356cb57386b980c7ba5af1915f97fe878581
@@ -268,7 +269,7 @@ F ext/fts5/test/fts5update.test b8affd796e45c94a4d19ad5c26606ea06065a0f162a9562d
F ext/fts5/test/fts5update2.test c5baa76799ac605ebb8e5e21035db2014b396cef25c903eb96ba39b1d6f9f046
F ext/fts5/test/fts5version.test 44ab35566267b7618c090443de2d9ad84f633df5d20bf72e9bad199ae5fced84
F ext/fts5/test/fts5vocab.test 2a2bdb60d0998fa3124d541b6d30b019504918dc43a6584645b63a24be72f992
F ext/fts5/test/fts5vocab2.test bbba149c254375d00055930c1a501c9a51e80b0d20bf7b98f3e9fa3b03786373
F ext/fts5/test/fts5vocab2.test 4265137a3747b27deb1e2e2bde5654120c6de72bfed3238e67806d85af60fc4c
F ext/fts5/tool/fts5speed.tcl b0056f91a55b2d1a3684ec05729de92b042e2f85
F ext/fts5/tool/fts5txt2db.tcl c0d43c8590656f8240e622b00957b3a0facc49482411a9fdc2870b45c0c82f9f
F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093
@@ -277,13 +278,13 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
F ext/icu/README.txt 1f8d76e10d2385fc77914a14ccd99acfbaf68111dfcf26a360ad9063787f57fb
F ext/icu/icu.c 9837f4611915baad1edbe38222f3ee7d1b5e118ab16fec9ba603720f72c78b2a
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
F ext/intck/intck1.test f3a3cba14b6aeff145ffa5515546dd22f7510dad91512e519f43b92b56514012
F ext/intck/intck2.test d2457c7e5e5b688046d15ebe08a1e1427cc5e7a6dc8d6af215f42e8bcaf67304
F ext/intck/intck1.test 53d885075abeb45aeb1eeffeaa8560b329060835ade4af5c44cf5fcb581c1e63
F ext/intck/intck2.test a29343a8e65c5c3400e10747f394924f3df95a5b2de94f46e9b5c9b97f5e7339
F ext/intck/intck_common.tcl a61fd2697ae55b0a3d89847ca0b590c6e0d8ff64bebb70920d93724799894159
F ext/intck/intckbusy.test d5ed4ef85a4b1dc1dee2484bd14a4bb68529659cca743327df0c775f005fa387
F ext/intck/intckcorrupt.test f6c302792326fb3db9dcfc70b554c55369bc4b52882eaaf039cfe0b74c821029
F ext/intck/intckfault.test cff3f75dff74abb3edfcb13f6aa53f6436746ab64b09fe5e2028f051e985efab
F ext/intck/sqlite3intck.c 0d10df36e2b7b438aa80ecd3f5e584d41b747586b038258fe6b407f66b81e7c5
F ext/intck/sqlite3intck.c b1c8a86f90fc00741d13314db9c58f7e2f92d1d19c5ad1c6904ec83a6bbd5c96
F ext/intck/sqlite3intck.h 2b40c38e7063ab822c974c0bd4aed97dabb579ccfe2e180a4639bb3bbef0f1c9
F ext/intck/test_intck.c 4f9eaadaedccb9df1d26ba41116a0a8e5b0c5556dc3098c8ff68633adcccdea8
F ext/jni/GNUmakefile 8a94e3a1953b88cf117fb2a5380480feada8b4f5316f02572cab425030a720b4
@@ -353,47 +354,44 @@ F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19b
F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745
F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70
F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0
F ext/misc/README.md af13c3bf4405709eb1e2e1e3a39c3be6a15c3189ab8a0642bb107c6eb223b298
F ext/misc/amatch.c 2db45b1499b275d8340af6337a13d6216e4ceb2ddb41f4042b9801be7b5e593d
F ext/misc/README.md 6243cdc4d7eb791c41ef0716f3980b8b5f6aa8c61ff76a3958cbf0031c6ebfa7
F ext/misc/amatch.c 0e0124c1e03ee4cb99b25969f6b7b39c53a847b8bf12279efbcb896b0df1059a
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e16a3824
F ext/misc/base64.c 73c31eb325c71bae2e27276565e3f674fc095d8b0d7a651becb3b241a4d2fa57
F ext/misc/base85.c a70c885c5c9350261ea6e7b166038eab21a09cf4fceae856ce41fae9c2213b60
F ext/misc/base64.c 8dc0a08cee11722822858a62625f1b63e5d5f1adac1cf4492d5732b571e37aa0
F ext/misc/base85.c ff54cc676c6ec86231f75ecc86ea45416fcb69751dfb79690d5f5da5f7d39867
F ext/misc/basexx.c 89ad6b76558efbceb627afd5e2ef1d84b2e96d9aaf9b7ecb20e3d00b51be6fcf
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c 8f5e6da2c82ec2f06ee0216e922370a436dafdbb06ffa7a552203515ff9e7ddf
F ext/misc/carray.c 1d32a060f60127ad38d5abd071b28443b77885b143da946a10ca16812e0f851e
F ext/misc/carray.h 4bef8af4e9ddda024f5540cc4d456c3e4a4a7624d6315edf85dce1ce8419beb8
F ext/misc/cksumvfs.c 9d7d0cf1a8893ac5d48922bfe9f3f217b4a61a6265f559263a02bb2001259913
F ext/misc/closure.c 5559daf1daf742228431db929d1aa86dd535a4224cc634a81d2fd0d1e6ad7839
F ext/misc/completion.c c3c8b3cc1293c34f04f8746a3adfbfedb43f00d113f8c984a1ed09433317e507
F ext/misc/compress.c 2c79a74330e0e0ba6cb3f7397f8ba5af12d46377ef5d3ee075e12dd8a6ed57f0
F ext/misc/csv.c 7cae8c2666a058a58fb8994ed2457339a06c97d31c251d9a8445cdd966629890
F ext/misc/dbdump.c b8592f6f2da292c62991a13864a60d6c573c47a9cc58362131b9e6a64f823e01
F ext/misc/decimal.c 228d47e9ef4de60daf5851da19e3ac9ac1eda9e94432816914469501db6a1129
F ext/misc/completion.c c27b64fdd0943c1b7f152376599814cee2641f7d67a7bb9bd2b957c2a64a5591
F ext/misc/compress.c 8191118b9b73e7796c961790db62d35d9b0fb724b045e005a5713dc9e0795565
F ext/misc/csv.c d9dab032420d81cdf0abc4b8523711d20a355704f82d958f963c86be48387dd9
F ext/misc/dbdump.c 678f1b9ae2317b4473f65d03132a2482c3f4b08920799ed80feedd2941a06680
F ext/misc/decimal.c d4883de142f6dcd36eda23da40b55e2b51374e7b01eb54a7173940191389fc5e
F ext/misc/eval.c 04bc9aada78c888394204b4ed996ab834b99726fb59603b0ee3ed6e049755dc1
F ext/misc/explain.c 606100185fb90d6a1eade1ed0414d53503c86820d8956a06e3b0a56291894f2b
F ext/misc/fileio.c 88cb2e5744296de6638af02ef6349fd468c2eb5e5f41ba405f88d9b4ad500f8e
F ext/misc/fossildelta.c 0aeb099e9627eea693cf21ae47826ecd1e0319b93143bed23090838b2ef0c162
F ext/misc/fileio.c d80268a5328fe839062a9d3103ea0fc7cacc6d42605959275675cb37867c84f7
F ext/misc/fossildelta.c 2fc2dd4f34f478df674887db62586b1071c4cd3c9e73ee40f9ee669670e482d1
F ext/misc/fuzzer.c 6b231352815304ba60d8e9ec2ee73d4918e74d9b76bda8940ba2b64e8777515e
F ext/misc/ieee754.c c9dd9d77c8e8e18e0a5706f8ffcccf4ccb6562073709f7453d4d73f5122f4362
F ext/misc/ieee754.c 176c061c94857b543313959289cb60cf777c999fd002f82b53d194b95e9f347a
F ext/misc/memstat.c 43705d795090efb78c85c736b89251e743c291e23daaa8382fe7a0df2c6a283d
F ext/misc/memtrace.c 7c0d115d2ef716ad0ba632c91e05bd119cb16c1aedf3bec9f06196ead2d5537b
F ext/misc/memvfs.c 7dffa8cc89c7f2d73da4bd4ccea1bcbd2bd283e3bb4cea398df7c372a197291b
F ext/misc/mmapwarm.c a81af4aaec00f24f308e2f4c19bf1d88f3ac3ce848c36daa7a4cd38145c4080d
F ext/misc/nextchar.c 7877914c2a80c2f181dd04c3dbef550dfb54c93495dc03da2403b5dd58f34edd
F ext/misc/noop.c f1a21cc9b7a4e667e5c8458d80ba680b8bd4315a003f256006046879f679c5a0
F ext/misc/normalize.c 4782be3b74b9bd9f67281036ff1f41e5edcad20ad486171a2d671c4bb2586011
F ext/misc/normalize.c fbb144a861809686ff2b5b6eee8bb2e1207f9bf13ce7376e5273c700a1eafbd5
F ext/misc/pcachetrace.c f4227ce03fb16aa8d6f321b72dd051097419d7a028a9853af048bee7645cb405
F ext/misc/percentile.c 72e05a21db20a2fa85264b99515941f00ae698824c9db82d7edfbb16cea8ec80
F ext/misc/prefixes.c 82645f79229877afab08c8b08ca1e7fa31921280906b90a61c294e4f540cd2a6
F ext/misc/qpvtab.c fc189e127f68f791af90a487f4460ec91539a716daf45a0c357e963fd47cc06c
F ext/misc/randomjson.c ef835fc64289e76ac4873b85fe12f9463a036168d7683cf2b773e36e6262c4ed
F ext/misc/regexp.c 388e7f237307c7dfbfb8dde44e097946f6c437801d63f0d7ad63f3320d4e61cc
F ext/misc/regexp.c f1f7cfe90fc027b33d2b5ae7d6235eecce69c3aca71c9afce56fec62342c8b44
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946
F ext/misc/series.c e212edb2aa00cc778bf29a6d51c51ebb187fae36267f281b484410a3df065dde
F ext/misc/series.c 22c6d8f00cc1b5089b1b37392e9097e9df9a5db53be86daf9a7669d95bb179f4
F ext/misc/sha1.c cb5002148c2661b5946f34561701e9105e9d339b713ec8ac057fd888b196dcb9
F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
@@ -412,11 +410,11 @@ F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505
F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20
F ext/misc/vfsstat.c 0b23c0a69a2b63dc0ef0af44f9c1fc977300c480a1f7a9814500369d8211f56e
F ext/misc/vfstrace.c 0e4b8b17ac0675ea90f6d168d8214687e06ca3efbc0060aad4814994d82b41fb
F ext/misc/vtablog.c 9f7e02e9e8de585f3bfb48405db36c2eb4b680a23a67d7a4b738dd20f6ad7aec
F ext/misc/vtablog.c 2d04386c2f5a3bb93bc9ae978f0b7dcd5a264e126abd640dd6d82aa9067cbd48
F ext/misc/vtshim.c e5bce24ab8c532f4fdc600148718fe1802cb6ed57417f1c1032d8961f72b0e8f
F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f65b4fc0668
F ext/misc/windirent.h 02211ce51f3034c675f2dbf4d228194d51b3ee05734678bad5106fff6292e60c
F ext/misc/zipfile.c 360cc8e0b13398a27abae2baa5d136462718994053ef918e86f4e2dd238657c7
F ext/misc/zipfile.c 71d3fd3155ed5e738473e286e550cf0bcf346cc2fd63646eaf944e7b40531a1b
F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
@@ -495,7 +493,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 734aa36238bcd2dee91db5dba107d5fcbdb02396612811377a8ad50f1272b1c1
F ext/rtree/geopoly.c f0573d5109fdc658a180db0db6eec86ab2a1cf5ce58ec66cbf3356167ea757eb
F ext/rtree/rtree.c 86967c5a501f895b9705366b8cd9c37f15a9ebdff770ceb719c7deeeb2c22b72
F ext/rtree/rtree.c 9331997a76b88a9bc04e156bdfd6e2fe35c0aa93bc338ebc6aa0ae470fe4a852
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test e0608db762b2aadca0ecb6f97396cf66244490adc3ba88f2a292b27be3e1da3e
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
@@ -507,7 +505,7 @@ F ext/rtree/rtree7.test c8fb2e555b128dd0f0bdb520c61380014f497f8a23c40f2e820acc9f
F ext/rtree/rtree8.test 4da84c7f328bbdca15052fa13da6e8b8d426433347bf75fc85574c2f5a411a02
F ext/rtree/rtree9.test fd3c9384ef8aabbc127b3878764070398f136eebc551cd20484b570f2cc1956a
F ext/rtree/rtreeA.test 14e67fccc5b41efbad7ea99d21d11aaa66d2067da7d5b296ee86e4de64391d82
F ext/rtree/rtreeB.test 4cec297f8e5c588654bbf3c6ed0903f10612be8a2878055dd25faf8c71758bc9
F ext/rtree/rtreeB.test ab93136c45cf25af78d22665c2a6d75068eef6bf3a710356e4ba8d5f37bed364
F ext/rtree/rtreeC.test 2978b194d09b13e106bdb0e1c5b408b9d42eb338c1082bf43c87ef43bd626147
F ext/rtree/rtreeD.test fe46aa7f012e137bd58294409b16c0d43976c3bb92c8f710481e577c4a1100dc
F ext/rtree/rtreeE.test e65d3fc625da1800b412fc8785817327d43ccfec5f5973912d8c9e471928caa9
@@ -568,57 +566,53 @@ F ext/session/sessioninvert.test 9018f6a7387ac745084b6374c5e1aa14d648b372e6e1181
F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09
F ext/session/sessionnoact.test 4c7ae5c7d351cb5323bca62b6b095592ad24bd90a6713c178b62ab0063d23e19
F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7
F ext/session/sessionnoop2.test 5beecd3ffcfbc1ef199d3536e91cc3186b438d587531ff334b6b0fc9b7d8ef10
F ext/session/sessionnoop2.test 2d8146321785bdc7cee8966d984560184cfca83fd46da2ff81ea883d6e977b36
F ext/session/sessionrebase.test 702378bdcb5062f1106e74457beca8797d09c113a81768734a58b197b5b334e2
F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a80600a44396f7363
F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795
F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544a806421b85dc2dec
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
F ext/session/sqlite3session.c 9cd47bfefb23c114b7a5d9ee5822d941398902f30516bf0ddfb131d94f8bb840
F ext/session/sqlite3session.c b3de195ce668cace9b324599bf6255a70290cbfb5451e826e946f3aee6e64c54
F ext/session/sqlite3session.h 7404723606074fcb2afdc6b72c206072cdb2b7d8ba097ca1559174a80bc26f7a
F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 89e18d6e4783841a5236930b988df27e02317b3ac440a1a5571de4a79df3c8e7
F ext/wasm/GNUmakefile 3dc01e673c456d3b752674c9407276e8fef35dec1d304b3cc1de362f019b2a09
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7
F ext/wasm/README.md 2e87804e12c98f1d194b7a06162a88441d33bb443efcfe00dc6565a780d2f259
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
F ext/wasm/SQLTester/SQLTester.mjs 66e1adc3d79467b68e3e40614fd42c1a577c7e219ec0985db966eded52a941e5
F ext/wasm/SQLTester/SQLTester.mjs 6b3c52ed36a5573ca4883176f326332a8d4c0cecf5efd80489528267fa5d9ed4
F ext/wasm/SQLTester/SQLTester.run.mjs 57f2adb33f43f2784abbf8026c1bfd049d8013af1998e7dcb8b50c89ffc332e0
F ext/wasm/SQLTester/index.html 64f3435084c7d6139b08d1f2a713828a73f68de2ae6a3112cbb5980d991ba06f
F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-core e5cf4fa7610a09d51017d75faf50be38172058c0d781837d8257d16ddcaaea33
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-extras cb4fa8842c875b6ee99381523792975c5ebb7371bd27fbd1bd863a43c7f3505a
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-core ef34398a903d0a2425fbbfbd4ed2cd596daea55b8515e2617c8dc7ad7c0767dd
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-extras 9eae68943ce91ab145892b31370819c2103525240eb72e0fce53c498b8d8275a
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 7f029c5fe83b3493931d2fb915e2febd3536267d538a56408a6fef284ea38d29
F ext/wasm/api/extern-post-js.c-pp.js d8f5ffa354c790d89681d0a23594c02347d28046d60151bd598712fbdff6056c
F ext/wasm/api/README.md f4c0d67caaee21a77b8938c30b5f79667bfc9d0c95d01b51df77ea35ee773884
F ext/wasm/api/extern-post-js.c-pp.js 205f55aacfc62c580985db5c790300779de3876a76a5c7e1bfb13e71c8b4506b
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90ae151e37fa9f75bf41
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 3ac1786e461ada63033143be8c3b00b26b939540661f3e839515bb92f2e35359
F ext/wasm/api/sqlite3-api-glue.c-pp.js 066c09125d12189863ec2b34e702b7b8a7ba25c00e73f77de0b727430ef65687
F ext/wasm/api/sqlite3-api-oo1.c-pp.js 852f2cd6acddbae487fc4f1c3ec952e6c1e2033aa4e6c7091d330d983c87c032
F ext/wasm/api/sqlite3-api-prologue.js 4272131346b102d6f1bfc07524331213ff89407b76cbbde4c0b48b19c692ba94
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 760191cd13416e6f5adfd9fcc8a97fed5645c9e0a5fbac213a2d4ce2d79a4334
F ext/wasm/api/post-js-footer.js 5bd7170b5e8ce7b62102702bbcf47ef7b3b49cd56ed40c043fd990aa715b74ee
F ext/wasm/api/post-js-header.js 79d078aec33d93b640a19c574b504d88bb2446432f38e2fbb3bb8e36da436e70
F ext/wasm/api/pre-js.c-pp.js a876c6399dff29b6fe9e434036beb89889164cc872334e184291723ecc7cb072
F ext/wasm/api/sqlite3-api-cleanup.js a3d6b9e449aefbb8bba283c2ba9477e2333a0eeb94a7a26b5bf952736f65a6dd
F ext/wasm/api/sqlite3-api-glue.c-pp.js d2b8263b3ce0cefc6c5a68d0a4d448a9770eda4bf9d9ded9d7eb0198e4ce4da1
F ext/wasm/api/sqlite3-api-oo1.c-pp.js c4260f3fdc553c56ee530c20cc1119029067b503f0d6d7b472705536cb45aa1d
F ext/wasm/api/sqlite3-api-prologue.js 307583ff39a978c897c4ef4ce53fe231dce5c73dc84785969c81c1ab5960a293
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1041dd645e8e821c082b628cd8d9acf70c667430f9d45167569633ffc7567938
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-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 e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616
F ext/wasm/api/sqlite3-wasm.c 7b207c10c6b4019cf667c4e332bdd33c98afc08c943f8cc0aea7693ad8635f7c
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 4ad256b4ff7f839ad18931ed35d46cced544207bd2209665ec552e193f7f4544
F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5
F ext/wasm/batch-runner-sahpool.html e9a38fdeb36a13eac7b50241dfe7ae066fe3f51f5c0b0151e7baee5fce0d07a7
F ext/wasm/batch-runner-sahpool.js 54a3ac228e6c4703fe72fb65c897e19156263a51fe9b7e21d2834a45e876aabd
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 05ec254f5dbfe605146d9640b3db17d6ef8c3fbef6aa8396051ca72bb5884e3f
F ext/wasm/c-pp.c cca55c5b55ebd8d29916adbedb0e40baa12caa9a2e8429f812683c308f9b0e9a
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 26cb41d5a62f46a106b6371eb00fef02de3cdbfaa51338ba087a45f53028e0d0
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 418c33fe284739564daab3c7a7a88882fdd3c99137497900f98eddec1e409af5
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 9097074724172e31e56ce20ccd7482259cf72a76124213cbc9469d757676da86
F ext/wasm/api/sqlite3-wasm.c dd7fc1d535281f0d5d2732bb1b662d1d403a762f07b63c2ea5663053377b2804
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bda1c75bd674a92a0e27cc2f3d46dbbf21e422413f8046814515a0bd7409328a
F ext/wasm/api/sqlite3-worker1.c-pp.js 802d69ead8c38dc1be52c83afbfc77e757da8a91a2e159e7ed3ecda8b8dba2e7
F ext/wasm/c-pp-lite.c 8fa0148e73782a86274db688c4730e2962cd675af329490493adddaf3322f16f
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
F ext/wasm/common/whwasmutil.js ea50e847cf08c2a96694f87d00b49fb97ee5fe62c15439cc269c8e1d9ab74c0a
F ext/wasm/common/whwasmutil.js 0d539324097fc83b953e9844267359ba0fd02286caa784ea2f597ced279ea640
F ext/wasm/config.make.in c424ae1cc3c89274520ad312509d36c4daa34a3fce5d0c688e5f8f4365e1049a
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
@@ -626,36 +620,35 @@ F ext/wasm/demo-123.js c7b3cca50c55841c381a9ca4f9396e5bbdc6114273d0b10a43e378e32
F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e
F ext/wasm/demo-jsstorage.js 42131ddfa18e817d0e39ac63745e9ea31553980a5ebd2222e04d4fac60c19837
F ext/wasm/demo-worker1-promiser.c-pp.html 635cf90685805e21772a5f7a35d1ace80f98a9ef7c42ff04d7a125ddca7e5db8
F ext/wasm/demo-worker1-promiser.c-pp.js af168699d3cab1c27ad2364ebe06cd49db300bdbf404e23b00d5742ed52816ba
F ext/wasm/demo-worker1-promiser.c-pp.js f40ec65810048e368896be71461028bd10de01e24277208c59266edf23bb9f52
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
F ext/wasm/demo-worker1.js 08720227e98fa5b44761cf6e219269cee3e9dd0421d8d91459535da776950314
F ext/wasm/dist.make 57f5da2f0de5a297b5a0bc39ffec736380050578240ab24d864c2ff1b3634a3b
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/fiddle.make ea505d11aa2a89551e1693ed4c71ee6a163364ca14f806dda295d0beb26ec0ea
F ext/wasm/fiddle/fiddle-worker.js 50d3edf54c0c0e3657e876724ec2c10069f55f3e40af20864d72f6f6e9ad00f8
F ext/wasm/fiddle/fiddle.js f0b96f978c7c77fea8d092aa79c77849ce111d7b1ba60ffba07675009682184e
F ext/wasm/fiddle/index.html 17c7d6b21f40fbf462162c4311b63d760b065e419d9f5a96534963b0e52af940
F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730
F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d
F ext/wasm/jaccwabyt/jaccwabyt.js 6e4f26d0edb5c2e7d381b7eff1924832a040a12274afab2d1e1789027e9f6c5c
F ext/wasm/jaccwabyt/jaccwabyt.md 1128e3563e7eff90b5a373395251fc76cb32386fad1fea6075b0f34a8f1b9bdf
F ext/wasm/mkwasmbuilds.c cc66cfaf8673ece3c30ca7fe28f6111481090648098a143ea619a8820b8fbe82
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/fiddle/fiddle-worker.js 7798af02e672e088ff192716f80626c8895e19301a65b8af6d5d12b2d13d2451
F ext/wasm/fiddle/fiddle.js 84fd75967e0af8b69d3dd849818342227d0f81d13db92e0dcbc63649b31a4893
F ext/wasm/fiddle/index.html a27b8127ef9ecf19612da93b2a6a73bdb3777b5c56b5450bb7200a94bc108ff9
F ext/wasm/index-dist.html db23748044e286773f2768eec287669501703b5d5f72755e8db73607dc54d290
F ext/wasm/index.html 54e27db740695ab2cb296e02d42c4c66b3f11b65797340d19fa6590f5b287da1
F ext/wasm/jaccwabyt/jaccwabyt.js bbac67bc7a79dca34afe6215fd16b27768d84e22273507206f888c117e2ede7d
F ext/wasm/jaccwabyt/jaccwabyt.md 167fc0b624c9bc2c477846e336de9403842d81b1a24fc4d3b24317cb9eba734f
F ext/wasm/mkdist.sh 64d53f469c823ed311f6696f69cec9093f745e467334b34f5ceabdf9de3c5b28 x
F ext/wasm/mkwasmbuilds.c 1b53c4d2a1350c19a96a8cdfbda6a39baea9d2142bfe0cbef0ccb0e898787f47
F ext/wasm/module-symbols.html e54f42112e0aac2a31f850ab33e7f2630a2ea4f63496f484a12469a2501e07e2
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63
F ext/wasm/speedtest1-wasmfs.html 0e9d335a9b5b5fafe6e1bc8dc0f0ca7e22e6eb916682a2d7c36218bb7d67379d
F ext/wasm/speedtest1-wasmfs.mjs c77c7231338ed5c0e1ce16aa29106df8e5b5cf11a48319c49433490a8d3ded30
F ext/wasm/speedtest1-worker.html d24d1e06caf3dcd83430c8c3d87761ff7555fd06eaeaf2fc02ce49cf45f0d032
F ext/wasm/speedtest1-worker.js 95e549e13a4d35863a9a7fc66122b5f546c0130d3be7b06dfcc556eb66d24bde
F ext/wasm/speedtest1.html e2a0e0bd12243ca34b11235bf9f3c229f4574ea1125f2ecf2bf0589853d6f9c8
F ext/wasm/speedtest1-wasmfs.mjs 60dd5842f6d2a70a6d0bef12633a11491bde6984aff75a37c2040980d8cbf36a
F ext/wasm/speedtest1-worker.html 068d4190f304fa1c34e6501a1b3a4c32fe8d8dac93c2d0f53d667a1cb386eedc
F ext/wasm/speedtest1-worker.js 958a2d3c710bf8e82567277f656193a0248216db99a3c2c86966124b84309efb
F ext/wasm/speedtest1.html c90d63dfa795f0cb1ad188de587be9024b1ff73b4adc5fdf7efc0d781be94d03
F ext/wasm/split-speedtest1-script.sh a3e271938d4d14ee49105eb05567c6a69ba4c1f1293583ad5af0cd3a3779e205 x
F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d82675bd63d9c2d97a15f0
F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5
F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f
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 aa694096feb5cfd9333f7029e933a4eae95bde5cc3edd29da4dc0f8dae452905
F ext/wasm/tester1-worker.c-pp.html 883881eeac14eeeecc8ff22acf9fe0f18a97cacb48be08ebb0bae891ceded584
F ext/wasm/tester1.c-pp.html 949920126dcf477925d8d540093d9cc374d3ab4c4ddee920c1dcadcf37917306
F ext/wasm/tester1.c-pp.js 2b014884dadf28928fabcb688746ca87145673eef75e154486505a266203fc15
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
@@ -664,14 +657,13 @@ F ext/wasm/tests/opfs/sahpool/digest.html 206d08a34dc8bd570b2581d3d9ab3ecad3201b
F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca01385e2732294b53f4c842328
F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2
F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
F ext/wasm/wasmfs.make 411dd94b40406572caddf88392a1ccc4deed0f88d260516e59ca6e0c887ee861
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 20fe7a151708fc6b1f8cd0fdcc73622701cff5959131cfb73e1f75d33e687bf8
F main.mk 00dd631c66c1f7922b2d691631163899eff1c3d1da780ff37a62f8d997b368e1
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
F mptest/mptest.c aa41ace6dbc5050d76b02548d3521e6bbccae4f0
F mptest/mptest.c 7ecf39040c1187d9cbc487409bc052f194e93c165f667c55b052690a741d9d71
F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 1b9c24374a85dfc7eb8fa7c4266ee0db4f9609cceecfc5481cd8307e5af04366
@@ -686,27 +678,28 @@ F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
F src/btree.c cb5b8ceb9baa02a63a2f83dec09c4153e1cfbdf9c2adef5c62c26d2160eeb067
F src/btree.h e823c46d87f63d904d735a24b76146d19f51f04445ea561f71cc3382fd1307f0
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
F src/build.c 213a9d24c931ef4694564894cda8dac8dbeb1519d428fd2d7ae622ac357c05a5
F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859
F src/build.c 611e07299d72ff04bbcb9e7109183467e30925d203c3e121ef9bb3cf6876289b
F src/callback.c 3605bbf02bd7ed46c79cd48346db4a32fc51d67624400539c0532f4eead804ad
F src/carray.c ff6081a31878fc34df8fa1052a9cbf17ddc22652544dcb3e2326886ed1053b55
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/date.c 9db4d604e699a73e10b8e85a44db074a1f04c0591a77e2abfd77703f50dce1e9
F src/dbpage.c 081c59d84f187aa0eb48d98faf9578a00bde360f68438d646a86b618653d2479
F src/date.c e19e0cfff9a41bfdd884c655755f6f00bca4c1a22272b56e0dd6667b7ea893a2
F src/dbpage.c c9ea81c11727f27e02874611e92773e68e2a90a875ef2404b084564c235fd91f
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c 0cad74107489c688449d7fec47b605c61a75c6da707031dfc4c76d1ac75667b3
F src/expr.c 28b1cc3d2f147cc888703d5482f9581f17656d02abfa331c34370cb3350776be
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
F src/func.c de47a8295503aa130baae5e6d9868ecf4f7c4dbffa65d83ad1f70bdbac0ee2d6
F src/func.c 0b802107498048d3dcac0b757720bcb8506507ce02159e213ab8161458eb293b
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7
F src/hash.c 03c8c0f4be9e8bcb6de65aa26d34a61d48a9430747084a69f9469fbb00ea52ca
F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c dfd311b0ac2d4f6359e62013db67799757f4d2cc56cca5c10f4888acfbbfa3fd
F src/json.c cb87977b1ee25ee7d27505d65a9261b687395bf895342c8ba566b7c01aee2047
F src/json.c fb031340edee159c07ad37dbe668ffe945ed86f525b0eb3822e4a67cbc498a72
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 3326993a09553c6b38cc52d4f9cc2e47dcfc8736ffd853fcb0cb49bc9e3d523c
F src/main.c 8faccfa7dc8a470ac57f060948ff703da1f2dbedcd4cebc0a21caeb7facf7eef
F src/loadext.c a3bc9a2522dc3b960e38b7582d1818f6245a49289387c2c7b19f27bfeabf1e81
F src/main.c 65d11c17890966d271c925c6cc55e3ba50fa08374633cb99c0dee4719a20915a
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@@ -725,35 +718,35 @@ F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878
F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a
F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107
F src/os_unix.c b3da55bc4bb214b2bfb1e430b10e9d3ebcf6b11741921ab044c9b9539c8fcc4f
F src/os_win.c f81a7cffdfe8c593a840895b3f64290714f0186b06302d2c397012252d830374
F src/os_kv.c fb7ba8d6204197357f1eb7e1c7450d09c10043bf7e99aba602f4aa46b8fb11a3
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
F src/os_unix.c dcf7988ddbdd68619b821c9a722f9377abb46f1d26c9279eb5a50402fd43d749
F src/os_win.c a89b501fc195085c7d6c9eec7f5bd782625e94bb2a96b000f4d009703df1083f
F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
F src/pager.c ee48e0cc9ae4abfd7c37b838bff62a14d520a9fa311007fa57929ac7cc5d609c
F src/pager.c cd562b878ea1b44d021ba199abc9d3b54f6b3347500a9fed03f66d6000620945
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
F src/parse.y 619c3e92a54686c5e47923688c4b9bf7ec534a4690db5677acc28b299c403250
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 131ca0daf4e66b4608d2945ae76d6ed90de3f60539afbd5ef9ec65667a5f2fcd
F src/pragma.c 20847ce727fa0efe64de13f54427d44d25df7a00c806f198463dc37041aeeed0
F src/pragma.c ecec75795c1821520266e4f93fa8840cce48979af532db06f085e36a7813860f
F src/prepare.c 2af0b5c1ec787c8eebd21baa9d79caf4a4dc3a18e76ce2edbf2027d706bca37a
F src/printf.c 5f0c957af9699e849d786e8fbaa3baab648ca5612230dc17916434c14bc8698f
F src/printf.c 7297c2aeed4d90d80c5ba82920d9e57b7bfad04b3466be1d7e042db382fe296e
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c f8d1d011aba0964ff1bdccd049d4d2c2fec217efd90d202a4bb775e926b2c25d
F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957
F src/shell.c.in 458c1a24d19251db547770fac50ae9c94dca42c310f8ecc937e3c587cd76ac8d
F src/sqlite.h.in 5732519a2acb09066032ceac21f25996eb3f28f807a4468e30633c7c70faae1c
F src/select.c fa67ce1dd60744c315791085897c1571ffe5554bf3e0410942b5fc9d7e0a4b56
F src/shell.c.in 2c7e751795f38bb1855c35b556419cab5b8ba22e0f6758f5a629338065d6b79f
F src/sqlite.h.in c0979f9ac1f5be887397dd2a0bb485636893a81b34d64df85123aae9650c42f2
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 3f0c4ed6934e7309a61c6f3c30f70a30a5b869f785bb3d9f721a36c5e4359126
F src/sqliteInt.h 27c73e48878d31ef230ba867d1f8c3af6aed357fd93ccc605d3f1aae007ea62b
F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52
F src/sqliteInt.h 88f7fc9ce1630d9a5f7e0a8e1f3287cdc63882fba985c18e7eee1b9f457f59aa
F src/sqliteLimit.h fe70bd8983e5d317a264f2ea97473b359faf3ebb0827877a76813f5cf0cdc364
F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd
F src/status.c 7565d63a79aa2f326339a24a0461a60096d0bd2bce711fefb50b5c89335f3592
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 3c604c49e6cf4211960a9ddb9505280fd22cde32175f40884c641c0f5a286036
F src/tclsqlite.h 614b3780a62522bc9f8f2b9fb22689e8009958e7aa77e572d0f3149050af348a
F src/test1.c 82d8aab7162a758d030728cab6ae6011785234854b7d6d2aebd877f985d1016a
F src/test1.c 5d061afe479c7364842e0170be7220dea13389575fa6030d30b3e20bec4e1f75
F src/test2.c 62f0830958f9075692c29c6de51b495ae8969e1bef85f239ffcd9ba5fb44a5ff
F src/test3.c 432646f581d8af1bb495e58fc98234380250954f5d5535e507fc785eccc3987a
F src/test4.c 0ac87fc13cdb334ab3a71823f99b6c32a6bebe5d603cd6a71d84c823d43a25a0
@@ -763,10 +756,10 @@ F src/test8.c 206d8f3cc73950d252906656e2646b5de0d580b07187b635fcb3edd8c2c5fbc0
F src/test9.c df9ddc7db6ef1b8cf745866ee229090779728bcbe660c7f297d3127ab21d92af
F src/test_autoext.c 14d4bbd3d0bd1eec0f6d16b29e28cf1e2d0b020d454835f0721a5f68121ac10f
F src/test_backup.c a2bfd90d2ff2511b8635507bdb30fa9b605ade19c16b533066cae3077f5bdb72
F src/test_bestindex.c 3401bee51665cbf7f9ed2552b5795452a8b86365e4c9ece745b54155a55670c6
F src/test_bestindex.c a9428931bec06de830b2630f57a7b1f2711761269f04df62b7aa1affcbce15bb
F src/test_blob.c 77b994e17f2c87055f44fd96c9a206c5a7155bae2cda2769af60c2f3582f962c
F src/test_btree.c 28283787d32b8fa953eb77412ad0de2c9895260e4e5bd5a94b3c7411664f90d5
F src/test_config.c 7f412406592794636d6226268e26d413850a9f799bc5f3c01afc2820b165fca8
F src/test_config.c 18aa596d37de1d5968c439fd58ebf38bc4d9c9d1db63621504e241fde375cecd
F src/test_delete.c d0e8f6dc55cfc98a7c27c057fb88d512260564bf0b611482656c68b8f7f401ed
F src/test_demovfs.c 3efa2adf4f21e10d95521721687d5ca047aea91fa62dd8cc22ac9e5a9c942383
F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86
@@ -778,7 +771,7 @@ F src/test_intarray.c 3fcf8ca7bb5c8776ea83f6aa9b66f8df0d1f37a99207b0097c8486f9c1
F src/test_intarray.h 6c3534641108cd1bea517a8e117dcba237081310a29a4c35bd2190caa8972293
F src/test_journal.c a0b9709b2f12b1ec819eea8a1176f283bca6d688a6d4a502bd6fd79786f4e287
F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd
F src/test_malloc.c f1901a7a32fadff1978d6aca8e3bd2c6cc1e41b790ff19d369cc0367116a1828
F src/test_malloc.c 55e2b5398f6e184300d91278b8a84768f6a740735adc030411181945d5276da0
F src/test_md5.c 811a45330c9391933360f998156a8907ee29909c828ab83ac05d329942cbea8f
F src/test_multiplex.c 82f0aa8eee629b6949782cfab8782ed35a9b56dc80d12877af52147f304d22b8
F src/test_multiplex.h f0ff5b6f4462bfd46dac165d6375b9530d08089b7bcbe75e88e0926110db5363
@@ -801,7 +794,7 @@ F src/test_vfs.c b4135c1308516adf0dfd494e6d6c33114e03732be899eace0502919b674586b
F src/test_window.c 6d80e11fba89a1796525e6f0048ff0c7789aa2c6b0b11c80827dc1437bd8ea72
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 8400646d2830afc2f2dc465a75e3a92e4bedeea623f19dbd79c0c12d0dd6dda2
F src/tokenize.c cb3294cf23c11106b50d9af6998a6c1bf389b52e15b17698c9fab97bbaa9b37f
F src/treeview.c 3ce7ac9835d2d70cc1c868b01b747ae8a062322e155701e58e3d62ca79aada7a
F src/trigger.c d5cf2541ff048f30b6a0507eb3d1ec4e695c53584e3b2298a5bf248714fe185e
F src/update.c 3e5e7ff66fa19ebe4d1b113d480639a24cc1175adbefabbd1a948a07f28e37cf
@@ -809,26 +802,26 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
F src/util.c 36fb1150062957280777655976f3f9a75db236cb8207a0770ceae8d5ec17fcd3
F src/vacuum.c 1bacdd0a81d2b5dc1c508fbf0d938c89fa78dd8d5b46ec92686d44030d4f4789
F src/vdbe.c 07084aa0152c8d4e74e7b86c0cf744732f0f9b1fd62bd7098252cadb741c630a
F src/vdbe.h ea1f1b52f0efe422f80d88da3c57e4eadc72856e29a22f1ff08e502ec6ba5f08
F src/vdbeInt.h 52896dd4d5b62190c53db14b09fc2484434eb594c963df0fa66eb8a94527b02e
F src/vdbeapi.c f9a4881a9674fec3fa13da35044a1484d3c4b95f9ec891cc8ffb02ef2b7a41df
F src/vdbeaux.c b701e5920fe74b907eb8211d1f63fef96adc65dfd6e1ad6ed0843c71d8c65205
F src/vdbe.c b44c366e83412d3b8c190feb1f029b7d02e1bd69252a57b32f195107f0d03964
F src/vdbe.h be33bd7b17f2ec92939642416030491508c51071f6c14e27cd195983fec56b63
F src/vdbeInt.h 2aaeb6df2938b181b4700a9328688a3986f2bba71e8b96f6a80671316618fa49
F src/vdbeapi.c 869a0da5d855495055f4d35c6ada582f64ce995ce14b26ff9d336274d497266c
F src/vdbeaux.c 908d8a191aed444b2e4c920159249127f3ff67b94c56a16fad1dfdf9c7488f20
F src/vdbeblob.c b3f0640db9642fbdc88bd6ebcc83d6009514cafc98f062f675f2c8d505d82692
F src/vdbemem.c e67d9c6484d868c879d20c70d00bf4a9058082f1d4058607ca15d50eb3aebc21
F src/vdbesort.c cb6f472e83ca12c46aa7de0ac0a9d11458b357986f2617a1c90dfb19a542ecbe
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbemem.c 48e562ff27e6386eb8613207ac27d3d98c1f67fdc4775a1ab13759d2c2a1c021
F src/vdbesort.c b69220f4ea9ffea5fdef34d968c60305444eea909252a81933b54c296d9cca70
F src/vdbetrace.c 49e689f751505839742f4a243a1a566e57d5c9eaf0d33bbaa26e2de3febf7b41
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859
F src/vtab.c 5437ce986db2f70e639ce8a3fe68dcdfe64b0f1abb14eaebecdabd5e0766cc68
F src/vxworks.h 9d18819c5235b49c2340a8a4d48195ec5d5afb637b152406de95a9436beeaeab
F src/wal.c a278339ecf5f194fd71fff1f0da1368de50e3a32edc3e9944e1ee1f4610476ff
F src/wal.c 505a98fbc599a971d92cb90371cf54546c404cd61e04fd093e7b0c8ff978f9b6
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c 9d7b4095ae0a34d9604c3e185c65cdf6eca5f2e8707403c526eed798867cece4
F src/where.c 287324fe73a0ae8e55b3be89bb2fe4148e3a8394e1e2f10ed2113713a037d8a3
F src/whereInt.h 8d94cb116c9e06205c3d5ac87af065fc044f8cf08bfdccd94b6ea1c1308e65da
F src/wherecode.c 71c5c6804b7f882dec8ec858758accae02fcfca13df3cc720f1f258e663ec7c5
F src/whereexpr.c 403a44eeec1a0f0914fccc6a59376b6924bc00ef6728fe6ffce4cf3051b320fc
F src/window.c d01227141f622f24fbe36ca105fbe6ef023f9fd98f1ccd65da95f88886565db5
F src/window.c 538195bbc75bb924e18e368fbd4ed731a3fe3f901351b44f6466ec486f53affe
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test 4d7a34d328e58ca2a2d78fd76c27614a41ca7ddf4312ded9c68c04f430b3b47d
F test/affinity3.test 9b7d1133e11d5edd7805573c4ab6f3ba73b0b74a1f280d5b130d4bf3506a93ff
@@ -906,7 +899,7 @@ F test/backup_ioerr.test 4c3c7147cee85b024ecf6e150e090c32fdbb5135
F test/backup_malloc.test 0c9abdf74c51e7bedb66d504cd684f28d4bd4027
F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
F test/badutf2.test f310fd3b24a491b6b77bccdf14923b85d6ebcce751068c180d93a6b8ff854399
F test/basexx1.test d8a50f0744b93dca656625597bcd3499ff4b9a4ea2a82432b119b7d46e3e0c08
F test/basexx1.test 4ae6ddbd92a7ebcabb5d844664c3e755d29fb69c8ddcf0c8d59bbe4e07c23919
F test/bc_common.tcl c70b896d1d4ce72f769d2c7c1fc15b2cb07559eb2093f2736c8ca51664b29ff5
F test/bestindex1.test 856a453dff8c68b4568601eed5a8b5e20b4763af9229f3947c215729ed878db0
F test/bestindex2.test 394ff8fbf34703391247116d6a44e1c50ee7282236ee77909044573cefc37bc0
@@ -921,12 +914,12 @@ F test/bestindexA.test e1b5def6b190797cacf008e6815ffb78fb30261999030d60a728d572e
F test/bestindexB.test 328b97b69cd1a20928d5997f9ecb04d2e00f1d18e19ab27f9e9adb44d7bc51ce
F test/bestindexC.test 95b4a527b1a5d07951d731604a6d4cf7e5a806b39cea0e7819d4c9667e11c3fc
F test/bestindexD.test 6a8f6f84990bcf17dfa59652a1f935beddb7afd96f8302830fbc86b0a13df3c3
F test/bestindexE.test f0c7105d1e7facaa8f5e6c498849cc6dcadd533b35ea9e5e1176e54a9a2d70f1
F test/bestindexE.test 297f3ea8500a8f3c17d6f78e55bdfee089064c6144ee84a110bd005a03338f49
F test/between.test e7587149796101cbe8d5f8abae8d2a7b87f04d8226610aa1091615005dcf4d54
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
F test/bigmmap.test 6021e205487347c6d7e5a541aa472a4b8efc4e9f4a3799a823b61a8e6616105d
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bigrow.test 3e6b189dea465a78306eac67fc6754c1cf90eb1694a25c88c338900c216c1e6b
F test/bigsort.test 997e172009905873c06426145e4b3794c7dfe2d563724cb2fd39d45f319cf3d2
F test/bind.test 1e136709b306f7ed3192d349c2930d89df6ab621654ad6f1a72381d3fe76f483
F test/bind2.test 918bc35135f4141809ead7585909cde57d44db90a7a62aef540127148f91aab7
@@ -956,7 +949,9 @@ F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
F test/capi3c.test 31d3a6778f2d06f2d9222bd7660c41a516d1518a059b069e96ebbeadb5a490f7
F test/capi3d.test 8b778794af891b0dca3d900bd345fbc8ebd2aa2aae425a9dccdd10d5233dfbde
F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe
F test/carray01.test 23ed7074307c4a829ba5ff2970993a9d87db7c5cdbbe1a2cbef672d0df6d6e31
F test/carray01.test 49e2aedfdf2c715bc002d2773cdc1217166679639542c79c8aa4115f06421407
F test/carray02.test 9d070b54f24a34d1f3b3c552ba34db0375a9d1c4219067416fb07d1595987c9d
F test/carrayfault.test 108a7d83904fc267c448e27c13b2a857c700bd6ddaa2f1e2518be718b159cb6b
F test/cast.test a2a3b32df86e3c0601ffa2e9f028a18796305d251801efea807092dbf374a040
F test/cffault.test 9d6b20606afe712374952eec4f8fd74b1a8097ef
F test/changes.test 4377d202a487f66fc2822c1bf57c46798c8b2caf7446f4f701723b1dbb6b86f6
@@ -1030,7 +1025,7 @@ F test/ctime.test 340f362f41f92972bbd71f44e10569a5cc694062b692231bd08aa6fe6c1c47
F test/cursorhint.test 05cf0febe5c5f8a31f199401fd1c9322249e753950d55f26f9d5aca61408a270
F test/cursorhint2.test 6f3aa9cb19e7418967a10ec6905209bcbb5968054da855fc36c8beee9ae9c42f
F test/dataversion1.test 6e5e86ac681f0782e766ebcb56c019ae001522d114e0e111e5ebf68ccf2a7bb8
F test/date.test 180301372ed42520ff2d1c9bfa1d2aa726a0530d32452bd3f88f0a1c40f3c21e
F test/date.test 328ed63091d34c8a6e8dcec4f999a031ce310f24395b8f0f67f07eaf36cbfd1f
F test/date2.test 7e12ec14aaf4d5e6294b4ba140445b0eca06ea50062a9c3a69c4ee13d0b6f8b1
F test/date3.test a1b77abf05c6772fe5ca2337cac1398892f2a41e62bce7e6be0f4a08a0e64ae5
F test/date4.test b5ad22baf7394e008ac59383840159daedd45be31dcf74a3b2450ec0e28955ce
@@ -1044,8 +1039,8 @@ F test/dblwidth-a.sql eb4141518610e52f931a55a984310075e98dc31eee5a28ae806b1e3537
F test/dbpage.test 63fab1eb026bada121107e53436fa749bbf83281dc9dea17af422f7a5c0f289f
F test/dbpagefault.test ea39de2ca86041a9c6df1135645180a76d0a8da93ac159e2fafe38e39636530b
F test/dbstatus.test 4a4221a883025ffd39696b3d1b3910b928fb097d77e671351acb35f3aed42759
F test/dbstatus2.test f5fe0afed3fa45e57cfa70d1147606c20d2ba23feac78e9a172f2fe8ab5b78ef
F test/decimal.test ef731887b43ee32ef86e1c8fddb61a40789f988332c029c601dcf2c319277e9e
F test/dbstatus2.test a36518c0f0951d8fd5a3dc36f99948ad1af93fb7fc0d2e03e5bb5a643186cf52
F test/decimal.test a11b87a2c3294eb4c11b55f3168aeac63d683fa8ada35921a6ec1d511eff7648
F test/default.test c7124864cded213a3f118bc7e2e26f34b7c36dfa26cf6945cc8b7f5db1191277
F test/delete.test 2686e1c98d552ef37d79ad55b17b93fe96fad9737786917ce3839767f734c48f
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
@@ -1068,7 +1063,7 @@ F test/e_createtable.test 31b9bcb6ac8876bc7ec342d86d9c231a84c62b442093a6651dfd0f
F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e
F test/e_droptrigger.test 235c610f8bf8ec44513e222b9085c7e49fad65ad0c1975ac2577109dd06fd8fa
F test/e_dropview.test 74e405df7fa0f762e0c9445b166fe03955856532e2bb234c372f7c51228d75e7
F test/e_expr.test 4faef475076f676e2a009270dbd3a7658db30d12dc3d21e4b85cab5f50be18c5
F test/e_expr.test 0a1e175caddc78b27306647cb4ce2362c55790190f8cdd178b75fd6262eb8f76
F test/e_fkey.test feeba6238aeff9d809fb6236b351da8df4ae9bda89e088e54526b31a0cbfeec5
F test/e_fts3.test 17ba7c373aba4d4f5696ba147ee23fd1a1ef70782af050e03e262ca187c5ee07
F test/e_insert.test f02f7f17852b2163732c6611d193f84fc67bc641fb4882c77a464076e5eba80e
@@ -1098,10 +1093,10 @@ F test/exclusive.test 7ff63be7503990921838d5c9f77f6e33e68e48ed1a9d48cd28745bf650
F test/exclusive2.test cd70b1d9c6fffd336f9795b711dcc5d9ceba133ad3f7001da3fda63615bdc91e
F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
F test/exists.test 79a75323c78f02bbe9c251ea502a092f9ef63dac
F test/existsexpr.test 9c4b77c4729281cc2ae63b9b460d0598ce28cc7876135e3e2c21629bbc8d077a
F test/existsexpr.test 75c1c13cda18b53f68c135fe644afc034d72a6de5b0774b0219ca4a6dc4b96b0
F test/existsexpr2.test dc23e76389eff3d29f6488ff733012a3560cd67ec8cfaecbecd52cced5d5af11
F test/existsfault.test ff41c11f3052c1bbd4f8dd557802310026253d67d7c4e3a180c16d2f0862973e
F test/expr.test 4ada8eb822c45ef27a36851a258004d43c1e95e7c82585a1217e732084e4482c
F test/expr.test db981f8a85520e99ae20aab7ad2e9b5b0437ed09159b57ced434c672075d2e61
F test/expr2.test c27327ae9c017a7ff6280123f67aff496f912da74d78c888926d68b46ec75fd8
F test/exprfault.test da33606d799718e2f8e34efd0e5858884a1ad87f608774c552a7f5517cc27181
F test/exprfault2.test c49e84273898969af5dbc4fe6a3f4335f14639799f343590336c9ddf84425965
@@ -1235,7 +1230,7 @@ F test/func5.test 863e6d1bd0013d09c17236f8a13ea34008dd857d87d85a13a673960e4c25d8
F test/func6.test 3bc89ec0f2605736d3a118f43d25ef58115a7db4dba8ae939a363917d815c0bb
F test/func7.test 7e009275f52c52954c8c028fdb62f8bc16cc47276fcc8753c1d2b22c6e074598
F test/func8.test c4e2ecacf9f16e47a245e7a25fbabcc7e78f9c7c41a80f158527cdfdc6dd299d
F test/func9.test d56aa5b0f7d0e4fec01cb19b797671221dece2b00714bb71679588666be7530d
F test/func9.test 32c7d53b9bc99ddd45fad29457add438f2aca43d24920793773a96b13610f552
F test/fuzz-oss1.test 514dcabb24687818ea949fa6760229eaacad74ca70157743ef36d35bbe01ffb0
F test/fuzz.test 819ea7e483bcee91209aacbe6f9eaf3287baa1841479ee5f639f57c5e7c42b86
F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1
@@ -1243,7 +1238,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 c2d8a1fd5762bc3bea337360cbd98f481137f533ae9db563a1e581dfbe2901ba
F test/fuzzcheck.c 34a025386f84d818cd3343e69e9d9083091af83153e226d71d4e1c126b5f1dd0
F test/fuzzdata1.db 3e86d9cf5aea68ddb8e27c02d7dfdaa226347426c7eb814918e4d95475bf8517
F test/fuzzdata2.db 128b3feeb78918d075c9b14b48610145a0dd4c8d6f1ca7c2870c7e425f5bf31f
F test/fuzzdata3.db c6586d3e3cef0fbc18108f9bb649aa77bfc38aba
@@ -1255,7 +1250,7 @@ F test/fuzzdata8.db 8f34ae00d8d5d4747dd80983cf46161065e4f78324dcff3c893506ff8db3
F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8
F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14
F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc
F test/fuzzinvariants.c 057e910241d85aa4aaf75cef1a7adc45c632b173288d07d9dbbef4e6bda83d5a
F test/fuzzinvariants.c 3ddfec7f5b970b018f1a982532de905cf180e0c1e48cd653be9365d3e6177625
F test/gcfault.test 4ea410ac161e685f17b19e1f606f58514a2850e806c65b846d05f60d436c5b0d
F test/gencol1.test ceb3163b59cb77f4ad57ae4f01a143ce36b06fdd6a8dab1149235db89979ffd8
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
@@ -1265,8 +1260,8 @@ F test/hidden.test 23c1393a79e846d68fd902d72c85d5e5dcf98711
F test/hook.test 2d89bf9480646feb8093be3a58ea502d6521906779ed960de31dd9c4502c0541
F test/hook2.test b9ff3b8c6519fb67f33192f1afe86e7782ee4ac8
F test/icu.test 8da7d52cd9722c82f33b0466ed915460cb03c23a38f18a9a2d3ff97da9a4a8c0
F test/ieee754.test b0945d12be7d255f3dfa18e2511b17ca37e0edd2b803231c52d05b86c04ab26e
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
F test/ieee754.test 0d3ab84ab2069c9994c833a7cd820ee6037f0cf888e206a4a7fc05f735d5790a
F test/imposter1.test 5a20b2cdeb53e65fc57cdb10a33750bd4ef6259909eaf1972253b9e79f7a3fb2
F test/in.test edf979bff3244b9e47849e2b43886631354c8213791f42da92216f08012141af
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
@@ -1337,7 +1332,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2
F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28
F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b
F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127
F test/joinH.test fd76024ff104baec16417db5cafc0894ad4e0863e70803e63c1bba0322706339
F test/joinH.test 1d2fc3190be68525fd9ce749b9468c40ba2930181e52fb5ee6f836051b38effb
F test/joinI.test fc7d24a2b1e444979b83bd92c30ebb975cebb5b9eae4442ce94969bd8d083053
F test/journal1.test bc61a4228db11bffca118bd358ba4b868524bf080f3532749de6c539656e20fa
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
@@ -1434,7 +1429,7 @@ F test/misc5.test 02fcaf4d42405be02ec975e946270a50b0282dac98c78303ade0d1392839d2
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test d595599972ec0b436985f0f02f243b68500ffc977b9b3194ec66c0866cfddcab
F test/misc8.test 08d2380bc435486b12161521f225043ac2be26f02471c2c1ea4cac0b1548edbd
F test/misuse.test 46d42ffdf375833ea5828796e56f84660344f7548659b493059f152f00e66840
F test/misuse.test 859f37014d9824ca66bd90c36372c08c80c51c9593a7cfa8a31d4f92cd4d5b7f
F test/mjournal.test 28a08d5cb5fb5b5702a46e19176e45e964e0800d1f894677169e79f34030e152
F test/mmap1.test 18de3fd7b70a777af6004ca2feecfcdd3d0be17fa04058e808baf530c94b1a1d
F test/mmap2.test dba452dc7db91e9df10f70bdd73dc4190c7b8ee7b5133b4684f04277ada0b9ac
@@ -1480,7 +1475,7 @@ F test/orderby9.test 87fb9548debcc2cd141c5299002dd94672fa76a3
F test/orderbyA.test df608e59efc2ef50c1eddf1a773b272de3252e9401bfec86d04b52fd973866d5
F test/orderbyB.test 32576c7b138105bc72f7fbf33bd320ca3a7d303641fc939e0e56af6cba884b3d
F test/oserror.test ee3fad06ec8671c4d047c2c92a567fc2e0e8161caaec7edd6d48325c5ac97f30
F test/ossfuzz.c 9636dad2092a05a32110df0ca06713038dd0c43dd89a77dabe4b8b0d71096715
F test/ossfuzz.c b5d232d9717fc999a121c82c4880ae5b9d7fb3ae55d2d87a8da906bc80020906
F test/ossshell.c f125c5bd16e537a2549aa579b328dd1c59905e7ab1338dfc210e755bb7b69f17
F test/ovfl.test 199c482696defceacee8c8e0e0ef36da62726b2f
F test/pager1.test b083c2d5d89df8e979658d9320bfc0b9d50b4ef8ae1d9e115a692ff0b9768393
@@ -1496,7 +1491,7 @@ F test/parser1.test 131f4733472252d53d8ed681115257866f55740ab697fa05900d76604934
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/pendingrace.test e99efc5ab3584da3dfc8cd6a0ec4e5a42214820574f5ea24ee93f1d84655f463
F test/percentile.test 52ba89d6ee6b65f770972b67dace358bab7cdbd532803d3db157845268e789cd
F test/percentile.test eaee1ff3e35d5fe933ac98d927c9a7d2f4f1a1a19ee22e7d45e97a6d9ee32077
F test/permutations.test e6de4f5777f7785737ac3d1d964b8656e5477a134665b2fe8a91884ab9b685b3
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 7d07b7bb76e273215d6a20c4f83c3062cc28976c737ccb70a686025801e86c8f
@@ -1526,13 +1521,13 @@ F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/readonly.test 0d307c335b3421898cfe64a783a376138aa003849b6bff61ee2d21e805bc0051
F test/recover.test c76d05f33f0271fba0f0752170e03b0ab5952dc61dcea7ab3ba40df03c4c42de
F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1
F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed1368b5
F test/regexp2.test 64f9726b2ddc71aea06725fcad53231833d038d58b936d49083ace658b370a13
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/reservebytes.test 6163640b5a5120c0dee6591481e673a0fa0bf0d12d4da7513bad692c1a49a162
F test/resetdb.test 54c06f18bc832ac6d6319e5ab23d5c8dd49fdbeec7c696d791682a8006bd5fc3
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/returning1.test 212cd4111bb941a60abf608f20250db666c21eb1bc4d49217e96c87ff3ab9d1a
F test/returningfault.test ae4c4b5e8745813287a359d9ccdb9d5c883c2e68afb18fb0767937d5de5692a4
F test/returning1.test cd32517148948859db214dd814354597dd40e7489259590fac1a4f7bf44deb97
F test/returningfault.test 5f9649d05680357ab077fa6bad574a3eb3f6e4858a6880b25171be516a4efcda
F test/rollback.test 952c4d805bca96adc2be76f621ea22115fe40b330015af36fcc8028c8547fcee
F test/rollback2.test 3f3a4e20401825017df7e7671e9f31b6de5fae5620c2b9b49917f52f8c160a8f
F test/rollbackfault.test 0e646aeab8840c399cfbfa43daab46fd609cf04a
@@ -1605,10 +1600,10 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21
F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test d41257103cf762e1d43f1d07286ac65ed32c5430a19851029bfe06671f5e19fe
F test/shell2.test ac102ebc0a9ec166257600c4ee8bdefec242163afced295f10b004f4af3fc9dd
F test/shell1.test ebe953d64c937ad42a0f33170ac0d2d2568faae26813fc7a95203756446d54aa
F test/shell2.test ab23f01ea2347e4b72bb2399af7ee82aa00f9c059141749f7c4064abca5ad728
F test/shell3.test 603b448e917537cf77be0f265c05c6f63bc677c63a533c8e96aae923b56f4a0e
F test/shell4.test ad7eee983b5e7f1dd92d8c87bc0f39474086bc32c980c00f3934c54aabc636a2
F test/shell4.test 03593fa7908a55f255916ffeda707cdf55680c777736e3da62b1d78cde0d684d
F test/shell5.test d17e7927ab8b7f720efbdd9b5d05fceb6c3c56c25917901b315400214bf24ef4
F test/shell6.test e3b883b61d4916b6906678a35f9d19054861123ad91b856461e0a456273bdbb8
F test/shell7.test 43fd8e511c533bab5232e95c7b4be93b243451709e89582600d4b6e67693d5c3
@@ -1649,8 +1644,8 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c
F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad
F test/speedtest.tcl 405411356fbc54af15987b7ffeec330a49138f71584220fb8fe1948b2f7ac907 x
F test/speedtest1.c a9b002a7bfed99ba3166c2a9b8ae45a95b4c2d37f891e1637c022f9e1d15e3f9
F test/speedtest.tcl 6b66974d833d35a63d0e9ec344e0ffa92fbbfac83e173556f700a61cb3be96fc x
F test/speedtest1.c 6c01252e66f46de0b6b8d5316e03521e2151782104f3608c10262aa5dce85721
F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e
F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
@@ -1669,7 +1664,7 @@ F test/strict1.test a7f9091603fe71cdc62baab0766684cba12a97ec69bfbb70be965532669c
F test/strict2.test b22c7a98b5000aef937f1990776497f0e979b1a23bc4f63e2d53b00e59b20070
F test/subjournal.test 8d4e2572c0ee9a15549f0d8e40863161295107e52f07a3e8012a2e1fdd093c49
F test/subquery.test 23087f9b1c15ab9cc5231d04946bdebc51db527c95eb9d7434a2222127e17a84
F test/subquery2.test 5f06ec2dbce42a3f595ab1b73b146592f9ce001cd4ff023d887d643d3560c281
F test/subquery2.test ab96ff3fa9c4e3dce0d699f74e61c50250ed4335bc8f400e127707d552a8999e
F test/subselect.test 0966aa8e720224dbd6a5e769a3ec2a723e332303
F test/substr.test a673e3763e247e9b5e497a6cacbaf3da2bd8ec8921c0677145c109f2e633f36b
F test/subtype1.test 96fd2a59bfc845c955b5f339d23b37ef4d50de5f8a04acd1450a68605fa2e3e7
@@ -1684,7 +1679,7 @@ F test/sync.test a619e407ede58a7b6e3e44375328628559fc9695a9c24c47cb5690a866b0031
F test/sync2.test 06152269ed73128782c450c355988fe8dd794d305833af75e1a5e79edd4dae47
F test/syscall.test a067468b43b8cb2305e9f9fe414e5f40c875bb5d2cba5f00b8154396e95fcf37
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
F test/tabfunc01.test 8a484fe8b19fc24844f72ca1ceb7c9ae8c9a6bca000a5c6ccab5d89f5cfbea4a
F test/tabfunc01.test 56eeae736217204bb1d9f9ef38340d48058f809b64249217cf77ff4ba600cc21
F test/table.test e87294bf1c80bfd7792142b84ab32ea5beb4f3f71e535d7fb263a6b2068377bf
F test/tableapi.test e37c33e6be2276e3a96bb54b00eea7f321277115d10e5b30fdb52a112b432750
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@@ -1697,7 +1692,8 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 463ae33b8bf75ac77451df19bd65e7c415c2e9891227c7c9e657d0a2d8e1074a
F test/testrunner.tcl b42f7736968cafc9e69bb5d0b87fc81b375fb4c3f44e19b472cccd91d41a416a x
F test/testloadext.c 862b848783eaed9985fbce46c65cd214664376b549fae252b364d5d1ef350a27
F test/testrunner.tcl 60d7efa1816c5dfc37df3e3454b94b9042c0c8c50b27ae296d4a797cd309ace6 x
F test/testrunner_data.tcl c507a9afa911c03446ed90442ffd4a98aca02882c3d51bd1177c24795674def8
F test/testrunner_estwork.tcl 7927a84327259a32854926f68a75292e33a61e7e052fdbfcb01f18696c99c724
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
@@ -1979,7 +1975,7 @@ F test/wal_common.tcl 204d1721ac13c5e0c7fae6380315b5ab7f4e8423f580d826c5e9df1995
F test/walbak.test 018d4e5a3d45c6298d11b99f09a8ef6876527946
F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434
F test/walblock.test 6bb472e82730e7e4e81395e907a01d8cfc2bd9e1f01f8a9184ca572e2955a4bf
F test/walckptnoop.test 5d40e7959a6ef4bdc7aaf773f86c8f210e2a1e6d0ca5c9ad1389311665741bef
F test/walckptnoop.test b13a2c3140f2c913cfd422d9a224544757d04b8b14ab4c267ab9910467c0b9be
F test/walcksum.test 50e204500eed9c691b6045e467bb2923f49aa93d8adf315e2be135fdb202c1c2
F test/walcrash.test 21038858cc552077b0522f50b0fa87e38139306a
F test/walcrash2.test a0edab4e5390f03b99a790de89aad15d6ec70b36
@@ -2005,10 +2001,10 @@ F test/walsetlk_recover.test adccbffc59e365063a4efd2da6b661ae2fcf15d775b6719fe46
F test/walsetlk_snapshot.test 86d5588380f9927d8fcbbd75133b0a34fddf959378d6823c6f164a390123f70a
F test/walshared.test 42e3808582504878af237ea02c42ca793e8a0efaa19df7df26ac573370dbc7a3
F test/walslow.test 0c51843836c9dcf40a5ac05aa781bfb977b396ee2c872d92bd48b79d5dd9aa23
F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2af51747
F test/walthread.test d562f51a61191ccfab64940df7aa1cef87c902fa5ab742590ef7f859dfe6a44b
F test/walvfs.test e1a6ad0f3c78e98b55c3d5f0889cf366cc0d0a1cb2bccb44ac9ec67384adc4a1
F test/where.test 5087c72d26fd075a1644c8512be9fe18de9bf2d2b0754f7fd9b74a1c6540c4fc
F test/where2.test d7d546b8919ed223fb58a6590de296bcc2d5996478412f00bf865030e4f89b3c
F test/where2.test 52237a8cb27ebbf6583469429bb5733d1b94ac37d09c3dbd0f487952ed0ab3f8
F test/where3.test 4ccb156ae33de86414a52775a6f590a9d60ba2cbc7a93a24fa331b7bcf5b6030
F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8
F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2
@@ -2040,7 +2036,7 @@ F test/win32heap.test 1ec2ce646aee491ec23bfcdfd005b33c79f13bf91467966f374a76ffe7
F test/win32lock.test e56d7a9b6cf9d5f3867c2dd19ff36c5326881e4038c6867610ecb3a9868ea4eb
F test/win32longpath.test 0f9837039b306735c13521c5f25b6ed42937b600dace58e28a3d2f8baf429b6a
F test/win32nolock.test 95854dc0206b8a95e4aee15a76acc082767b38f079b2e24676aed6cbb0f32798
F test/window1.test 2a6970e27fd1084c6ded139b0fcd451e116c63f5df3868fdf10abe037d29bd4d
F test/window1.test b46d28b9698559e66aa4adafd8074b940faee498bf0c4fbdb62548bfcccc67e7
F test/window2.tcl 492c125fa550cda1dd3555768a2303b3effbeceee215293adf8871efc25f1476
F test/window2.test e466a88bd626d66edc3d352d7d7e1d5531e0079b549ba44efb029d1fbff9fd3c
F test/window3.tcl acea6e86a4324a210fd608d06741010ca83ded9fde438341cb978c49928faf03
@@ -2082,8 +2078,8 @@ F test/writecrash.test 13520af28f376bfc8c0bcd130efc1fff20bb165198e8b94cf153f1f75
F test/zeroblob.test 7b74cefc7b281dfa2b07cd237987fbe94b4a2037a7771e9e83f2d5f608b1d99e
F test/zeroblobfault.test 861d8191a0d944dfebb3cb4d2c5b4e46a5a119eaec5a63dd996c2389f8063441
F test/zerodamage.test 9c41628db7e8d9e8a0181e59ea5f189df311a9f6ce99cc376dc461f66db6f8dc
F test/zipfile.test c8a7736312c8eb32ee2808121ca22d885a8724d8df4a23d312ddefddadc7f322
F test/zipfile2.test 6df5f5ef9d247756f7200066f43e7f3f52cffff47f0c02cbefe4ce9c3284cb10
F test/zipfile.test c52db63e31a66ae4245affa3e4e65e302442a87e5fd5f2ad29060bc849a83480
F test/zipfile2.test a577e0775e32ef8972e7d5e9a45bc071a5ae061b5b965a08c9c4b709ad036a25
F test/zipfilefault.test 44d4d7a7f7cca7521d569d7f71026b241d65a6b1757aa409c1a168827edbbc2c
F tool/GetFile.cs 47852aa0d806fe47ed1ac5138bdce7f000fe87aaa7f28107d0cb1e26682aeb44
F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e04534bbf
@@ -2113,14 +2109,14 @@ F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c
F tool/lemon.c 8f6c122e5727cb0e5f302b8efc91489b1947a8d98206d7a1b1cfc0ed685b6e7c
F tool/lempar.c bdffd3b233a4e4e78056c9c01fadd2bb3fe902435abde3bce3d769fdf0d5cca2
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/loadfts.c 63412f9790e5e8538fbde0b4f6db154aaaf80f7a10a01e3c94d14b773a8dd5a6
F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669
F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176
F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a
F tool/mkautoconfamal.sh 647dada5e34c466bef62a4408e1c99a7e5e1922805479dd57944f33f9803f2f8
F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x
F tool/mkctimec.tcl 11c9eda4a8d18c74b79280b30506d832849fd1855e6d9e95e1fd506f1d211c37 x
F tool/mkctimec.tcl 3fb5cad05922f5da61262cb6bcd5868a34e94a49ca8833ae2d7796e7df075576 x
F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559
F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a
F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef
@@ -2130,8 +2126,8 @@ F tool/mkpragmatab.tcl 3801ce32f8c55fe63a3b279f231fb26c2c1a2ea9a09d2dd599239d87a
F tool/mkshellc.tcl bab0a72a68384181a5706712dfdf6815f6526446d4e8aacace2de5e80cda91b2
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mksqlite3c-noext.tcl 351c55256213154cabb051a3c870ef9f4487de905015141ae50dc7578a901b84
F tool/mksqlite3c.tcl f11b63445c4840509248bd4aa151a81aea25d5415fef71943c8d436eba4f3b3c
F tool/mksqlite3h.tcl 7b8de72c29b17b338acde81c389f3af04bf34fd25e96c5f29743d1dd285ed49e
F tool/mksqlite3c.tcl 7a268139158e5deef27a370bc2f8db6ccf100c1ad7ac5e5b23743c0fd354f609
F tool/mksqlite3h.tcl ef6831c97e6e638d2324863e8125306baea239b23defd75da77edffa3b620e81
F tool/mksqlite3internalh.tcl 46ef6ed6ccd3c36e23051109dd25085d8edef3887635cea25afa81c4adf4d4db
F tool/mksrczip.tcl 81efd9974dbb36005383f2cd655520057a2ae5aa85ac2441a80c7c28f803ac52
F tool/mktoolzip.tcl c9f388b2b0751982aef29a0c1d80f7959dbe38065ebb4421c39844e92622b086
@@ -2149,7 +2145,7 @@ F tool/showdb.c 3956d71e5193162609a60e8c9edfcf09274c00cfea2b1d221261427adb2b5cca
F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818
F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564
F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809
F tool/showstat4.c 0682ebea7abf4d3657f53c4a243f2e7eab48eab344ed36a94bb75dcd19a5c2a1
F tool/showstat4.c b706fcbc4cd1a6e4a73ac32549afc4b460479d650402d64b23e8d813516e8de4
F tool/showwal.c 11eca547980a066b081f512636151233350ac679f29ecf4ebfce7f4530230b3d
F tool/soak1.tcl a3892082ed1079671565c044e93b55c3c7f38829aedf53cc597c65d23ffdaddf
F tool/spaceanal.tcl 1f83962090a6b60e1d7bf92495d643e622bef9fe82ea3f2d22350dcbce9a12d0
@@ -2171,12 +2167,14 @@ F tool/tclConfigShToMake.sh 7c065d81c2d178e15e45a77372c6e5a38b5a1b08755301cd6f20
F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003
F tool/vdbe-compress.tcl fa2f37ab39b2a0087fafb6a7f3ce19503e25e624ffa8ed9951717ab72920c088
F tool/vdbe_profile.tcl 3ac5a4a9449f4baf77059358ea050db3e34395ccf59c5464d29b91746d5b961e
F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5
F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6ddf2700c
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 991383262b0d07ebc79fdb6bed448013cea3a0ac13292d5397dce012b1e6a673 fabbc8b6d184d52a513e80fabd900f578424fc8a8055e3d64fac54b9e28ea18a
R 9502f6e7264c20624ab1f1c21d99c7f4
U dan
Z 08204eb82ab90bdace0e9da74500c44d
P 10e11b9c539a8be50fd93bdf7cf5afe97d9757ce8577cac58426a1b218063e47
R ec4161915fdee7c9c786931b31f64669
T +sym-release *
T +sym-version-3.51.2 *
U drh
Z 6e3a819551f499011e2275a586e8d608
# Remove this line to create a well-formed Fossil manifest.

Some files were not shown because too many files have changed in this diff Show More