From 0cd38cd2b9adb966e4ff02596526725311fadf64 Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 01:33:12 +0000
Subject: [PATCH 01/65] Beginnings of a bundler-friendly build of sqlite3.mjs.
Not yet ready for downstream testing.
FossilOrigin-Name: 4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89
---
ext/wasm/GNUmakefile | 88 ++++++++++++++++++++-------
ext/wasm/api/extern-post-js.c-pp.js | 5 ++
ext/wasm/api/pre-js.c-pp.js | 13 ++--
ext/wasm/api/sqlite3-vfs-opfs.c-pp.js | 4 +-
ext/wasm/dist.make | 2 +
manifest | 23 ++++---
manifest.uuid | 2 +-
7 files changed, 98 insertions(+), 39 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index f391868d48..4c2a336f44 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -37,6 +37,15 @@
# - wasm-strip for release builds: https://github.com/WebAssembly/wabt
# - InfoZip for 'dist' zip file
########################################################################
+#
+# Significant TODOs for this build include, but are not necessarily
+# limited to:
+#
+# 1) Consolidate the code generation for sqlite3*.*js into a script
+# which generates the makefile code, rather than using $(call) and
+# $(eval), or at least centralize the setup of the numerous vars
+# related to each build variant (vanilla, esm, bundler-friendly).
+#
SHELL := $(shell which bash 2>/dev/null)
MAKEFILE := $(lastword $(MAKEFILE_LIST))
CLEAN_FILES :=
@@ -228,6 +237,7 @@ CLEAN_FILES += $(2)
endef
c-pp.D.vanilla ?=
c-pp.D.esm ?= -Dtarget=es6-module
+c-pp.D.bundler-friendly ?= -Dtarget=es6-module -Dtarget=es6-bundler-friendly
# /end C-PP.FILTER
########################################################################
@@ -355,9 +365,11 @@ $(sqlite3-api.js.in): $(sqlite3-api.jses) $(MAKEFILE)
# for real-life clients.
sqlite3-api.js := $(dir.dout)/sqlite3-api.js
sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs
+sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs
$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.js)))
$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.mjs), $(c-pp.D.esm)))
-all: $(sqlite3-api.js) $(sqlite3-api.mjs)
+$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api-bundler-friendly.mjs), $(c-pp.D.bundler-friendly)))
+all: $(sqlite3-api.js) $(sqlite3-api.mjs) $(sqlite3-api-bundler-friendly.mjs)
$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
@echo "Making $@..."
@@ -374,7 +386,7 @@ $(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js)
cat $(sqlite3-license-version-header.js); \
echo '/*'; \
echo '** This code was built from sqlite3 version...'; \
- echo "** "; \
+ echo "**"; \
awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \
-e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
echo '*/'; \
@@ -385,13 +397,16 @@ $(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js)
# the generated emscripten module file. The following rules generate
# various versions of those files for the vanilla and ESM builds.
pre-js.js.in := $(dir.api)/pre-js.c-pp.js
-pre-js.js.esm := $(dir.tmp)/pre-js.esm.js
pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js
+pre-js.js.esm := $(dir.tmp)/pre-js.esm.js
+pre-js.js.bundler-friendly := $(dir.tmp)/pre-js.bundler-friendly.js
$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla)))
$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm)))
+$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.bundler-friendly),$(c-pp.D.bundler-friendly)))
post-js.js.in := $(dir.tmp)/post-js.c-pp.js
post-js.js.vanilla := $(dir.tmp)/post-js.vanilla.js
post-js.js.esm := $(dir.tmp)/post-js.esm.js
+post-js.js.bundler-friendly := $(dir.tmp)/post-js.bundler-friendly.js
post-jses.js := \
$(dir.api)/post-js-header.js \
$(sqlite3-api.js.in) \
@@ -405,6 +420,7 @@ $(post-js.js.in): $(post-jses.js) $(MAKEFILE)
done > $@
$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla)))
$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm)))
+$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly)))
# extern-post-js* and extern-pre-js* are files for use with
# Emscripten's --extern-pre-js and --extern-post-js flags. These
@@ -412,8 +428,10 @@ $(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm)))
extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js
extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js
extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js
+extern-post-js.js.bundler-friendly := $(dir.tmp)/extern-post-js.bundler-friendly.js
$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla)))
$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm)))
+$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly)))
extern-pre-js.js := $(dir.api)/extern-pre-js.js
# Emscripten flags for --[extern-][pre|post]-js=... for the
@@ -428,6 +446,10 @@ pre-post-common.flags.esm := \
$(pre-post-common.flags) \
--post-js=$(post-js.js.esm) \
--extern-post-js=$(extern-post-js.js.esm)
+pre-post-common.flags.bundler-friendly := \
+ $(pre-post-common.flags) \
+ --post-js=$(post-js.js.bundler-friendly) \
+ --extern-post-js=$(extern-post-js.js.bundler-friendly)
# pre-post-jses.deps.* = a list of dependencies for the
# --[extern-][pre/post]-js files.
@@ -436,14 +458,16 @@ pre-post-jses.deps.vanilla := $(pre-post-jses.deps.common) \
$(post-js.js.vanilla) $(extern-post-js.js.vanilla)
pre-post-jses.deps.esm := $(pre-post-jses.deps.common) \
$(post-js.js.esm) $(extern-post-js.js.esm)
+pre-post-jses.deps.bundler-friendly := $(pre-post-jses.deps.common) \
+ $(post-js.js.bundler-friendly) $(extern-post-js.js.bundler-friendly)
########################################################################
# call-make-pre-js is a $(call)able which creates rules for
# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf
-# this pre-js is for. $2 is the build mode: one of (vanilla, esm).
-# This sets up --[extern-][pre/post]-js flags in
-# $(pre-post-$(1).flags.$(2)) and dependencies in
-# $(pre-post-$(1).deps.$(2)).
+# this pre-js is for (one of: sqlite3, sqlite3-wasm). $2 is the build
+# mode: one of (vanilla, esm, bundler-friendly). This sets up
+# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and
+# dependencies in $(pre-post-$(1).deps.$(2)).
define call-make-pre-js
pre-post-$(1).flags.$(2) ?=
$$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE)
@@ -595,6 +619,7 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED
sqlite3.js := $(dir.dout)/sqlite3.js
sqlite3.mjs := $(dir.dout)/sqlite3.mjs
+sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs
# Undocumented Emscripten feature: if the target file extension is
# "mjs", it defaults to ES6 module builds:
# https://github.com/emscripten-core/emscripten/issues/14383
@@ -607,13 +632,16 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c
# instead of building a shared copy of sqlite3-wasm.o.
$(eval $(call call-make-pre-js,sqlite3,vanilla))
$(eval $(call call-make-pre-js,sqlite3,esm))
-$(sqlite3.js) $(sqlite3.mjs): $(MAKEFILE) $(sqlite3-wasm.c) \
- $(EXPORTED_FUNCTIONS.api)
+$(eval $(call call-make-pre-js,sqlite3,bundler-friendly))
+$(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs): \
+ $(MAKEFILE) $(sqlite3-wasm.c) $(EXPORTED_FUNCTIONS.api)
$(sqlite3.js): $(pre-post-sqlite3.deps.vanilla)
$(sqlite3.mjs): $(pre-post-sqlite3.deps.esm)
+$(sqlite3-bundler-friendly.mjs): $(pre-post-sqlite3.deps.bundler-friendly)
########################################################################
# SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js)
-# and $(sqlite3.mjs). $1 = one of (vanilla, esm).
+# and $(sqlite3.mjs). $1 = one of (vanilla, esm). $2 must be 1 for
+# ES6-style builds, 0 for other builds.
#
# Reminder for ESM builds: even if we use -sEXPORT_ES6=0, emcc _still_
# adds:
@@ -622,17 +650,18 @@ $(sqlite3.mjs): $(pre-post-sqlite3.deps.esm)
#
# when building *.mjs, which is bad because we need to export an
# overwritten version of that function and cannot "export default"
-# twice. Because of this, we have to sed $(sqlite3.mjs) to remove the
-# _first_ instance (only) of /^export default/.
+# twice. Because of this, we have to sed *.mjs to remove the _first_
+# instance (only) of /^export default/.
#
# Upstream RFE:
# https://github.com/emscripten-core/emscripten/issues/18237
########################################################################
# SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3[-WASMFS].xJS.RECIPE,
-# factored into a separate piece to avoid code duplication. $1 is
-# the build mode: one of (vanilla, esm).
+# factored into a separate piece to avoid code duplication. $1 is 1 if
+# the build mode needs this workaround (esm, bundler-friendly) and 0
+# if not (vanilla).
define SQLITE3.xJS.ESM-EXPORT-DEFAULT
-if [ esm = $(1) ]; then \
+if [ x1 = x$(1) ]; then \
echo "Fragile workaround for an Emscripten annoyance. See SQLITE3.xJS.RECIPE."; \
sed -i -e '0,/^export default/{/^export default/d;}' $@ || exit $$?; \
if ! grep -q '^export default' $@; then \
@@ -647,30 +676,41 @@ define SQLITE3.xJS.RECIPE
$(emcc.jsflags) \
$(pre-post-sqlite3.flags.$(1)) $(emcc.flags.sqlite3.$(1)) \
$(cflags.common) $(SQLITE_OPT) $(sqlite3-wasm.c)
- @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(1))
+ @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2))
+ @if [ bundler-friendly = $(1) ]; then \
+ echo "Patching sqlite3-bundler-friendly.js for sqlite3.wasm..."; \
+ rm -f $(dir.dout)/sqlite3-bundler-friendly.wasm; \
+ sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $@ || exit $$?; \
+ fi
chmod -x $(sqlite3.wasm)
$(maybe-wasm-strip) $(sqlite3.wasm)
@ls -la $@ $(sqlite3.wasm)
endef
emcc.flags.sqlite3.vanilla :=
emcc.flags.sqlite3.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META
+emcc.flags.sqlite3.bundler-friendly := $(emcc.flags.sqlite3.esm)
$(sqlite3.js):
- $(call SQLITE3.xJS.RECIPE,vanilla)
+ $(call SQLITE3.xJS.RECIPE,vanilla,0)
$(sqlite3.mjs):
- $(call SQLITE3.xJS.RECIPE,esm)
+ $(call SQLITE3.xJS.RECIPE,esm,1)
+$(sqlite3-bundler-friendly.mjs):
+ $(call SQLITE3.xJS.RECIPE,bundler-friendly,1)
########################################################################
# We have to ensure that we do not build both $(sqlite3.js) and
# $(sqlite3.mjs) in parallel because both result in the creation of
# $(sqlite3.wasm). We have no(?) way to build just the .mjs file
# without also building the .wasm file. i.e. we're building
-# $(sqlite3.wasm) twice, but that's apparently unavoidable (and
-# harmless, just a waste of build time).
+# $(sqlite3.wasm) multiple times, but that's apparently unavoidable
+# (and harmless, just a waste of build time).
$(sqlite3.wasm): $(sqlite3.js)
$(sqlite3.mjs): $(sqlite3.js)
-CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3.wasm)
-all: $(sqlite3.js) $(sqlite3.mjs)
+$(sqlite3-bundler-friendly.mjs): $(sqlite3.js)
+CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) \
+ $(sqlite3.wasm)
+all: $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs)
quick: $(sqlite3.js)
quick: $(sqlite3.mjs) # for the sake of the snapshot build
+quick: $(sqlite3-bundler-friendly.mjs) # for the sake of the snapshot build
# End main $(sqlite3.js) build
########################################################################
@@ -780,7 +820,7 @@ CLEAN_FILES += $(speedtest1.js) $(speedtest1.wasm)
# 4) Load sqlite3 as an ESM worker. (Not all browsers support this.)
#
# To that end, we require two separate builds of tester1.js:
-#
+#
# tester1.js: cases 1 and 2
# tester1.mjs: cases 3 and 4
#
@@ -790,6 +830,8 @@ $(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.mjs,$(c-pp.D.esm)))
$(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1.html))
$(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1-esm.html,$(c-pp.D.esm)))
tester1: tester1.js tester1.mjs tester1.html tester1-esm.html
+# Note that we do not include $(sqlite3-bundler-friendly.mjs) in this
+# because bundlers are client-specific.
all quick: tester1
########################################################################
diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js
index 2258697944..87d99eabaa 100644
--- a/ext/wasm/api/extern-post-js.c-pp.js
+++ b/ext/wasm/api/extern-post-js.c-pp.js
@@ -105,6 +105,10 @@ const toExportForES6 =
document?.currentScript?.src);
}
}
+//#ifnot target=es6-module
+// Emscripten does not inject these module-loader bits in ES6 module
+// build and including them here breaks JS bundlers, so elide them
+// from ES6 builds.
/* Replace the various module exports performed by the Emscripten
glue... */
if (typeof exports === 'object' && typeof module === 'object'){
@@ -114,6 +118,7 @@ const toExportForES6 =
}
/* AMD modules get injected in a way we cannot override,
so we can't handle those here. */
+//#endif // !target=es6-module
return self.sqlite3InitModule /* required for ESM */;
})();
//#if target=es6-module
diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js
index 2e2fe66bc9..d1ee3be198 100644
--- a/ext/wasm/api/pre-js.c-pp.js
+++ b/ext/wasm/api/pre-js.c-pp.js
@@ -29,7 +29,12 @@ sqlite3InitModuleState.debugModule('self.location =',self.location);
4) If none of the above apply, (prefix+path) is returned.
*/
Module['locateFile'] = function(path, prefix) {
-//#if target=es6-module
+//#if target=es6-bundler-friendly
+ // TEMPORARY KLUDGE to work around a c-pp nested blocks bug which is
+ // currently eluding a fix. We really should have (#ifnot
+ // target=es6-bundler-friendly) around this whole function.
+ return new URL('sqlite3.wasm', import.meta.url).href;
+//#elif target=es6-module
return new URL(path, import.meta.url).href;
//#else
'use strict';
@@ -51,7 +56,7 @@ Module['locateFile'] = function(path, prefix) {
"result =", theFile
);
return theFile;
-//#endif /* SQLITE_JS_EMS */
+//#endif //target=es6-module
}.bind(sqlite3InitModuleState);
/**
@@ -62,7 +67,7 @@ Module['locateFile'] = function(path, prefix) {
In such builds we must disable this.
*/
-const xNameOfInstantiateWasm = true
+const xNameOfInstantiateWasm = false
? 'instantiateWasm'
: 'emscripten-bug-17951';
Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
@@ -102,4 +107,4 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm';
/* 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. */
+ one. *//* END FILE: api/pre-js.js */
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index 2ded905ad5..451f0019c2 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -198,7 +198,9 @@ const installOpfsVfs = function callee(options){
return promiseReject_(err);
};
const W =
-//#if target=es6-module
+//#if target=es6-bundler-friendly
+ new Worker(new URL("sqlite3-opfs-async-proxy.js", import.meta.url));
+//#elif target=es6-module
new Worker(new URL(options.proxyUri, import.meta.url));
//#else
new Worker(options.proxyUri);
diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make
index 8b1a2d4f1c..ffc2613703 100644
--- a/ext/wasm/dist.make
+++ b/ext/wasm/dist.make
@@ -84,6 +84,8 @@ dist: \
> $(dist-dir.jswasm)/$(notdir $(sqlite3.js))
@$(bin.stripccomments) -k -k < $(sqlite3.mjs) \
> $(dist-dir.jswasm)/$(notdir $(sqlite3.mjs))
+ @$(bin.stripccomments) -k -k < $(sqlite3-bundler-friendly.mjs) \
+ > $(dist-dir.jswasm)/$(notdir $(sqlite3-bundler-friendly.mjs))
@cp -p $(dist.common.extras) $(dist-dir.common)
@set -e; \
vnum=$$($(bin.version-info) --download-version); \
diff --git a/manifest b/manifest
index 79a76316b2..cd30a76777 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C End-of-line\swhitespace\scleanups\sand\sdoc\stypo\sfixes.\sNo\scode\schanges.
-D 2023-01-26T20:08:59.766
+C Beginnings\sof\sa\sbundler-friendly\sbuild\sof\ssqlite3.mjs.\sNot\syet\sready\sfor\sdownstream\stesting.
+D 2023-01-27T01:33:12.220
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,17 +466,17 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile 4ce83fdda22c6fde2bd311e87d6bec7469ca3859e758d1f34cd601e64c539efa
+F ext/wasm/GNUmakefile 9685958e3c5942c50f16fadbb0c2377252689c52e022a8c1897ad5c4cf751298
F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54
-F ext/wasm/api/extern-post-js.c-pp.js 8923f76c3d2213159e12d641dc750523ead5c848185dc4996fae5cc12397f88d
+F ext/wasm/api/extern-post-js.c-pp.js 9c1f67c368660cb14b6ddee0ed7c87c70594a41c2a0adc7005016feda6c0cbdb
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
-F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
+F ext/wasm/api/pre-js.c-pp.js 26be645141fe11e614acb1bca777c2e6374680d503a276d96afb9df7939ba5d3
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
@@ -485,7 +485,7 @@ F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
-F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 50e4f6103dc65556e3e040f9e80eb8f14bfc6f979fa018952859f7755e201b27
+F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js a10bdc9695dcf453e120970a5de8a3e61db4e4047d0a7cc5a6d63dfe7ae87f4e
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe
F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
@@ -506,7 +506,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98
F ext/wasm/demo-worker1-promiser.js b99c550763fa792c204e9a7cceadd976004036d9fc3e22fab7051712e30d207d
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa
-F ext/wasm/dist.make 5523b02e824db5ab8176e3eedc2e709fe1204d8f4d6e52e8321cdf6830114b72
+F ext/wasm/dist.make b50668a4f79d4464a59c3378b6b53968bb0652a06737b1e0b07544458de28f3d
F ext/wasm/fiddle.make d5308b5c35f691758ef20badd25f91f3780b20415760daf0d98afbe4f24921b9
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d
@@ -2044,8 +2044,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P f51406e3bf92f2b46f13d08fb7c7fe7683feba68b5a8fa18f6f6b8845662deac
-R c978e0ce582e6e1cfdd4ca23d28f0447
+P bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf
+R 1d25c63e8015d3a2077316f9c5633e5e
+T *branch * js-bundler-friendly
+T *sym-js-bundler-friendly *
+T -sym-trunk * Cancelled\sby\sbranch.
U stephan
-Z 71857224353d5c38a14866ad03e5be27
+Z da3be54ec4b55cd9837defeb06176624
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 1dfea574f9..da2a6bc40e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf
\ No newline at end of file
+4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89
\ No newline at end of file
From 67bfea4ea6fb3bba1425079301727d350132cde0 Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 02:21:16 +0000
Subject: [PATCH 02/65] Resolve a nested if-block bug in ext/wasm/c-pp.c which
caused output after a nested block to be unduly elided. Remove a kludge,
added in the previous check-in, which worked around that bug.
FossilOrigin-Name: 7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601
---
ext/wasm/api/pre-js.c-pp.js | 11 ++++-------
ext/wasm/c-pp.c | 39 +++++++++++++++++++++----------------
manifest | 17 +++++++---------
manifest.uuid | 2 +-
4 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js
index d1ee3be198..772601f428 100644
--- a/ext/wasm/api/pre-js.c-pp.js
+++ b/ext/wasm/api/pre-js.c-pp.js
@@ -10,6 +10,7 @@ const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.create(null
delete self.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('self.location =',self.location);
+//#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
@@ -29,12 +30,7 @@ sqlite3InitModuleState.debugModule('self.location =',self.location);
4) If none of the above apply, (prefix+path) is returned.
*/
Module['locateFile'] = function(path, prefix) {
-//#if target=es6-bundler-friendly
- // TEMPORARY KLUDGE to work around a c-pp nested blocks bug which is
- // currently eluding a fix. We really should have (#ifnot
- // target=es6-bundler-friendly) around this whole function.
- return new URL('sqlite3.wasm', import.meta.url).href;
-//#elif target=es6-module
+//#if target=es6-module
return new URL(path, import.meta.url).href;
//#else
'use strict';
@@ -58,6 +54,7 @@ Module['locateFile'] = function(path, prefix) {
return theFile;
//#endif //target=es6-module
}.bind(sqlite3InitModuleState);
+//#endif //ifnot target=es6-bundler-friendly
/**
Bug warning: a custom Module.instantiateWasm() does not work
@@ -107,4 +104,4 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm';
/* 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. *//* END FILE: api/pre-js.js */
+ one. */
diff --git a/ext/wasm/c-pp.c b/ext/wasm/c-pp.c
index 881c009acb..c439a0d091 100644
--- a/ext/wasm/c-pp.c
+++ b/ext/wasm/c-pp.c
@@ -51,10 +51,10 @@
**
** Design note: this code makes use of sqlite3. Though not _strictly_
** needed in order to implement it, this tool was specifically created
-** for potential use with the sqlite3 project's own JavaScript code,
-** so there's no reason not to make use of it to do some of the heavy
-** lifting. It does not require any cutting-edge sqlite3 features and
-** should be usable with any version which supports `WITHOUT ROWID`.
+** for use with the sqlite3 project's own JavaScript code, so there's
+** no reason not to make use of it to do some of the heavy lifting. It
+** does not require any cutting-edge sqlite3 features and should be
+** usable with any version which supports `WITHOUT ROWID`.
**
** Author(s):
**
@@ -603,18 +603,9 @@ void g_stderr(char const *zFmt, ...){
va_end(va);
}
-#if 0
-void cmpp_t_outf(CmppTokenizer * t, char const *zFmt, ...){
- if(!CT_skip(t)){
- va_list va;
- va_start(va, zFmt);
- vfprintf(g.out.pFile, zFmt, va);
- va_end(va);
- }
-}
-#endif
-
void cmpp_t_out(CmppTokenizer * t, void const *z, unsigned int n){
+ g_debug(3,("CT_skipLevel() ?= %d\n",CT_skipLevel(t)));
+ g_debug(3,("CT_skip() ?= %d\n",CT_skip(t)));
if(!CT_skip(t)){
if(1!=fwrite(z, n, 1, g.out.pFile)){
int const err = errno;
@@ -631,18 +622,28 @@ void CmppLevel_push(CmppTokenizer * const t){
g.zDelim, CmppLevel_Max);
}
pPrev = &CT_level(t);
+ g_debug(3,("push from tokenizer level=%u flags=%04x\n", t->level.ndx, pPrev->flags));
p = &t->level.stack[++t->level.ndx];
*p = CmppLevel_empty;
p->token = t->token;
p->flags = (CmppLevel_F_INHERIT_MASK & pPrev->flags);
if(CLvl_skip(pPrev)) p->flags |= CmppLevel_F_ELIDE;
+ g_debug(3,("push to tokenizer level=%u flags=%04x\n", t->level.ndx, p->flags));
}
void CmppLevel_pop(CmppTokenizer * const t){
if(!t->level.ndx){
fatal("Internal error: CmppLevel_pop() at the top of the stack");
}
+ g_debug(3,("pop from tokenizer level=%u, flags=%04x skipLevel?=%d\n", t->level.ndx,
+ t->level.stack[t->level.ndx].flags, CT_skipLevel(t)));
+ g_debug(3,("CT_skipLevel() ?= %d\n",CT_skipLevel(t)));
+ g_debug(3,("CT_skip() ?= %d\n",CT_skip(t)));
t->level.stack[t->level.ndx--] = CmppLevel_empty;
+ g_debug(3,("pop to tokenizer level=%u, flags=%04x\n", t->level.ndx,
+ t->level.stack[t->level.ndx].flags));
+ g_debug(3,("CT_skipLevel() ?= %d\n",CT_skipLevel(t)));
+ g_debug(3,("CT_skip() ?= %d\n",CT_skip(t)));
}
CmppLevel * CmppLevel_get(CmppTokenizer * const t){
@@ -776,7 +777,7 @@ int db_define_has(const char * zName){
assert(SQLITE_DONE==rc);
rc = 0;
}
- g_debug(1,("define has [%s] = %d\n",zName, rc));
+ g_debug(1,("defined [%s] ?= %d\n",zName, rc));
sqlite3_clear_bindings(g.stmt.defHas);
sqlite3_reset(g.stmt.defHas);
return rc;
@@ -1220,10 +1221,11 @@ static void cmpp_kwd_if(CmppKeyword const * pKw, CmppTokenizer *t){
if(TT_IfNot==pKw->ttype || TT_ElifNot==pKw->ttype) buul = !buul;
if(buul){
CT_pstate(t) = tmpState = TS_IfPassed;
- CT_skipLevel(t) = 0;
+ CT_skipLevel(t) = 0;
}else{
CT_pstate(t) = TS_If /* also for TT_IfNot, TT_Elif, TT_ElifNot */;
CT_skipLevel(t) = 1;
+ g_debug(3,("setting CT_skipLevel = 1 @ level %d\n", t->level.ndx));
}
if(TT_If==pKw->ttype || TT_IfNot==pKw->ttype){
unsigned const lvlIf = t->level.ndx;
@@ -1234,10 +1236,13 @@ static void cmpp_kwd_if(CmppKeyword const * pKw, CmppTokenizer *t){
assert(TT_EndIf == t->token.ttype);
break;
}
+#if 0
if(TS_IfPassed==tmpState){
tmpState = TS_Start;
t->level.stack[lvlIf].flags |= CmppLevel_F_ELIDE;
+ g_debug(1,("Setting ELIDE for TS_IfPassed @ lv %d (lvlIf=%d)\n", t->level.ndx, lvlIf));
}
+#endif
}
if(lvlIf <= t->level.ndx){
cmpp_kwd__err_prefix(pKw, t, NULL);
diff --git a/manifest b/manifest
index cd30a76777..b13782660d 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Beginnings\sof\sa\sbundler-friendly\sbuild\sof\ssqlite3.mjs.\sNot\syet\sready\sfor\sdownstream\stesting.
-D 2023-01-27T01:33:12.220
+C Resolve\sa\snested\sif-block\sbug\sin\sext/wasm/c-pp.c\swhich\scaused\soutput\safter\sa\snested\sblock\sto\sbe\sunduly\selided.\sRemove\sa\skludge,\sadded\sin\sthe\sprevious\scheck-in,\swhich\sworked\saround\sthat\sbug.
+D 2023-01-27T02:21:16.305
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -476,7 +476,7 @@ F ext/wasm/api/extern-post-js.c-pp.js 9c1f67c368660cb14b6ddee0ed7c87c70594a41c2a
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
-F ext/wasm/api/pre-js.c-pp.js 26be645141fe11e614acb1bca777c2e6374680d503a276d96afb9df7939ba5d3
+F ext/wasm/api/pre-js.c-pp.js 109d3afcdf6203a39fe79a2d7e0e1e5f93ea672ae00578fd4ec4f6fe19b484cc
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
@@ -492,7 +492,7 @@ F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52af
F ext/wasm/api/sqlite3-worker1.js 9d3d3dfc70bff8998c1d8ff6d881cf1c3d52468d635417f02796151fe6b31cd7
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e
-F ext/wasm/c-pp.c 92285f7bce67ed7b7020b40fde8ed0982c442b63dc33df9dfd4b658d4a6c0779
+F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
@@ -2044,11 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf
-R 1d25c63e8015d3a2077316f9c5633e5e
-T *branch * js-bundler-friendly
-T *sym-js-bundler-friendly *
-T -sym-trunk * Cancelled\sby\sbranch.
+P 4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89
+R 94f2cf8a092efa28759f003587a957ce
U stephan
-Z da3be54ec4b55cd9837defeb06176624
+Z 16fc9ca50b1409b7eeea4546395ed5b7
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index da2a6bc40e..a9f598354e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89
\ No newline at end of file
+7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601
\ No newline at end of file
From a0013fbe879fb59843c69610af56b5b9141c9614 Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 03:18:16 +0000
Subject: [PATCH 03/65] More work on creating a separate sqlite3.js build which
is hopefully friendly to JS bundlers.
FossilOrigin-Name: b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
---
ext/wasm/GNUmakefile | 4 +++-
ext/wasm/api/extern-post-js.c-pp.js | 15 ++++++++++++---
ext/wasm/api/pre-js.c-pp.js | 5 ++++-
ext/wasm/api/sqlite3-vfs-opfs.c-pp.js | 21 ++++++++++++++-------
ext/wasm/api/sqlite3-worker1-promiser.js | 4 ++++
ext/wasm/api/sqlite3-worker1.js | 4 ++++
manifest | 22 +++++++++++-----------
manifest.uuid | 2 +-
8 files changed, 53 insertions(+), 24 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index 4c2a336f44..fa46c9633a 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -704,7 +704,9 @@ $(sqlite3-bundler-friendly.mjs):
# (and harmless, just a waste of build time).
$(sqlite3.wasm): $(sqlite3.js)
$(sqlite3.mjs): $(sqlite3.js)
-$(sqlite3-bundler-friendly.mjs): $(sqlite3.js)
+$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs)
+# maintenance reminder: the deps on ^^^ must all be such that they are
+# never built in parallel.
CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) \
$(sqlite3.wasm)
all: $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs)
diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js
index 87d99eabaa..691ad76858 100644
--- a/ext/wasm/api/extern-post-js.c-pp.js
+++ b/ext/wasm/api/extern-post-js.c-pp.js
@@ -45,14 +45,23 @@ const toExportForES6 =
moduleScript: self?.document?.currentScript,
isWorker: ('undefined' !== typeof WorkerGlobalScope),
location: self.location,
- urlParams: new URL(self.location.href).searchParams
+ urlParams:
+//#if target=es6-bundler-friendly
+ undefined
+//#else
+ new URL(self.location.href).searchParams
+//#endif
});
initModuleState.debugModule =
- (new URL(self.location.href).searchParams).has('sqlite3.debugModule')
+//#if target=es6-bundler-friendly
+ ()=>{}
+//#else
+ (new URL(self.location.href).searchParams).has('sqlite3.debugModule')
? (...args)=>console.warn('sqlite3.debugModule:',...args)
: ()=>{};
+//#endif
- if(initModuleState.urlParams.has('sqlite3.dir')){
+ if(initModuleState.urlParams && initModuleState.urlParams.has('sqlite3.dir')){
initModuleState.sqlite3Dir = initModuleState.urlParams.get('sqlite3.dir') +'/';
}else if(initModuleState.moduleScript){
const li = initModuleState.moduleScript.src.split('/');
diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js
index 772601f428..c27c2fe0dc 100644
--- a/ext/wasm/api/pre-js.c-pp.js
+++ b/ext/wasm/api/pre-js.c-pp.js
@@ -6,7 +6,10 @@
*/
// See notes in extern-post-js.js
-const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.create(null);
+const sqlite3InitModuleState = self.sqlite3InitModuleState
+ || Object.assign(Object.create(null),{
+ debugModule: ()=>{}
+ });
delete self.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('self.location =',self.location);
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index 451f0019c2..aeda62aa2e 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -100,13 +100,20 @@ const installOpfsVfs = function callee(options){
if(!options || 'object'!==typeof options){
options = Object.create(null);
}
- const urlParams = new URL(self.location.href).searchParams;
- if(undefined===options.verbose){
- options.verbose = urlParams.has('opfs-verbose')
- ? (+urlParams.get('opfs-verbose') || 2) : 1;
- }
- if(undefined===options.sanityChecks){
- options.sanityChecks = urlParams.has('opfs-sanity-check');
+ const urlParams =
+//#if target=es6-bundler-friendly
+ undefined;
+//#else
+ new URL(self.location.href).searchParams;
+//#endif
+ if(urlParams){
+ if(undefined===options.verbose){
+ options.verbose = urlParams.has('opfs-verbose')
+ ? (+urlParams.get('opfs-verbose') || 2) : 1;
+ }
+ if(undefined===options.sanityChecks){
+ options.sanityChecks = urlParams.has('opfs-sanity-check');
+ }
}
if(undefined===options.proxyUri){
options.proxyUri = callee.defaultProxyUri;
diff --git a/ext/wasm/api/sqlite3-worker1-promiser.js b/ext/wasm/api/sqlite3-worker1-promiser.js
index 7360512d49..1689d34802 100644
--- a/ext/wasm/api/sqlite3-worker1-promiser.js
+++ b/ext/wasm/api/sqlite3-worker1-promiser.js
@@ -238,6 +238,9 @@ self.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
}/*sqlite3Worker1Promiser()*/;
self.sqlite3Worker1Promiser.defaultConfig = {
worker: function(){
+//#if target=es6-bundler-friendly
+ return new Worker("sqlite3-worker1.js");
+//#else
let theJs = "sqlite3-worker1.js";
if(this.currentScript){
const src = this.currentScript.src.split('/');
@@ -252,6 +255,7 @@ self.sqlite3Worker1Promiser.defaultConfig = {
}
}
return new Worker(theJs + self.location.search);
+//#endif
}.bind({
currentScript: self?.document?.currentScript
}),
diff --git a/ext/wasm/api/sqlite3-worker1.js b/ext/wasm/api/sqlite3-worker1.js
index 4ff19b8880..9e9c3ac426 100644
--- a/ext/wasm/api/sqlite3-worker1.js
+++ b/ext/wasm/api/sqlite3-worker1.js
@@ -33,6 +33,9 @@
*/
"use strict";
(()=>{
+//#if target=es6-bundler-friendly
+ importScripts('sqlite3.js');
+//#else
const urlParams = new URL(self.location.href).searchParams;
let theJs = 'sqlite3.js';
if(urlParams.has('sqlite3.dir')){
@@ -40,6 +43,7 @@
}
//console.warn("worker1 theJs =",theJs);
importScripts(theJs);
+//#endif
sqlite3InitModule().then((sqlite3)=>{
sqlite3.initWorker1API();
});
diff --git a/manifest b/manifest
index b13782660d..aecad7464c 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Resolve\sa\snested\sif-block\sbug\sin\sext/wasm/c-pp.c\swhich\scaused\soutput\safter\sa\snested\sblock\sto\sbe\sunduly\selided.\sRemove\sa\skludge,\sadded\sin\sthe\sprevious\scheck-in,\swhich\sworked\saround\sthat\sbug.
-D 2023-01-27T02:21:16.305
+C More\swork\son\screating\sa\sseparate\ssqlite3.js\sbuild\swhich\sis\shopefully\sfriendly\sto\sJS\sbundlers.
+D 2023-01-27T03:18:16.304
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,17 +466,17 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile 9685958e3c5942c50f16fadbb0c2377252689c52e022a8c1897ad5c4cf751298
+F ext/wasm/GNUmakefile e1bd4abe13929dbc4fd9da06d189c61d28fc7a539b2cab942f6300172539d8a5
F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54
-F ext/wasm/api/extern-post-js.c-pp.js 9c1f67c368660cb14b6ddee0ed7c87c70594a41c2a0adc7005016feda6c0cbdb
+F ext/wasm/api/extern-post-js.c-pp.js ea549ffcdd3f116de5b4cc08a428e0a91052c341b51b37f158747285f9ef2fe8
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
-F ext/wasm/api/pre-js.c-pp.js 109d3afcdf6203a39fe79a2d7e0e1e5f93ea672ae00578fd4ec4f6fe19b484cc
+F ext/wasm/api/pre-js.c-pp.js 86b2909e07690792ecf14892e6ee4d2ea0b2d6bf8567ad3d549a8cc2e30828a0
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
@@ -485,11 +485,11 @@ F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
-F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js a10bdc9695dcf453e120970a5de8a3e61db4e4047d0a7cc5a6d63dfe7ae87f4e
+F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js bae9c4c40991a550450bb89dc34e6e1e1e875ae230ccdce3dbb99515517d3361
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe
-F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
-F ext/wasm/api/sqlite3-worker1.js 9d3d3dfc70bff8998c1d8ff6d881cf1c3d52468d635417f02796151fe6b31cd7
+F ext/wasm/api/sqlite3-worker1-promiser.js f10c3ecd9df06f6320073c2ce230a7ed7c56034d8b88c1e57095f2a97faf423a
+F ext/wasm/api/sqlite3-worker1.js 77b3835192469e9da23926ec8f78fb0b114a51d048dc54388709ac22b5c5f0a0
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e
F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 4271bf5f41df091696f1dcfc4ffe7a60d24066fc75c896941e0b56de95fe5f89
-R 94f2cf8a092efa28759f003587a957ce
+P 7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601
+R 102faa857a2d0d2c23a0f1e8d23a4eac
U stephan
-Z 16fc9ca50b1409b7eeea4546395ed5b7
+Z 7417462f84e9f6b455bd391f77e8f338
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index a9f598354e..91de4dbda9 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601
\ No newline at end of file
+b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
\ No newline at end of file
From c64a3fa6c626aa56809592cd8f4fcef21d3300ad Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 05:14:34 +0000
Subject: [PATCH 04/65] Work around upstream emscripten 3.1.31 bug
[https://github.com/emscripten-core/emscripten/issues/18609].
FossilOrigin-Name: fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a
---
ext/wasm/api/sqlite3-api-worker1.js | 14 +++++++-------
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/ext/wasm/api/sqlite3-api-worker1.js b/ext/wasm/api/sqlite3-api-worker1.js
index 250b6fcdf7..58b9b00918 100644
--- a/ext/wasm/api/sqlite3-api-worker1.js
+++ b/ext/wasm/api/sqlite3-api-worker1.js
@@ -1,4 +1,4 @@
-/*
+/**
2022-07-22
The author disclaims copyright to this source code. In place of a
@@ -10,12 +10,12 @@
***********************************************************************
- This file implements the initializer for the sqlite3 "Worker API
- #1", a very basic DB access API intended to be scripted from a main
- window thread via Worker-style messages. Because of limitations in
- that type of communication, this API is minimalistic and only
- capable of serving relatively basic DB requests (e.g. it cannot
- process nested query loops concurrently).
+ This file implements the initializer for SQLite's "Worker API #1", a
+ very basic DB access API intended to be scripted from a main window
+ thread via Worker-style messages. Because of limitations in that
+ type of communication, this API is minimalistic and only capable of
+ serving relatively basic DB requests (e.g. it cannot process nested
+ query loops concurrently).
This file requires that the core C-style sqlite3 API and OO API #1
have been loaded.
diff --git a/manifest b/manifest
index aecad7464c..fc03db56d3 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C More\swork\son\screating\sa\sseparate\ssqlite3.js\sbuild\swhich\sis\shopefully\sfriendly\sto\sJS\sbundlers.
-D 2023-01-27T03:18:16.304
+C Work\saround\supstream\semscripten\s3.1.31\sbug\s[https://github.com/emscripten-core/emscripten/issues/18609].
+D 2023-01-27T05:14:34.038
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -481,7 +481,7 @@ F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a
-F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e3cc6f22acf81794d32fc0b
+F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 7a026a4b24d57c1b0970923b972dd42c3f1bb5b282f908079075468b2e1bf601
-R 102faa857a2d0d2c23a0f1e8d23a4eac
+P b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
+R 652518ccc6e34aeabd9f5e7c9c0f903b
U stephan
-Z 7417462f84e9f6b455bd391f77e8f338
+Z 9f5aabec0ec6e83053759380211a0e0c
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 91de4dbda9..1ff4d9398a 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
\ No newline at end of file
+fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a
\ No newline at end of file
From 9dc093d095646688dfa35ea19497fc8429793e3b Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 07:53:49 +0000
Subject: [PATCH 05/65] Work around a JS null pointer deref which could be
triggered from the dev console, but not (it seems) from client-side code.
FossilOrigin-Name: eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f
---
ext/wasm/api/pre-js.c-pp.js | 4 +++-
manifest | 13 ++++++-------
manifest.uuid | 2 +-
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js
index 2e2fe66bc9..5d8e58864b 100644
--- a/ext/wasm/api/pre-js.c-pp.js
+++ b/ext/wasm/api/pre-js.c-pp.js
@@ -6,7 +6,9 @@
*/
// See notes in extern-post-js.js
-const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.create(null);
+const sqlite3InitModuleState = self.sqlite3InitModuleState || Object.assign(Object.create(null),{
+ debugModule: ()=>{}
+});
delete self.sqlite3InitModuleState;
sqlite3InitModuleState.debugModule('self.location =',self.location);
diff --git a/manifest b/manifest
index f9d1a9c1c5..51290c24c5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Cherrypick\s[fa784101775b7|emscripten\sticket\s#18609\sworkaround]\sinto\strunk.
-D 2023-01-27T05:17:10.270
+C Work\saround\sa\sJS\snull\spointer\sderef\swhich\scould\sbe\striggered\sfrom\sthe\sdev\sconsole,\sbut\snot\s(it\sseems)\sfrom\sclient-side\scode.
+D 2023-01-27T07:53:49.223
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -476,7 +476,7 @@ F ext/wasm/api/extern-post-js.c-pp.js 8923f76c3d2213159e12d641dc750523ead5c84818
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
-F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
+F ext/wasm/api/pre-js.c-pp.js f060b108d0960798c0aa0688392a3c1a58a2e3c942f3560de1c4a7a1aa7af433
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
@@ -2044,9 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P bdfd72a083fadd724030c4c89adae71426e1ddd402c6bc5abf40801ecf3253cf
-Q +fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a
-R f546cb30f93859da1452256662a169a1
+P 9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932
+R 560e84c2bc8da2b503677492471b2550
U stephan
-Z 2937fe2d7bb3aa79ea588267ef9524d2
+Z 0160fcb66fc2ca1e2a8d2a4c14f5953b
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index ca24ae6feb..1b37954ec2 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932
\ No newline at end of file
+eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f
\ No newline at end of file
From aca8ce1535dcd030ac994a306e78b7588ffe95ac Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 17:14:55 +0000
Subject: [PATCH 06/65] Extract emcc version in JS build and use it to
conditionally set build flags. Initially a workaround for
[https://github.com/emscripten-core/emscripten/issues/18610|Emscripten ticket
#18610] but may have other uses.
FossilOrigin-Name: 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
---
ext/wasm/GNUmakefile | 16 ++++++++++++++--
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index fa46c9633a..143ee8b9f1 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -59,6 +59,13 @@ emcc.bin ?= $(word 1,$(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc) $(shell
ifeq (,$(emcc.bin))
$(error Cannot find emcc.)
endif
+emcc.version := $(shell "$(emcc.bin)" --version | sed -n 1p \
+ | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;')
+ifeq (,$(emcc.version))
+ $(warning Cannot determine emcc version. This might unduly impact build flags.)
+else
+ $(info using emcc version [$(emcc.version)])
+endif
wasm-strip ?= $(shell which wasm-strip 2>/dev/null)
ifeq (,$(filter clean,$(MAKECMDGOALS)))
@@ -501,7 +508,6 @@ emcc.cflags :=
emcc.cflags += -std=c99 -fPIC
# -------------^^^^^^^^ we need c99 for $(sqlite3-wasm.c).
emcc.cflags += -I. -I$(dir.top)
-
########################################################################
# emcc flags specific to building .js/.wasm files...
emcc.jsflags := -fPIC
@@ -509,7 +515,6 @@ emcc.jsflags += --minify 0
emcc.jsflags += --no-entry
emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
emcc.jsflags += -sMODULARIZE
-emcc.jsflags += -sSTRICT_JS
emcc.jsflags += -sDYNAMIC_EXECUTION=0
emcc.jsflags += -sNO_POLYFILL
emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api)
@@ -519,6 +524,13 @@ emcc.exportedRuntimeMethods := \
emcc.jsflags += $(emcc.exportedRuntimeMethods)
emcc.jsflags += -sUSE_CLOSURE_COMPILER=0
emcc.jsflags += -sIMPORTED_MEMORY
+ifeq (3.1.31,$(emcc.version))
+ emcc.jsflags += -sSTRICT_JS=0
+ $(warning Disabling -sSTRICT_JS for emcc $(emcc.version): \
+ https://github.com/emscripten-core/emscripten/issues/18610)
+else
+ emcc.jsflags += -sSTRICT_JS=1
+endif
emcc.environment := -sENVIRONMENT=web,worker
########################################################################
# -sINITIAL_MEMORY: How much memory we need to start with is governed
diff --git a/manifest b/manifest
index fc03db56d3..fd21e7b6dc 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Work\saround\supstream\semscripten\s3.1.31\sbug\s[https://github.com/emscripten-core/emscripten/issues/18609].
-D 2023-01-27T05:14:34.038
+C Extract\semcc\sversion\sin\sJS\sbuild\sand\suse\sit\sto\sconditionally\sset\sbuild\sflags.\sInitially\sa\sworkaround\sfor\s[https://github.com/emscripten-core/emscripten/issues/18610|Emscripten\sticket\s#18610]\sbut\smay\shave\sother\suses.
+D 2023-01-27T17:14:55.199
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile e1bd4abe13929dbc4fd9da06d189c61d28fc7a539b2cab942f6300172539d8a5
+F ext/wasm/GNUmakefile 31cf62436f306eed8c8aa66991653395f62e52af7ad21a0de02f7d780cb8c398
F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
-R 652518ccc6e34aeabd9f5e7c9c0f903b
+P fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a
+R 3675add13eb3ce53caed9c7b4b0b8fb4
U stephan
-Z 9f5aabec0ec6e83053759380211a0e0c
+Z e36df8532ba6c8eb3243e966cb4c4025
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 1ff4d9398a..df7e52ee6d 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a
\ No newline at end of file
+3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
\ No newline at end of file
From cf73cb2fbc2a552bc66d7f0caabfeddf46cb29bd Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 17:19:30 +0000
Subject: [PATCH 07/65] Cherrypick [3773934e91c20ca243] into trunk.
FossilOrigin-Name: 50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d
---
ext/wasm/GNUmakefile | 16 ++++++++++++++--
manifest | 13 +++++++------
manifest.uuid | 2 +-
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index f391868d48..eef6902d62 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -50,6 +50,13 @@ emcc.bin ?= $(word 1,$(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc) $(shell
ifeq (,$(emcc.bin))
$(error Cannot find emcc.)
endif
+emcc.version := $(shell "$(emcc.bin)" --version | sed -n 1p \
+ | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;')
+ifeq (,$(emcc.version))
+ $(warning Cannot determine emcc version. This might unduly impact build flags.)
+else
+ $(info using emcc version [$(emcc.version)])
+endif
wasm-strip ?= $(shell which wasm-strip 2>/dev/null)
ifeq (,$(filter clean,$(MAKECMDGOALS)))
@@ -477,7 +484,6 @@ emcc.cflags :=
emcc.cflags += -std=c99 -fPIC
# -------------^^^^^^^^ we need c99 for $(sqlite3-wasm.c).
emcc.cflags += -I. -I$(dir.top)
-
########################################################################
# emcc flags specific to building .js/.wasm files...
emcc.jsflags := -fPIC
@@ -485,7 +491,6 @@ emcc.jsflags += --minify 0
emcc.jsflags += --no-entry
emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
emcc.jsflags += -sMODULARIZE
-emcc.jsflags += -sSTRICT_JS
emcc.jsflags += -sDYNAMIC_EXECUTION=0
emcc.jsflags += -sNO_POLYFILL
emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api)
@@ -495,6 +500,13 @@ emcc.exportedRuntimeMethods := \
emcc.jsflags += $(emcc.exportedRuntimeMethods)
emcc.jsflags += -sUSE_CLOSURE_COMPILER=0
emcc.jsflags += -sIMPORTED_MEMORY
+ifeq (3.1.31,$(emcc.version))
+ emcc.jsflags += -sSTRICT_JS=0
+ $(warning Disabling -sSTRICT_JS for emcc $(emcc.version): \
+ https://github.com/emscripten-core/emscripten/issues/18610)
+else
+ emcc.jsflags += -sSTRICT_JS=1
+endif
emcc.environment := -sENVIRONMENT=web,worker
########################################################################
# -sINITIAL_MEMORY: How much memory we need to start with is governed
diff --git a/manifest b/manifest
index 51290c24c5..25fd792232 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Work\saround\sa\sJS\snull\spointer\sderef\swhich\scould\sbe\striggered\sfrom\sthe\sdev\sconsole,\sbut\snot\s(it\sseems)\sfrom\sclient-side\scode.
-D 2023-01-27T07:53:49.223
+C Cherrypick\s[3773934e91c20ca243]\sinto\strunk.
+D 2023-01-27T17:19:30.435
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile 4ce83fdda22c6fde2bd311e87d6bec7469ca3859e758d1f34cd601e64c539efa
+F ext/wasm/GNUmakefile 217dcb2e3058d7554c46a6e8c89fdb28006c2278206e3e9572ce52030736a5a6
F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
@@ -2044,8 +2044,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932
-R 560e84c2bc8da2b503677492471b2550
+P eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f
+Q +3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
+R 1cf9f93fc162d1085b11c39fbf5b9e62
U stephan
-Z 0160fcb66fc2ca1e2a8d2a4c14f5953b
+Z 35eb683fd2e66a13e0456c98ff3a4371
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 1b37954ec2..f4626601bf 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f
\ No newline at end of file
+50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d
\ No newline at end of file
From 6a3e2d377607ac7a8a3584a34ed7c22b665daacb Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 19:56:40 +0000
Subject: [PATCH 08/65] Add a feature idea note to DB.exec(), derived from a
forum discussion.
FossilOrigin-Name: 792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db
---
ext/wasm/api/sqlite3-api-oo1.js | 5 ++++-
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js
index ba210e7f99..fddd7b38e3 100644
--- a/ext/wasm/api/sqlite3-api-oo1.js
+++ b/ext/wasm/api/sqlite3-api-oo1.js
@@ -183,7 +183,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
checkSqlite3Rc(
pDb, capi.sqlite3_exec(pDb, postInitSql, 0, 0, 0)
);
- }
+ }
}catch(e){
this.close();
throw e;
@@ -791,6 +791,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
- `callback` and `resultRows`: permit an array entries with
semantics similar to those described for `bind` above.
+ - If passed neither a callback nor returnValue but is passed a
+ rowMode, default to returning the result set.
+
*/
exec: function(/*(sql [,obj]) || (obj)*/){
affirmDbOpen(this);
diff --git a/manifest b/manifest
index fd21e7b6dc..c19a076175 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Extract\semcc\sversion\sin\sJS\sbuild\sand\suse\sit\sto\sconditionally\sset\sbuild\sflags.\sInitially\sa\sworkaround\sfor\s[https://github.com/emscripten-core/emscripten/issues/18610|Emscripten\sticket\s#18610]\sbut\smay\shave\sother\suses.
-D 2023-01-27T17:14:55.199
+C Add\sa\sfeature\sidea\snote\sto\sDB.exec(),\sderived\sfrom\sa\sforum\sdiscussion.
+D 2023-01-27T19:56:40.990
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b
F ext/wasm/api/pre-js.c-pp.js 86b2909e07690792ecf14892e6ee4d2ea0b2d6bf8567ad3d549a8cc2e30828a0
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
-F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
+F ext/wasm/api/sqlite3-api-oo1.js a3892fd79070d8c947205d8b90d8218cdb12e7fd5027dced5805dd387b590a36
F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a
F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a
-R 3675add13eb3ce53caed9c7b4b0b8fb4
+P 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
+R c10dcf005f6c888521bd65824a3df6ca
U stephan
-Z e36df8532ba6c8eb3243e966cb4c4025
+Z 96645cafa741bd6b03c389427ea21748
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index df7e52ee6d..60da4aa3a1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
\ No newline at end of file
+792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db
\ No newline at end of file
From 844e7183ae9a373d8c7cefc3b667bff030f03108 Mon Sep 17 00:00:00 2001
From: dan
Date: Fri, 27 Jan 2023 19:59:46 +0000
Subject: [PATCH 09/65] Do not try to run rbu tests with builds that do not
support rbu.
FossilOrigin-Name: c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494
---
ext/rbu/rbu1.test | 1 +
ext/rbu/rbu10.test | 7 +--
ext/rbu/rbu11.test | 6 +--
ext/rbu/rbu12.test | 6 +--
ext/rbu/rbu13.test | 6 +--
ext/rbu/rbu14.test | 6 +--
ext/rbu/rbu3.test | 6 +--
ext/rbu/rbu5.test | 1 +
ext/rbu/rbu6.test | 6 +--
ext/rbu/rbu7.test | 6 +--
ext/rbu/rbu8.test | 6 +--
ext/rbu/rbu9.test | 6 +--
ext/rbu/rbuA.test | 6 +--
ext/rbu/rbuB.test | 1 +
ext/rbu/rbuC.test | 1 +
ext/rbu/rbubusy.test | 1 +
ext/rbu/rbucollate.test | 1 +
ext/rbu/rbucrash.test | 6 +--
ext/rbu/rbucrash2.test | 6 +--
ext/rbu/rbudiff.test | 7 ++-
ext/rbu/rbudor.test | 6 +--
ext/rbu/rbuexlock.test | 1 +
ext/rbu/rbuexpr.test | 1 +
ext/rbu/rbufault.test | 6 +--
ext/rbu/rbufault2.test | 6 +--
ext/rbu/rbufault3.test | 1 +
ext/rbu/rbufault4.test | 6 +--
ext/rbu/rbufts.test | 6 +--
ext/rbu/rbumisc.test | 1 +
ext/rbu/rbumulti.test | 1 +
ext/rbu/rbupartial.test | 1 +
ext/rbu/rbupass.test | 1 +
ext/rbu/rbuprogress.test | 1 +
ext/rbu/rburename.test | 1 +
ext/rbu/rburesume.test | 1 +
ext/rbu/rbusave.test | 6 +--
ext/rbu/rbusplit.test | 1 +
ext/rbu/rbutemplimit.test | 1 +
ext/rbu/rbuvacuum.test | 1 +
ext/rbu/rbuvacuum2.test | 1 +
ext/rbu/rbuvacuum3.test | 1 +
ext/rbu/rbuvacuum4.test | 1 +
manifest | 97 +++++++++++++++++++--------------------
manifest.uuid | 2 +-
44 files changed, 112 insertions(+), 131 deletions(-)
diff --git a/ext/rbu/rbu1.test b/ext/rbu/rbu1.test
index 9237dbcea7..2c3860e808 100644
--- a/ext/rbu/rbu1.test
+++ b/ext/rbu/rbu1.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu1
db close
diff --git a/ext/rbu/rbu10.test b/ext/rbu/rbu10.test
index aa4db8a29f..7f75dbfa76 100644
--- a/ext/rbu/rbu10.test
+++ b/ext/rbu/rbu10.test
@@ -10,13 +10,10 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu10
-
#--------------------------------------------------------------------
# Test that UPDATE commands work even if the input columns are in a
# different order to the output columns.
diff --git a/ext/rbu/rbu11.test b/ext/rbu/rbu11.test
index 5a4219b001..4b711721ef 100644
--- a/ext/rbu/rbu11.test
+++ b/ext/rbu/rbu11.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu11
diff --git a/ext/rbu/rbu12.test b/ext/rbu/rbu12.test
index 7816bfe89f..6e27ba692e 100644
--- a/ext/rbu/rbu12.test
+++ b/ext/rbu/rbu12.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/lock_common.tcl
set ::testprefix rbu12
diff --git a/ext/rbu/rbu13.test b/ext/rbu/rbu13.test
index 624c587cc3..45b84f2b1d 100644
--- a/ext/rbu/rbu13.test
+++ b/ext/rbu/rbu13.test
@@ -13,10 +13,8 @@
# for UPDATE statements. This tests RBU's internal UPDATE statement cache.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/lock_common.tcl
set ::testprefix rbu13
diff --git a/ext/rbu/rbu14.test b/ext/rbu/rbu14.test
index 07f6784094..18114ec7a9 100644
--- a/ext/rbu/rbu14.test
+++ b/ext/rbu/rbu14.test
@@ -13,10 +13,8 @@
# table.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/lock_common.tcl
set ::testprefix rbu14
diff --git a/ext/rbu/rbu3.test b/ext/rbu/rbu3.test
index da87561fbb..fe2afdc059 100644
--- a/ext/rbu/rbu3.test
+++ b/ext/rbu/rbu3.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu3
diff --git a/ext/rbu/rbu5.test b/ext/rbu/rbu5.test
index 3696dfb874..02ecf6be16 100644
--- a/ext/rbu/rbu5.test
+++ b/ext/rbu/rbu5.test
@@ -13,6 +13,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu5
diff --git a/ext/rbu/rbu6.test b/ext/rbu/rbu6.test
index bb5b17f425..cddd938703 100644
--- a/ext/rbu/rbu6.test
+++ b/ext/rbu/rbu6.test
@@ -13,10 +13,8 @@
# outcome of some other client writing to the database while an RBU update
# is being applied.
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu6
proc setup_test {} {
diff --git a/ext/rbu/rbu7.test b/ext/rbu/rbu7.test
index 1e3bc174dd..e8ec0343db 100644
--- a/ext/rbu/rbu7.test
+++ b/ext/rbu/rbu7.test
@@ -13,10 +13,8 @@
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu7
# Test index:
diff --git a/ext/rbu/rbu8.test b/ext/rbu/rbu8.test
index c0ccd8c5eb..86e931482e 100644
--- a/ext/rbu/rbu8.test
+++ b/ext/rbu/rbu8.test
@@ -12,10 +12,8 @@
# Test the rbu_delta() feature.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu8
do_execsql_test 1.0 {
diff --git a/ext/rbu/rbu9.test b/ext/rbu/rbu9.test
index 0efdc1dde5..fe808b3ac6 100644
--- a/ext/rbu/rbu9.test
+++ b/ext/rbu/rbu9.test
@@ -12,10 +12,8 @@
# Test RBU with virtual tables. And tables with no PRIMARY KEY declarations.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbu9
ifcapable !fts3 {
diff --git a/ext/rbu/rbuA.test b/ext/rbu/rbuA.test
index 642caca196..cdc0c8040b 100644
--- a/ext/rbu/rbuA.test
+++ b/ext/rbu/rbuA.test
@@ -14,10 +14,8 @@
# a wal mode database via RBU.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuA
set db_sql {
diff --git a/ext/rbu/rbuB.test b/ext/rbu/rbuB.test
index 6eb917e57d..fca755a4b6 100644
--- a/ext/rbu/rbuB.test
+++ b/ext/rbu/rbuB.test
@@ -12,6 +12,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuB
db close
diff --git a/ext/rbu/rbuC.test b/ext/rbu/rbuC.test
index ff3d4d5075..430b14418e 100644
--- a/ext/rbu/rbuC.test
+++ b/ext/rbu/rbuC.test
@@ -13,6 +13,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuC
#-------------------------------------------------------------------------
diff --git a/ext/rbu/rbubusy.test b/ext/rbu/rbubusy.test
index 8cc47db8f9..088711405a 100644
--- a/ext/rbu/rbubusy.test
+++ b/ext/rbu/rbubusy.test
@@ -12,6 +12,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbubusy
db close
diff --git a/ext/rbu/rbucollate.test b/ext/rbu/rbucollate.test
index ccc0976247..52f6ba373f 100644
--- a/ext/rbu/rbucollate.test
+++ b/ext/rbu/rbucollate.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbucollate
ifcapable !icu_collations {
diff --git a/ext/rbu/rbucrash.test b/ext/rbu/rbucrash.test
index 34ac2c86fe..c2132bc3d3 100644
--- a/ext/rbu/rbucrash.test
+++ b/ext/rbu/rbucrash.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbucrash
db close
diff --git a/ext/rbu/rbucrash2.test b/ext/rbu/rbucrash2.test
index 9ff6eba4f2..683de88492 100644
--- a/ext/rbu/rbucrash2.test
+++ b/ext/rbu/rbucrash2.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbucrash2
db close
diff --git a/ext/rbu/rbudiff.test b/ext/rbu/rbudiff.test
index 5c2bf9bee7..b165cf2be7 100644
--- a/ext/rbu/rbudiff.test
+++ b/ext/rbu/rbudiff.test
@@ -12,10 +12,9 @@
# Tests for the [sqldiff --rbu] command.
#
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set testprefix rbudiff
set PROG [test_find_sqldiff]
diff --git a/ext/rbu/rbudor.test b/ext/rbu/rbudor.test
index df4d934de7..684b43a946 100644
--- a/ext/rbu/rbudor.test
+++ b/ext/rbu/rbudor.test
@@ -13,10 +13,8 @@
# enabled by SQLITE_DIRECT_OVERFLOW_READ - Direct Overflow Read.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbudor
set bigA [string repeat a 5000]
diff --git a/ext/rbu/rbuexlock.test b/ext/rbu/rbuexlock.test
index eddcdc115f..570489cbc7 100644
--- a/ext/rbu/rbuexlock.test
+++ b/ext/rbu/rbuexlock.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuexlock
db close
diff --git a/ext/rbu/rbuexpr.test b/ext/rbu/rbuexpr.test
index a392c4ed8c..724a0f131f 100644
--- a/ext/rbu/rbuexpr.test
+++ b/ext/rbu/rbuexpr.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuexpr
db close
diff --git a/ext/rbu/rbufault.test b/ext/rbu/rbufault.test
index 247a991899..fb3efb972e 100644
--- a/ext/rbu/rbufault.test
+++ b/ext/rbu/rbufault.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/malloc_common.tcl
set ::testprefix rbufault
diff --git a/ext/rbu/rbufault2.test b/ext/rbu/rbufault2.test
index 36f2b6b6f2..4bf53a17fe 100644
--- a/ext/rbu/rbufault2.test
+++ b/ext/rbu/rbufault2.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/malloc_common.tcl
set ::testprefix rbufault2
diff --git a/ext/rbu/rbufault3.test b/ext/rbu/rbufault3.test
index 4f690284a2..b7ba54f6a6 100644
--- a/ext/rbu/rbufault3.test
+++ b/ext/rbu/rbufault3.test
@@ -13,6 +13,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/malloc_common.tcl
set ::testprefix rbufault3
diff --git a/ext/rbu/rbufault4.test b/ext/rbu/rbufault4.test
index 551b8b2b6f..f4207c162e 100644
--- a/ext/rbu/rbufault4.test
+++ b/ext/rbu/rbufault4.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
source $testdir/malloc_common.tcl
set ::testprefix rbufault4
diff --git a/ext/rbu/rbufts.test b/ext/rbu/rbufts.test
index 95d4e75c52..8424c95708 100644
--- a/ext/rbu/rbufts.test
+++ b/ext/rbu/rbufts.test
@@ -13,10 +13,8 @@
# contains tests to ensure that RBU works with FTS tables.
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbufts
ifcapable !fts3 {
diff --git a/ext/rbu/rbumisc.test b/ext/rbu/rbumisc.test
index c2a3906c09..6b89150bce 100644
--- a/ext/rbu/rbumisc.test
+++ b/ext/rbu/rbumisc.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbumisc
db close
diff --git a/ext/rbu/rbumulti.test b/ext/rbu/rbumulti.test
index 727d5e992d..95c4fee703 100644
--- a/ext/rbu/rbumulti.test
+++ b/ext/rbu/rbumulti.test
@@ -16,6 +16,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbumulti
db close
diff --git a/ext/rbu/rbupartial.test b/ext/rbu/rbupartial.test
index d6cd7330fe..c8c476a1f9 100644
--- a/ext/rbu/rbupartial.test
+++ b/ext/rbu/rbupartial.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbupartial
db close
diff --git a/ext/rbu/rbupass.test b/ext/rbu/rbupass.test
index 044a3f2eb8..8bebe074bd 100644
--- a/ext/rbu/rbupass.test
+++ b/ext/rbu/rbupass.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbupass
if {[info commands register_demovfs]==""} {
diff --git a/ext/rbu/rbuprogress.test b/ext/rbu/rbuprogress.test
index bf37b4e505..513ccdbbe4 100644
--- a/ext/rbu/rbuprogress.test
+++ b/ext/rbu/rbuprogress.test
@@ -11,6 +11,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuprogress
diff --git a/ext/rbu/rburename.test b/ext/rbu/rburename.test
index 2275396bca..fb9d83ea19 100644
--- a/ext/rbu/rburename.test
+++ b/ext/rbu/rburename.test
@@ -12,6 +12,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rburename
diff --git a/ext/rbu/rburesume.test b/ext/rbu/rburesume.test
index 82c8c66b95..fdbd214213 100644
--- a/ext/rbu/rburesume.test
+++ b/ext/rbu/rburesume.test
@@ -16,6 +16,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rburesume
forcedelete test.db-shm test.db-oal
diff --git a/ext/rbu/rbusave.test b/ext/rbu/rbusave.test
index 210d7b545a..79b49de513 100644
--- a/ext/rbu/rbusave.test
+++ b/ext/rbu/rbusave.test
@@ -10,10 +10,8 @@
#***********************************************************************
#
-if {![info exists testdir]} {
- set testdir [file join [file dirname [info script]] .. .. test]
-}
-source $testdir/tester.tcl
+source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbusave
do_execsql_test 1.0 {
diff --git a/ext/rbu/rbusplit.test b/ext/rbu/rbusplit.test
index 34fef38677..b28f0c0da9 100644
--- a/ext/rbu/rbusplit.test
+++ b/ext/rbu/rbusplit.test
@@ -12,6 +12,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbusplit
db close
diff --git a/ext/rbu/rbutemplimit.test b/ext/rbu/rbutemplimit.test
index 2acba3624c..3ca9c64d81 100644
--- a/ext/rbu/rbutemplimit.test
+++ b/ext/rbu/rbutemplimit.test
@@ -12,6 +12,7 @@
# TESTRUNNER: slow
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbutemplimit
db close
diff --git a/ext/rbu/rbuvacuum.test b/ext/rbu/rbuvacuum.test
index 1785f529b1..4ed71c2665 100644
--- a/ext/rbu/rbuvacuum.test
+++ b/ext/rbu/rbuvacuum.test
@@ -15,6 +15,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set ::testprefix rbuvacuum
foreach step {0 1} {
diff --git a/ext/rbu/rbuvacuum2.test b/ext/rbu/rbuvacuum2.test
index d4f7c52328..eed8ea1ae4 100644
--- a/ext/rbu/rbuvacuum2.test
+++ b/ext/rbu/rbuvacuum2.test
@@ -15,6 +15,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
foreach {step} {0 1} {
foreach {ttt state} {
diff --git a/ext/rbu/rbuvacuum3.test b/ext/rbu/rbuvacuum3.test
index 7e1e337f3c..98fb25fc04 100644
--- a/ext/rbu/rbuvacuum3.test
+++ b/ext/rbu/rbuvacuum3.test
@@ -15,6 +15,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set testprefix rbuvacuum3
do_execsql_test 1.0 {
diff --git a/ext/rbu/rbuvacuum4.test b/ext/rbu/rbuvacuum4.test
index 5cf33d6765..269bd2152f 100644
--- a/ext/rbu/rbuvacuum4.test
+++ b/ext/rbu/rbuvacuum4.test
@@ -15,6 +15,7 @@
#
source [file join [file dirname [info script]] rbu_common.tcl]
+ifcapable !rbu { finish_test ; return }
set testprefix rbuvacuum4
set step 1
diff --git a/manifest b/manifest
index 25fd792232..6460dfef0a 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Cherrypick\s[3773934e91c20ca243]\sinto\strunk.
-D 2023-01-27T17:19:30.435
+C Do\snot\stry\sto\srun\srbu\stests\swith\sbuilds\sthat\sdo\snot\ssupport\srbu.
+D 2023-01-27T19:59:46.779
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -318,49 +318,49 @@ F ext/misc/wholenumber.c a838d1bea913c514ff316c69695efbb49ea3b8cb37d22afc57f73b6
F ext/misc/zipfile.c f98239261488397618ce4754c500626d1de20cd2d44bf2f2d571d7ddaab668a7
F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64
F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
-F ext/rbu/rbu1.test c62904bd9526dcdc3496a21199aaf14ae191bbadbf67f076bf16be6b3f2115c2
-F ext/rbu/rbu10.test 06d2bc934a03a0978e750cc9c95b419d9b0bcbec1fc77128e33e377c3a73240b
-F ext/rbu/rbu11.test 5c834cf491086b45e071eabf71f708febc143e86a384a92de69e0b1a4cace144
-F ext/rbu/rbu12.test 29f8b2118f6c96fac3755bd6d2b55c2db24f878b1f11fbfbe294f3a230a3dcdc
-F ext/rbu/rbu13.test 1285298e3360ec74511764841b3c174dcfe21da2f618c22febf1a20abd0365c2
-F ext/rbu/rbu14.test 4a7bf0b3a4516d3ab0bc0ba4ceb53eb7e3324147ccda152e561060f659dbba31
-F ext/rbu/rbu3.test d6c6cc7a1326e8e23b9820f30bd3054f22092e503fadfd2a660ae006653f6d80
-F ext/rbu/rbu5.test 724b38ea5f722e3d22dc76343860bd998bb676c3f78c4bc8175df5c5d7720e23
-F ext/rbu/rbu6.test 401064236d3cf86b7edc01c586d7c5554f48553946fbfa1a3af35d7e47dce9e3
-F ext/rbu/rbu7.test ae25f47b56f178197fc1098537a35a39176cc73d1629b03dc9d795929fc36ec2
-F ext/rbu/rbu8.test b98a6fc58ead84a0e6ddee775b9702cd981f318d5d4fd1d4df0fa0c40db7251b
-F ext/rbu/rbu9.test 0e4d985e25620d61920597e8ea69c871c9e8c1f5a0be2ae9fa70bb641d74378c
-F ext/rbu/rbuA.test b34a90cb495682c25b5fc03a9d5e7a4fc99541c29256f25e2e2a4f6542b4f5b3
-F ext/rbu/rbuB.test 8d1f141711be8122739853d876af4306bc756d925499577f9b917ec1f1c5ae65
-F ext/rbu/rbuC.test 80f1cc2fb74f44b1128fd0ed8eedab3a76fefeb72a947860e2869ef76fc8dc6b
+F ext/rbu/rbu1.test c62d9bfdd988cd0a30fa84e6f9a733f540e1d16d3e0cde4ee744aeadbaef334a
+F ext/rbu/rbu10.test 66b20eb97e9d923f3cd69a882c57eb6c945b19d7f1ceaa7712e1b02fae3793c2
+F ext/rbu/rbu11.test 34134e9331f2a6d29770cd4594e54ad92e007f0f6bca4ee12cddee113c61f60e
+F ext/rbu/rbu12.test 3b18fa8b712274551c438acf4b71f6fbcebe71c09d0bc1058d3ec99c4e5c59bd
+F ext/rbu/rbu13.test 67bae3f17fa6b74c8853b25804e7f5345926af42bc80a10b0c433ba9e54b87a6
+F ext/rbu/rbu14.test 3aa8202b181e25112fb80e7fe9e9f409d7d191d09f732bcb53fbd200d384bb63
+F ext/rbu/rbu3.test 76152c3601e6a0a39cebd37945bb79f7bd1061462053a3899432bd089c6ae15b
+F ext/rbu/rbu5.test 29a4bd5261f1df259d598e8792607643861ba476c607343c68310bfd94919263
+F ext/rbu/rbu6.test 6966b6c734ee50279ecf59bc32c7b2bcfb972e91a3303e120bc31ca4ea28edd2
+F ext/rbu/rbu7.test 92938c6b0b0e7d268a75b5744fd4ea023f8f3da5d46c3764c625564d7001c7b8
+F ext/rbu/rbu8.test 2aba6914d3fc47565ac2a3de49fde4fe2f5181af449cd5443f0576ab0a92bc79
+F ext/rbu/rbu9.test f37042dee2caf1551d3ad462670189f05677c242510a5c0f8dd650750cb5426a
+F ext/rbu/rbuA.test 94759f2117d5932bfff0b60405d5644665e2216254625be68998f055fd6b580a
+F ext/rbu/rbuB.test 1e7641ec8c8eafc21fdaaa983ef04d999fa0a9b83d88175f561184a19dfdaa8c
+F ext/rbu/rbuC.test 2e1cd0d85a7576b97c1919fa6d3697b6d40ed2acf626da99f8abf90a7b946f37
F ext/rbu/rbu_common.tcl 60d904133ff843fe72cc0514e9dd2486707181e6e0fbab20979da28c48d21de9
-F ext/rbu/rbubusy.test f38ef557358564491b8a2ee70e4cad31e40fcea57a16f27bc56ba40a59bbde50
-F ext/rbu/rbucollate.test cac528a9a46318cba42e61258bb42660bbbf4fdb9a8c863de5a54ad0c658d197
-F ext/rbu/rbucrash.test 000981a1fe8a6e4d9a684232f6a129e66a3ef595f5ed74655e2f9c68ffa613b4
-F ext/rbu/rbucrash2.test efa143cc94228eb0266d3f1abfbee60a5838a84cef7cc3fcb8c145b74d96fd41
-F ext/rbu/rbudiff.test abe895a8d479e4d33acb40e244e3d8e2cd25f55a18dfa8b9f83e13d00073f600
-F ext/rbu/rbudor.test e3e8623926012f43eebe51fedf06a102df2640750d971596b052495f2536db20
-F ext/rbu/rbuexlock.test 4634a5526d02bf80b0c563f95774bd5af5783e3219ddeb30e413753c9a65510c
-F ext/rbu/rbuexpr.test 10d0420537c3bc7666e576d72adeffe7e86cfbb00dcc30aa9ce096c042415190
-F ext/rbu/rbufault.test 2d7f567b79d558f6e093c58808cab4354f8a174e3802f69e7790a9689b3c09f8
-F ext/rbu/rbufault2.test c81327a3ac2c385b9b954db3644d4e0df93eeebfc3de9f1f29975a1e73fd3d0c
-F ext/rbu/rbufault3.test b2fcc9db5c982b869f67d1d4688d8cb515d5b92f58011fff95665f2e62cec179
-F ext/rbu/rbufault4.test 03d2849c3df7d7bd14a622e789ff049e5080edd34a79cd432e01204db2a5930a
-F ext/rbu/rbufts.test 0ae8d1da191c75bd776b86e24456db0fb6e97b7c944259fae5407ea55d23c31d
-F ext/rbu/rbumisc.test 329986cf5dd51890c4eb906c2f960ebb773a79a64bed90f506b7c417825b37eb
-F ext/rbu/rbumulti.test bf28c1486b45215f5bf877cc560a4ddf50d22c4ed2ae267482bcf4af285bb115
-F ext/rbu/rbupartial.test f25df014b8dbe3c5345851fba6e66f79ab237f57dc201b2d5f0dbae658ae5a4c
-F ext/rbu/rbupass.test 1a8f635a9f6026f905a952e70a081811d8042de28165099d874832c1bf49d4b9
-F ext/rbu/rbuprogress.test 857cf1f8166c83ef977edb9ef4fc42d80f71fbd798652b46ae2f3a7031870f8d
-F ext/rbu/rburename.test a9b4aea612352b74c45de1757edd2ecb2079348b1d4cc734572dc29e55b1b376
-F ext/rbu/rburesume.test c46a77f031cbaec58abf0edbafbf75190cbafd3b941ed081cb6626ebb3e8230c
-F ext/rbu/rbusave.test f4190a1a86fccf84f723af5c93813365ae33feda35845ba107b59683d1cdd926
-F ext/rbu/rbusplit.test b37e7b40b38760881dc9c854bd40b4744c6b6cd74990754eca3bda0f407051e8
-F ext/rbu/rbutemplimit.test 8d18f1c7e8a04814d9dbe36f75f0d8921bcca00c18901d518bce5fc6bc98b877
-F ext/rbu/rbuvacuum.test 55e101e90168c2b31df6c9638fe73dc7f7cc666b6142266d1563697d79f73534
-F ext/rbu/rbuvacuum2.test 2643b58f4d8d3573db0f93faae18805a35ab162b4c55ff6b656062ff432ed55b
-F ext/rbu/rbuvacuum3.test 8addd82e4b83b4c93fa47428eae4fd0dbf410f8512c186f38e348feb49ba03dc
-F ext/rbu/rbuvacuum4.test a78898e438a44803eb2bc897ba3323373c9f277418e2d6d76e90f2f1dbccfd10
+F ext/rbu/rbubusy.test 8ab40abb9b3210a453aa25971c64adbb1ff0f764eaf9c38e137482a63fd45b91
+F ext/rbu/rbucollate.test 559b5b877d61b2a7b7a7a49ad8cde5d21658c19d34fd2811f946ee5df6cb475b
+F ext/rbu/rbucrash.test c6440ae5803676f357b579dea260c894f23081f6fc8befdbc9fd081990f52507
+F ext/rbu/rbucrash2.test d63c10195f2bbf7d7ec2248740dcc6171ecc2693080cfb65976c35f477120ac8
+F ext/rbu/rbudiff.test b0865fe535942d89795126087001be751fc0d2fa0ca667a59446cca027471eb9
+F ext/rbu/rbudor.test b77e10326ef3660e19d103bf1739ac52baf9e6a2486f631b8b369468adcaa37e
+F ext/rbu/rbuexlock.test a6c135766e0cafa221ec69fa5c019beab2aad208750d3aa8c734d7260e01a4fe
+F ext/rbu/rbuexpr.test 85effe05ee50594df27a903c48aa9b192bd26045a5be95d10f1a5495232dea15
+F ext/rbu/rbufault.test 9bc7538e4b02817d898b15ab590acb9648e2a6eb53dd1d3848c417f5980a107b
+F ext/rbu/rbufault2.test 411469c638073bd6523f069bcaee07b413127f3f233de34756ebcf5a2a0ce566
+F ext/rbu/rbufault3.test d9042c8840eb92cca1f9552388f799f0ccca024ed5b8d9bb9c78f38d39a1f339
+F ext/rbu/rbufault4.test 778c73137822e12ddbf54da248c9b2be59b0580c4202c052fa07787ae493f04a
+F ext/rbu/rbufts.test b4db0a6d89905d356cecb6f9f2fe7e4848da6b3b276b73b8689ce96301c2810c
+F ext/rbu/rbumisc.test db67696663760aa4093f451ebeddc953a8d33ee9571a5651dff48d0597b7a812
+F ext/rbu/rbumulti.test e8891a63b078253d34e0cdee0ed7446808daa4138cfc7dbd0e359c50967e4351
+F ext/rbu/rbupartial.test bffeb40fe14906ab6f90286ae3913f8aa4b35a5b2de03f24ea2fcf80ee6f2b24
+F ext/rbu/rbupass.test c21e13b78ea62bf70850ee79ef96bfcbe203d7ccc2de83c35d452723328d20f0
+F ext/rbu/rbuprogress.test 3a0344032b7f62ae172cf1f4da52caa753bcf535bf73341ab23b3929a217d79b
+F ext/rbu/rburename.test 6d9b4efbe537e221700db15903cd11b17cb0c97eaa6584baf01aac9664937462
+F ext/rbu/rburesume.test 9caa95842fd4a35c3e8aeb5ca83e638fa357f51a774d6a0487ada1122ab39612
+F ext/rbu/rbusave.test 323ad16da4492e173e99bd77397807d911e8b69df08318224bb748a5b955689f
+F ext/rbu/rbusplit.test eb20a264b7681613db6cbf031c93b2f50addec89cd437ab737304eb143cd34a8
+F ext/rbu/rbutemplimit.test 6b4ac534ffdd0133c627ebb15b1abe449f941b088e985152133cdbdc1b489966
+F ext/rbu/rbuvacuum.test 36aa4024b226b13e47ab20f27aa5a239ba3eb1b0385c24d09507bd3f4c2a9ca4
+F ext/rbu/rbuvacuum2.test 851c5163261c2057adb5265f06240b37a52a18c2383fca17d0a3013f05261a6d
+F ext/rbu/rbuvacuum3.test fbea74f2c316911c1983db06566d55fca4e270fdc731f62299417087362fb704
+F ext/rbu/rbuvacuum4.test 834e9d6c7cb46237493ec16489c0478ec4aedadf9396973f1fec93acb725ba25
F ext/rbu/sqlite3rbu.c 348bb6251e6ec459de102f8b2dd50789a98643ef7a28e56e4c787ac9659c15ea
F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304
F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055
@@ -2044,9 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P eabb551b8b3d33fc3a327ecf7225436a3a3f616901e22c868fd76a5e3adc7b3f
-Q +3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
-R 1cf9f93fc162d1085b11c39fbf5b9e62
-U stephan
-Z 35eb683fd2e66a13e0456c98ff3a4371
+P 50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d
+R 6fb23e5232bbb2d103c92c941058e228
+U dan
+Z 4b65d980220a15831da00c2a768596a3
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index f4626601bf..be80e330fe 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d
\ No newline at end of file
+c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494
\ No newline at end of file
From f92b006a6ed7b9be3614bb8d31ec40a7dfeaa3b7 Mon Sep 17 00:00:00 2001
From: drh <>
Date: Fri, 27 Jan 2023 20:15:48 +0000
Subject: [PATCH 10/65] Add an assert() to help static analyzers.
FossilOrigin-Name: e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/btree.c | 4 +++-
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 6460dfef0a..04c121fbc0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\stry\sto\srun\srbu\stests\swith\sbuilds\sthat\sdo\snot\ssupport\srbu.
-D 2023-01-27T19:59:46.779
+C Add\san\sassert()\sto\shelp\sstatic\sanalyzers.
+D 2023-01-27T20:15:48.669
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -559,7 +559,7 @@ F src/auth.c f4fa91b6a90bbc8e0d0f738aa284551739c9543a367071f55574681e0f24f8cf
F src/backup.c a2891172438e385fdbe97c11c9745676bec54f518d4447090af97189fd8e52d7
F src/bitvec.c 7c849aac407230278445cb069bebc5f89bf2ddd87c5ed9459b070a9175707b3d
F src/btmutex.c 6ffb0a22c19e2f9110be0964d0731d2ef1c67b5f7fabfbaeb7b9dabc4b7740ca
-F src/btree.c 8b776a47d1e791ca78b539b8356cf32e449a613201cf64b87e7f01c62f79bd1b
+F src/btree.c 2f012aea074de6319c191cbf5c45034de79bf1c762826e381b1cf75421d8d831
F src/btree.h aa354b9bad4120af71e214666b35132712b8f2ec11869cb2315c52c81fad45cc
F src/btreeInt.h 06bb2c1a07172d5a1cd27a2a5d617b93b1e976c5873709c31964786f86365a6e
F src/build.c c55ab6d1b089ceef57160e840f05f692955ac90944c3d04fcf01d97fd7bfd08d
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 50cf4300a6a92302010fa4a7662db82bf55180a4930771f0d3c07e558bc87e7d
-R 6fb23e5232bbb2d103c92c941058e228
-U dan
-Z 4b65d980220a15831da00c2a768596a3
+P c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494
+R 57fbc0d68a554ca6b628d676f2d12d96
+U drh
+Z 7ac7eacb05727f391b6a985bf9bb5add
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index be80e330fe..e4d2a92b82 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494
\ No newline at end of file
+e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6
\ No newline at end of file
diff --git a/src/btree.c b/src/btree.c
index fae5725360..4fbe0b3dbc 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -10410,7 +10410,9 @@ static void checkList(
** lower 16 bits are the index of the last byte of that range.
*/
static void btreeHeapInsert(u32 *aHeap, u32 x){
- u32 j, i = ++aHeap[0];
+ u32 j, i;
+ assert( aHeap!=0 );
+ i = ++aHeap[0];
aHeap[i] = x;
while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){
x = aHeap[j];
From 69141f52be6368d3510b551c74029e3600b6f4c2 Mon Sep 17 00:00:00 2001
From: stephan
Date: Fri, 27 Jan 2023 20:25:39 +0000
Subject: [PATCH 11/65] Update ext/wasm/README-dist.txt for the
bundler-friendly build.
FossilOrigin-Name: 6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3
---
ext/wasm/README-dist.txt | 34 +++++++++++++++++++++++++++-------
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/ext/wasm/README-dist.txt b/ext/wasm/README-dist.txt
index 909a5ebbe0..db0862628b 100644
--- a/ext/wasm/README-dist.txt
+++ b/ext/wasm/README-dist.txt
@@ -4,19 +4,39 @@ Main project page: https://sqlite.org
Documentation: https://sqlite.org/wasm
-This archive contains the sqlite3.js, sqlite3.mjs, and sqlite3.wasm
-files which make up the sqlite3 WASM/JS build.
+This archive contains the following deliverables for the WASM/JS
+build:
-The jswasm directory contains the core sqlite3 deliverables and the
-top-level directory contains demonstration and test applications.
+- jswasm/sqlite3.js is the canonical "vanilla JS" version.
-Browsers will not serve WASM files from file:// URLs, so the demo/test
-apps require a web server and that server must include the following
-headers in its response when serving the files:
+- jswasm/sqlite3.mjs is the same but in ES6 module form
+
+- jswasm/sqlite3-bundler-friendly.mjs is the same as the ES6 module
+ with small tweaks to make it compatible with "bundler" tools
+ commonly seen in node.js-based projects.
+
+- jswasm/sqlite3.wasm is the binary WASM file imported by all of the
+ above-listed JS files.
+
+- The jswasm directory additionally contains a number of supplemental
+ JS files which cannot be bundled directly with the main JS files
+ but are necessary for certain usages.
+
+- The top-level directory contains various demonstration and test
+ applications for sqlite3.js and sqlite3.mjs.
+ sqlite3-bundler-friendly.mjs requires client-side build tools to make
+ use of and is not demonstrated here.
+
+Browsers will not serve WASM files from file:// URLs, so the test and
+demonstration apps require a web server and that server must include
+the following headers in its response when serving the files:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
+The core library will function without those headers but certain
+features, most notably OPFS storage, will not be available.
+
One simple way to get the demo apps up and running on Unix-style
systems is to install althttpd (https://sqlite.org/althttpd) and run:
diff --git a/manifest b/manifest
index c19a076175..8335468752 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\sfeature\sidea\snote\sto\sDB.exec(),\sderived\sfrom\sa\sforum\sdiscussion.
-D 2023-01-27T19:56:40.990
+C Update\sext/wasm/README-dist.txt\sfor\sthe\sbundler-friendly\sbuild.
+D 2023-01-27T20:25:39.859
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -467,7 +467,7 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 31cf62436f306eed8c8aa66991653395f62e52af7ad21a0de02f7d780cb8c398
-F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7
+F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94
-R c10dcf005f6c888521bd65824a3df6ca
+P 792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db
+R 6dd48572fe63ddeb1a6c689b0b2a68d4
U stephan
-Z 96645cafa741bd6b03c389427ea21748
+Z 5f5447f2e7e7b095c0a2cbaeda82b72d
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 60da4aa3a1..ccc5178417 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-792f43209c4b6e85386b6b3906814b7f2ad310d50ba563b3fd1cb37e55adf8db
\ No newline at end of file
+6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3
\ No newline at end of file
From cfd01014d0b5657a8b48d4c828405703cce9e941 Mon Sep 17 00:00:00 2001
From: drh <>
Date: Fri, 27 Jan 2023 23:10:10 +0000
Subject: [PATCH 12/65] Fix compiler warning in base85.c.
FossilOrigin-Name: bd9613fd63193bd6b33798d83f0ef21987ba468b53d13a25a31cb9e9e5f20562
---
ext/misc/base85.c | 3 ++-
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/ext/misc/base85.c b/ext/misc/base85.c
index 0191368741..5ec136dbc6 100644
--- a/ext/misc/base85.c
+++ b/ext/misc/base85.c
@@ -171,7 +171,8 @@ static char* toBase85( u8 *pIn, int nbIn, char *pOut, char *pSep ){
int nCol = 0;
while( nbIn >= 4 ){
int nco = 5;
- unsigned long qbv = (pIn[0]<<24)|(pIn[1]<<16)|(pIn[2]<<8)|pIn[3];
+ unsigned long qbv = (((unsigned long)pIn[0])<<24) |
+ (pIn[1]<<16) | (pIn[2]<<8) | pIn[3];
while( nco > 0 ){
unsigned nqv = (unsigned)(qbv/85UL);
unsigned char dv = qbv - 85UL*nqv;
diff --git a/manifest b/manifest
index 04c121fbc0..4b7e12a3aa 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\san\sassert()\sto\shelp\sstatic\sanalyzers.
-D 2023-01-27T20:15:48.669
+C Fix\scompiler\swarning\sin\sbase85.c.
+D 2023-01-27T23:10:10.479
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -264,7 +264,7 @@ F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e16a3824
F ext/misc/base64.c d43d2b209c8ab70ca3f860104bb353b0f52a1c5462a2466140025c954e4f3ea7 x
-F ext/misc/base85.c 4b53d66c50e120e8697dd2a8ea6ddbc8750a4a1f6bcc6e0b7202a3998b0852bc
+F ext/misc/base85.c 77dfd5813d23ea561d0348f922583888e78f8eaeb2b9a4a28226d092389890b8
F ext/misc/basexx.c 5e859e1820620aa8080fb9145eb47089de426ae808f6abb01a8e12921c3a8e67
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c74ad902e3bbfc28d6b30a37f3791176d64cdd8fd5950f1d1749541e244a0494
-R 57fbc0d68a554ca6b628d676f2d12d96
+P e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6
+R d679b1424ddaeb09fc6eeb6c565e2751
U drh
-Z 7ac7eacb05727f391b6a985bf9bb5add
+Z 0e1eac878e4ebdd2f0ed91103111d8aa
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index e4d2a92b82..fea530843c 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e446c8b4aa2ffe075f9c289c771d62a414661c3ffe6abae5649c50af8e32fab6
\ No newline at end of file
+bd9613fd63193bd6b33798d83f0ef21987ba468b53d13a25a31cb9e9e5f20562
\ No newline at end of file
From e84454ff16acf8da0814dfb334e0b6628293ae81 Mon Sep 17 00:00:00 2001
From: stephan
Date: Sat, 28 Jan 2023 05:09:26 +0000
Subject: [PATCH 13/65] Enhance oo1.DB.exec() to simplify returning whole
result sets.
FossilOrigin-Name: 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d
---
ext/wasm/api/sqlite3-api-oo1.js | 14 +++++++++-----
ext/wasm/tester1.c-pp.js | 18 +++++++++++++++---
ext/wasm/tests/opfs/concurrency/index.html | 5 ++---
manifest | 17 ++++++++---------
manifest.uuid | 2 +-
5 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js
index fddd7b38e3..26aa80f723 100644
--- a/ext/wasm/api/sqlite3-api-oo1.js
+++ b/ext/wasm/api/sqlite3-api-oo1.js
@@ -422,6 +422,10 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
default:
toss3("Invalid returnValue value:",opt.returnValue);
}
+ if(!opt.callback && !opt.returnValue && undefined!==opt.rowMode){
+ if(!opt.resultRows) opt.resultRows = [];
+ out.returnVal = ()=>opt.resultRows;
+ }
if(opt.callback || opt.resultRows){
switch((undefined===opt.rowMode)
? 'array' : opt.rowMode) {
@@ -770,8 +774,11 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
- `returnValue`: is a string specifying what this function
should return:
- A) The default value is `"this"`, meaning that the
- DB object itself should be returned.
+ A) The default value is (usually) `"this"`, meaning that the
+ DB object itself should be returned. The exceptions is if
+ the caller passes neither of `callback` nor `returnValue`
+ but does pass an explicit `rowMode` then the default
+ `returnValue` is `"resultRows"`, described below.
B) `"resultRows"` means to return the value of the
`resultRows` option. If `resultRows` is not set, this
@@ -791,9 +798,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
- `callback` and `resultRows`: permit an array entries with
semantics similar to those described for `bind` above.
- - If passed neither a callback nor returnValue but is passed a
- rowMode, default to returning the result set.
-
*/
exec: function(/*(sql [,obj]) || (obj)*/){
affirmDbOpen(this);
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index dca5331370..86ec87b73d 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -1412,14 +1412,26 @@ self.sqlite3InitModule = sqlite3InitModule;
db.selectValue("SELECT "+Number.MIN_SAFE_INTEGER)).
assert(Number.MAX_SAFE_INTEGER ===
db.selectValue("SELECT "+Number.MAX_SAFE_INTEGER));
-
counter = 0;
- db.exec({
+ let rv = db.exec({
sql: "SELECT a FROM t",
callback: ()=>(1===++counter),
});
- T.assert(2===counter,
+ T.assert(db === rv)
+ .assert(2===counter,
"Expecting exec step() loop to stop if callback returns false.");
+ /** If exec() is passed neither callback nor returnValue but
+ is passed an explicit rowMode then the default returnValue
+ is the whole result set, as if an empty resultRows option
+ had been passed. */
+ rv = db.exec({
+ sql: "SELECT -1 UNION ALL SELECT -2 UNION ALL SELECT -3 ORDER BY 1 DESC",
+ rowMode: 0
+ });
+ T.assert(Array.isArray(rv)).assert(3===rv.length)
+ .assert(-1===rv[0]).assert(-3===rv[2]);
+ rv = db.exec("SELECT 1 WHERE 0",{rowMode: 0});
+ T.assert(Array.isArray(rv)).assert(0===rv.length);
if(wasm.bigIntEnabled && haveWasmCTests()){
const mI = wasm.xCall('sqlite3_wasm_test_int64_max');
const b = BigInt(Number.MAX_SAFE_INTEGER * 2);
diff --git a/ext/wasm/tests/opfs/concurrency/index.html b/ext/wasm/tests/opfs/concurrency/index.html
index 9a826c6e13..595ab24529 100644
--- a/ext/wasm/tests/opfs/concurrency/index.html
+++ b/ext/wasm/tests/opfs/concurrency/index.html
@@ -26,9 +26,8 @@
workload with interval=N (milliseconds). Set the
number of worker iterations with iterations=N.
Enable OPFS VFS verbosity with verbose=1-3 (output
- goes to the dev console). Enable/disable "unlock ASAP" mode
- (higher concurrency, lower speed)
- with unlock-asap=0-1.
+ goes to the dev console). Disable/enable "unlock ASAP" mode
+ (higher concurrency, lower speed) with unlock-asap=0-1.
Achtung: if it does not start to do anything within a couple of
seconds, check the dev console: Chrome sometimes fails to load
diff --git a/manifest b/manifest
index 5c62a39f76..dba0c8dd58 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sJS\sbundler-friendly\sJS\sbuild.\sMinor\stest\scode\scleanups.
-D 2023-01-28T04:20:46.205
+C Enhance\soo1.DB.exec()\sto\ssimplify\sreturning\swhole\sresult\ssets.
+D 2023-01-28T05:09:26.765
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -479,7 +479,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b
F ext/wasm/api/pre-js.c-pp.js 9ece5de1bb0509f0a8a360712fcc9c1291b9516c0be5bd66acedd6edbcec37a1
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
-F ext/wasm/api/sqlite3-api-oo1.js a3892fd79070d8c947205d8b90d8218cdb12e7fd5027dced5805dd387b590a36
+F ext/wasm/api/sqlite3-api-oo1.js f85f4f939f67217d75898e3a32944dd8ae17f11c9a357e78a116150d038c0377
F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a
F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
@@ -530,8 +530,8 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b
F ext/wasm/tester1-worker.html 258d08f1ba9cc2d455958751e26be833893cf9ff7853e9436e593e1f778a386b
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
-F ext/wasm/tester1.c-pp.js f199ef496aec40a7ddedcc84f996117c911eac36d377913993d3f0261f9427ac
-F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70
+F ext/wasm/tester1.c-pp.js 483fc1393bff4d06e696e6b72ebd1daedb71a46e81cd33d9ede9ca2b5fb76f68
+F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5
@@ -2044,9 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P bd9613fd63193bd6b33798d83f0ef21987ba468b53d13a25a31cb9e9e5f20562 6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3
-R 7e285c57f9c962c0e3cd104712b20885
-T +closed 6a5c4f6b19aa0704efe7f789102f757a1ed05d6542f37c7aa37a4439783944a3 Closed\sby\sintegrate-merge.
+P 24d3a53dea5e596230558e233cbbd9d0288b4c394cd5ea7b650fd99bff4cde2e
+R 32ae67991ccd2fab1735177a69f90f3b
U stephan
-Z 04a00083266e19e010eadc8bb14898d9
+Z eea3cf1aefbfbb83af8cc08b772c2cf0
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 9b1cb2f613..ccd158bf86 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-24d3a53dea5e596230558e233cbbd9d0288b4c394cd5ea7b650fd99bff4cde2e
\ No newline at end of file
+7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d
\ No newline at end of file
From 919fe5bac6bf273d0b90332916521d25c6c07097 Mon Sep 17 00:00:00 2001
From: stephan
Date: Sat, 28 Jan 2023 09:11:08 +0000
Subject: [PATCH 14/65] Overhaul ext/wasm/GNUmakefile to consolidate what
amounts to much copy/paste/slightly-edit duplication into a single function,
called once per distinctive build mode (vanilla, ESM, bundler-friendly).
FossilOrigin-Name: 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682
---
ext/wasm/GNUmakefile | 375 ++++++++++++++++++++-----------------------
manifest | 12 +-
manifest.uuid | 2 +-
3 files changed, 183 insertions(+), 206 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index 78e34eb192..018d7edd53 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -249,21 +249,9 @@ $(2): $(1) $$(MAKEFILE) $$(bin.c-pp)
$$(bin.c-pp) -f $(1) -o $$@ $(3)
CLEAN_FILES += $(2)
endef
-c-pp.D.vanilla :=
-c-pp.D.esm := -Dtarget=es6-module
-c-pp.D.bundler-friendly := $(c-pp.D.esm) -Dtarget=es6-bundler-friendly
-# The various -D... values used by the sources include:
-#
-# -Dtarget=es6-module: intended for plain ESM module build.
-#
-# -Dtarget=es6-module -Dtarget=es6-bundler-friendly: intended for
-# "bundler-friendly" ESM module build. These have some restrictions
-# on how URL() objects are constructed in some contexts.
-#
# /end C-PP.FILTER
########################################################################
-
# cflags.common = C compiler flags for all builds
cflags.common := -I. -I.. -I$(dir.top)
# emcc.WASM_BIGINT = 1 for BigInt (C int64) support, else 0. The API
@@ -353,6 +341,27 @@ $(foreach X,$(SOAP.js) $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js),\
all quick: $(sqlite3-api.ext.jses)
q: quick
+########################################################################
+# $(sqlite3-api*.*js) contain the core library code but not the
+# Emscripten-related glue which deals with loading sqlite3.wasm. In
+# theory they can be used by arbitrary build environments and WASM
+# loaders, but in practice that breaks down because the WASM loader
+# has to be able to provide all of the necessary "imports" to
+# sqlite3.wasm, and that list of imports is unknown until sqlite3.wasm
+# is compiled, at which point Emscripten sets up the imports
+# appropriately. Abstractly speaking, it's impossible for other build
+# environments to know exactly which imports are needed and provide
+# them. Tools like wasm-objdump can be used to find the list of
+# imports but it's questionable whether a non-Emscripten tool could
+# realistically use that info to provide proper implementations.
+# Sidebar: some of the imports are used soley by the Emscripten glue,
+# which the sqlite3 JS code does not rely on.
+#
+# We build $(sqlite3-api*.*) "because we can" and because it might be
+# a useful point of experimentation for some clients, but the
+# above-described caveat may well make them unusable for real-life
+# clients.
+#
# sqlite3-api.js.in = the generated sqlite3-api.js before it gets
# preprocessed. It contains all of $(sqlite3-api.jses) but none of the
# Emscripten-specific headers and footers.
@@ -365,150 +374,6 @@ $(sqlite3-api.js.in): $(sqlite3-api.jses) $(MAKEFILE)
echo "/* END FILE: $$i */"; \
done > $@
-########################################################################
-# $(sqlite3-api.js) and $(sqlite3-api.mjs) (ES6 module) contain the
-# core library code but not the Emscripten-related glue which deals
-# with loading sqlite3.wasm. In theory they can be used by arbitrary
-# build environments and WASM loaders, but in practice that breaks
-# down because the WASM loader has to be able to provide all of the
-# necessary "imports" to sqlite3.wasm, and that list of imports is
-# unknown until sqlite3.wasm is compiled, at which point Emscripten
-# sets up the imports appropriately. Abstractly speaking, it's
-# impossible for other build environments to know exactly which
-# imports are needed and provide them. Tools like wasm-objdump can be
-# used to find the list of imports but it's questionable whether a
-# non-Emscripten tool could realistically use that info to provide
-# proper implementations. Sidebar: some of the imports are used soley
-# by the Emscripten glue, which the sqlite3 JS code does not rely on.
-#
-# We build $(sqlite3-api.js) and $(sqlite3-api.mjs) "because we can"
-# and because it might be a useful point of experimentation for some
-# clients, but the above-described caveat may well make them unusable
-# for real-life clients.
-sqlite3-api.js := $(dir.dout)/sqlite3-api.js
-sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs
-sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs
-$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.js)))
-$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api.mjs), $(c-pp.D.esm)))
-$(eval $(call C-PP.FILTER, $(sqlite3-api.js.in), $(sqlite3-api-bundler-friendly.mjs), $(c-pp.D.bundler-friendly)))
-all: $(sqlite3-api.js) $(sqlite3-api.mjs) $(sqlite3-api-bundler-friendly.mjs)
-
-$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
- @echo "Making $@..."
- @{ \
- echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
- echo -n ' sqlite3.version = '; \
- $(bin.version-info) --json; \
- echo ';'; \
- echo '});'; \
- } > $@
-$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) \
- $(MAKEFILE)
- @echo "Making $@..."; { \
- cat $(sqlite3-license-version-header.js); \
- echo '/*'; \
- echo '** This code was built from sqlite3 version...'; \
- echo "**"; \
- awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \
- -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
- echo '*/'; \
- } > $@
-
-########################################################################
-# --post-js and --pre-js are emcc flags we use to append/prepend JS to
-# the generated emscripten module file. The following rules generate
-# various versions of those files for the vanilla and ESM builds.
-pre-js.js.in := $(dir.api)/pre-js.c-pp.js
-pre-js.js.vanilla := $(dir.tmp)/pre-js.vanilla.js
-pre-js.js.esm := $(dir.tmp)/pre-js.esm.js
-pre-js.js.bundler-friendly := $(dir.tmp)/pre-js.bundler-friendly.js
-$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.vanilla),$(c-pp.D.vanilla)))
-$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.esm),$(c-pp.D.esm)))
-$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.bundler-friendly),$(c-pp.D.bundler-friendly)))
-post-js.js.in := $(dir.tmp)/post-js.c-pp.js
-post-js.js.vanilla := $(dir.tmp)/post-js.vanilla.js
-post-js.js.esm := $(dir.tmp)/post-js.esm.js
-post-js.js.bundler-friendly := $(dir.tmp)/post-js.bundler-friendly.js
-post-jses.js := \
- $(dir.api)/post-js-header.js \
- $(sqlite3-api.js.in) \
- $(dir.api)/post-js-footer.js
-$(post-js.js.in): $(post-jses.js) $(MAKEFILE)
- @echo "Making $@..."
- @for i in $(post-jses.js); do \
- echo "/* BEGIN FILE: $$i */"; \
- cat $$i; \
- echo "/* END FILE: $$i */"; \
- done > $@
-$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.vanilla),$(c-pp.D.vanilla)))
-$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.esm),$(c-pp.D.esm)))
-$(eval $(call C-PP.FILTER,$(post-js.js.in),$(post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly)))
-
-# extern-post-js* and extern-pre-js* are files for use with
-# Emscripten's --extern-pre-js and --extern-post-js flags. These
-# rules make different copies for the vanilla and ESM builds.
-extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js
-extern-post-js.js.vanilla := $(dir.tmp)/extern-post-js.vanilla.js
-extern-post-js.js.esm := $(dir.tmp)/extern-post-js.esm.js
-extern-post-js.js.bundler-friendly := $(dir.tmp)/extern-post-js.bundler-friendly.js
-$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.vanilla),$(c-pp.D.vanilla)))
-$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.esm),$(c-pp.D.esm)))
-$(eval $(call C-PP.FILTER,$(extern-post-js.js.in),$(extern-post-js.js.bundler-friendly),$(c-pp.D.bundler-friendly)))
-extern-pre-js.js := $(dir.api)/extern-pre-js.js
-
-# Emscripten flags for --[extern-][pre|post]-js=... for the
-# various builds.
-pre-post-common.flags := \
- --extern-pre-js=$(sqlite3-license-version.js)
-pre-post-common.flags.vanilla := \
- $(pre-post-common.flags) \
- --post-js=$(post-js.js.vanilla) \
- --extern-post-js=$(extern-post-js.js.vanilla)
-pre-post-common.flags.esm := \
- $(pre-post-common.flags) \
- --post-js=$(post-js.js.esm) \
- --extern-post-js=$(extern-post-js.js.esm)
-pre-post-common.flags.bundler-friendly := \
- $(pre-post-common.flags) \
- --post-js=$(post-js.js.bundler-friendly) \
- --extern-post-js=$(extern-post-js.js.bundler-friendly)
-
-# pre-post-jses.deps.* = a list of dependencies for the
-# --[extern-][pre/post]-js files.
-pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js)
-pre-post-jses.deps.vanilla := $(pre-post-jses.deps.common) \
- $(post-js.js.vanilla) $(extern-post-js.js.vanilla)
-pre-post-jses.deps.esm := $(pre-post-jses.deps.common) \
- $(post-js.js.esm) $(extern-post-js.js.esm)
-pre-post-jses.deps.bundler-friendly := $(pre-post-jses.deps.common) \
- $(post-js.js.bundler-friendly) $(extern-post-js.js.bundler-friendly)
-
-########################################################################
-# call-make-pre-js is a $(call)able which creates rules for
-# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf
-# this pre-js is for (one of: sqlite3, sqlite3-wasm). $2 is the build
-# mode: one of (vanilla, esm, bundler-friendly). This sets up
-# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and
-# dependencies in $(pre-post-$(1).deps.$(2)).
-define call-make-pre-js
-pre-post-$(1).flags.$(2) ?=
-$$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE)
- cp $$(pre-js.js.$(2)) $$@
- @if [ sqlite3-wasmfs = $(1) ]; then \
- echo "delete Module[xNameOfInstantiateWasm] /*for WASMFS build*/;"; \
- elif [ sqlite3 != $(1) ]; then \
- echo "Module[xNameOfInstantiateWasm].uri = '$(1).wasm';"; \
- fi >> $$@
-pre-post-$(1).deps.$(2) := \
- $$(pre-post-jses.deps.$(2)) \
- $$(dir.tmp)/pre-js-$(1)-$(2).js
-pre-post-$(1).flags.$(2) += \
- $$(pre-post-common.flags.$(2)) \
- --pre-js=$$(dir.tmp)/pre-js-$(1)-$(2).js
-endef
-# /post-js and pre-js
-########################################################################
-
########################################################################
# emcc flags for .c/.o/.wasm/.js.
emcc.flags :=
@@ -632,7 +497,6 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED
# such constructs are found all over the place in the source code.
########################################################################
-
########################################################################
# -sSINGLE_FILE:
# https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
@@ -644,9 +508,74 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED
# -g3 debugging info, _huge_.
########################################################################
-sqlite3.js := $(dir.dout)/sqlite3.js
-sqlite3.mjs := $(dir.dout)/sqlite3.mjs
-sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs
+$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
+ @echo "Making $@..."
+ @{ \
+ echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
+ echo -n ' sqlite3.version = '; \
+ $(bin.version-info) --json; \
+ echo ';'; \
+ echo '});'; \
+ } > $@
+$(sqlite3-license-version.js): $(sqlite3.h) $(sqlite3-license-version-header.js) \
+ $(MAKEFILE)
+ @echo "Making $@..."; { \
+ cat $(sqlite3-license-version-header.js); \
+ echo '/*'; \
+ echo '** This code was built from sqlite3 version...'; \
+ echo "**"; \
+ awk -e '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' \
+ -e '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
+ echo "**"; \
+ echo "** Using the Emscripten SDK version $(emcc.version)."; \
+ echo '*/'; \
+ } > $@
+
+########################################################################
+# --post-js and --pre-js are emcc flags we use to append/prepend JS to
+# the generated emscripten module file. These rules set up the core
+# pre/post files for use by the various builds.
+pre-js.js.in := $(dir.api)/pre-js.c-pp.js
+post-js.js.in := $(dir.tmp)/post-js.c-pp.js
+post-jses.js := \
+ $(dir.api)/post-js-header.js \
+ $(sqlite3-api.js.in) \
+ $(dir.api)/post-js-footer.js
+$(post-js.js.in): $(post-jses.js) $(MAKEFILE)
+ @echo "Making $@..."
+ @for i in $(post-jses.js); do \
+ echo "/* BEGIN FILE: $$i */"; \
+ cat $$i; \
+ echo "/* END FILE: $$i */"; \
+ done > $@
+
+
+########################################################################
+# call-make-pre-post is a $(call)able which creates rules for
+# pre-js-$(1).js. $1 = the base name of the JS file on whose behalf
+# this pre-js is for (one of: sqlite3, sqlite3-wasmfs). $2 is the build
+# mode: one of (vanilla, esm, bundler-friendly). This sets up
+# --[extern-][pre/post]-js flags in $(pre-post-$(1).flags.$(2)) and
+# dependencies in $(pre-post-$(1).deps.$(2)).
+define call-make-pre-post
+pre-post-$(1).flags.$(2) ?=
+$$(dir.tmp)/pre-js-$(1)-$(2).js: $$(pre-js.js.$(2)) $$(MAKEFILE)
+ cp $$(pre-js.js.$(2)) $$@
+ @if [ sqlite3-wasmfs = $(1) ]; then \
+ echo "delete Module[xNameOfInstantiateWasm] /*for WASMFS build*/;"; \
+ elif [ sqlite3 != $(1) ]; then \
+ echo "Module[xNameOfInstantiateWasm].uri = '$(1).wasm';"; \
+ fi >> $$@
+pre-post-$(1).deps.$(2) := \
+ $$(pre-post-jses.deps.$(2)) \
+ $$(dir.tmp)/pre-js-$(1)-$(2).js
+pre-post-$(1).flags.$(2) += \
+ $$(pre-post-common.flags.$(2)) \
+ --pre-js=$$(dir.tmp)/pre-js-$(1)-$(2).js
+endef
+# /post-js and pre-js
+########################################################################
+
# Undocumented Emscripten feature: if the target file extension is
# "mjs", it defaults to ES6 module builds:
# https://github.com/emscripten-core/emscripten/issues/14383
@@ -657,14 +586,6 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c
# enough to the target speed requirements that the 500ms makes a
# difference. Thus we build all binaries against sqlite3-wasm.c
# instead of building a shared copy of sqlite3-wasm.o.
-$(eval $(call call-make-pre-js,sqlite3,vanilla))
-$(eval $(call call-make-pre-js,sqlite3,esm))
-$(eval $(call call-make-pre-js,sqlite3,bundler-friendly))
-$(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs): \
- $(MAKEFILE) $(sqlite3-wasm.c) $(EXPORTED_FUNCTIONS.api)
-$(sqlite3.js): $(pre-post-sqlite3.deps.vanilla)
-$(sqlite3.mjs): $(pre-post-sqlite3.deps.esm)
-$(sqlite3-bundler-friendly.mjs): $(pre-post-sqlite3.deps.bundler-friendly)
########################################################################
# SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js)
# and $(sqlite3.mjs). $1 = one of (vanilla, esm). $2 must be 1 for
@@ -697,31 +618,94 @@ if [ x1 = x$(1) ]; then \
fi; \
fi
endef
-define SQLITE3.xJS.RECIPE
- @echo "Building $@ ..."
- $(emcc.bin) -o $@ $(emcc_opt_full) $(emcc.flags) \
- $(emcc.jsflags) \
- $(pre-post-sqlite3.flags.$(1)) $(emcc.flags.sqlite3.$(1)) \
- $(cflags.common) $(SQLITE_OPT) $(sqlite3-wasm.c)
- @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2))
+
+# extern-post-js* and extern-pre-js* are files for use with
+# Emscripten's --extern-pre-js and --extern-post-js flags.
+extern-pre-js.js := $(dir.api)/extern-pre-js.js
+extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js
+# Emscripten flags for --[extern-][pre|post]-js=... for the
+# various builds.
+pre-post-common.flags := \
+ --extern-pre-js=$(sqlite3-license-version.js)
+# pre-post-jses.deps.* = a list of dependencies for the
+# --[extern-][pre/post]-js files.
+pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js)
+########################################################################
+# SETUP_LIB_BUILD_MODE is a $(call)'able which sets up numerous pieces
+# for one of the build modes (vanilla, esm, bundler-friendly).
+#
+# $1 = build mode name
+# $2 = 1 for ESM build mode, else 0
+# $3 = resulting sqlite-api JS/MJS file
+# $4 = resulting JS/MJS file
+# $5 = -D... flags for $(bin.c-pp)
+# $6 = emcc -sXYZ flags
+define SETUP_LIB_BUILD_MODE
+$(info Setting up build [$(1)]: $(4))
+c-pp.D.$(1) := $(5)
+pre-js.js.$(1) := $$(dir.api)/pre-js.$(1).js
+$$(eval $$(call C-PP.FILTER,$$(pre-js.js.in),$$(pre-js.js.$(1)),$$(c-pp.D.$(1))))
+post-js.js.$(1) := $$(dir.tmp)/post-js.$(1).js
+$$(eval $$(call C-PP.FILTER,$$(post-js.js.in),$$(post-js.js.$(1)),$$(c-pp.D.$(1))))
+extern-post-js.js.$(1) := $$(dir.tmp)/extern-post-js.$(1).js
+$$(eval $$(call C-PP.FILTER,$$(extern-post-js.js.in),$$(extern-post-js.js.$(1)),$$(c-pp.D.$(1))))
+pre-post-common.flags.$(1) := \
+ $$(pre-post-common.flags) \
+ --post-js=$$(post-js.js.$(1)) \
+ --extern-post-js=$$(extern-post-js.js.$(1))
+pre-post-jses.deps.$(1) := $$(pre-post-jses.deps.common) \
+ $$(post-js.js.$(1)) $$(extern-post-js.js.$(1))
+$$(eval $$(call call-make-pre-post,sqlite3,$(1)))
+emcc.flags.sqlite3.$(1) := $(6)
+$$(eval $$(call C-PP.FILTER, $$(sqlite3-api.js.in), $(3), $(5)))
+$(4): $(3)
+$(4): $(3) $$(MAKEFILE) $$(sqlite3-wasm.c) $$(EXPORTED_FUNCTIONS.api) $$(pre-post-sqlite3.deps.$(1))
+ @echo "Building $$@ ..."
+ $$(emcc.bin) -o $$@ $$(emcc_opt_full) $$(emcc.flags) \
+ $$(emcc.jsflags) \
+ $$(pre-post-sqlite3.flags.$(1)) $$(emcc.flags.sqlite3.$(1)) \
+ $$(cflags.common) $$(SQLITE_OPT) $$(sqlite3-wasm.c)
+ @$$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2))
@if [ bundler-friendly = $(1) ]; then \
- echo "Patching sqlite3-bundler-friendly.js for sqlite3.wasm..."; \
- rm -f $(dir.dout)/sqlite3-bundler-friendly.wasm; \
- sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $@ || exit $$?; \
+ echo "Patching $(3) for sqlite3.wasm..."; \
+ rm -f $$(dir.dout)/sqlite3-bundler-friendly.wasm; \
+ sed -i -e 's/sqlite3-bundler-friendly.wasm/sqlite3.wasm/g' $$@ || exit $$$$?; \
fi
- chmod -x $(sqlite3.wasm)
- $(maybe-wasm-strip) $(sqlite3.wasm)
- @ls -la $@ $(sqlite3.wasm)
+ chmod -x $$(sqlite3.wasm)
+ $$(maybe-wasm-strip) $$(sqlite3.wasm)
+ @ls -la $@ $$(sqlite3.wasm)
+all: $(4)
+quick: $(4)
+CLEAN_FILES += $(3) $(4)
endef
-emcc.flags.sqlite3.vanilla :=
-emcc.flags.sqlite3.esm := -sEXPORT_ES6 -sUSE_ES6_IMPORT_META
-emcc.flags.sqlite3.bundler-friendly := $(emcc.flags.sqlite3.esm)
-$(sqlite3.js):
- $(call SQLITE3.xJS.RECIPE,vanilla,0)
-$(sqlite3.mjs):
- $(call SQLITE3.xJS.RECIPE,esm,1)
-$(sqlite3-bundler-friendly.mjs):
- $(call SQLITE3.xJS.RECIPE,bundler-friendly,1)
+# ^^^ /SETUP_LIB_BUILD_MODE
+########################################################################
+sqlite3-api.js := $(dir.dout)/sqlite3-api.js
+sqlite3.js := $(dir.dout)/sqlite3.js
+sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs
+sqlite3.mjs := $(dir.dout)/sqlite3.mjs
+sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs
+sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs
+# Maintenance reminder: careful not to introduce spaces around args $1, $2
+#$(info $(call SETUP_LIB_BUILD_MODE,vanilla,0, $(sqlite3-api.js), $(sqlite3.js)))
+$(eval $(call SETUP_LIB_BUILD_MODE,vanilla,0, $(sqlite3-api.js), $(sqlite3.js)))
+$(eval $(call SETUP_LIB_BUILD_MODE,esm,1, $(sqlite3-api.mjs), $(sqlite3.mjs), \
+ -Dtarget=es6-module, -sEXPORT_ES6 -sUSE_ES6_IMPORT_META))
+$(eval $(call SETUP_LIB_BUILD_MODE,bundler-friendly,1,\
+ $(sqlite3-api-bundler-friendly.mjs),$(sqlite3-bundler-friendly.mjs),\
+ $(c-pp.D.esm) -Dtarget=es6-bundler-friendly, $(emcc.flags.sqlite3.esm)))
+# The various -D... values used by *.c-pp.js include:
+#
+# -Dtarget=es6-module: for all ESM module builds
+#
+# -Dtarget=es6-module -Dtarget=es6-bundler-friendly: intended for
+# "bundler-friendly" ESM module build. These have some restrictions
+# on how URL() objects are constructed in some contexts: URLs which
+# refer to files which are part of this project must be references
+# as string literals so that bundlers' static-analysis tools can
+# find those files and include them in their bundles.
+#
+########################################################################
########################################################################
# We have to ensure that we do not build both $(sqlite3.js) and
# $(sqlite3.mjs) in parallel because both result in the creation of
@@ -734,14 +718,7 @@ $(sqlite3.mjs): $(sqlite3.js)
$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs)
# maintenance reminder: the deps on ^^^ must all be such that they are
# never built in parallel.
-CLEAN_FILES += $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) \
- $(sqlite3.wasm)
-all: $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs)
-quick: $(sqlite3.js)
-quick: $(sqlite3.mjs) # for the sake of the snapshot build
-quick: $(sqlite3-bundler-friendly.mjs) # for the sake of the snapshot build
-# End main $(sqlite3.js) build
-########################################################################
+CLEAN_FILES += $(sqlite3.wasm)
########################################################################
# batch-runner.js is part of one of the test apps which reads in SQL
@@ -818,7 +795,7 @@ speedtest1.js := $(dir.dout)/speedtest1.js
speedtest1.wasm := $(dir.dout)/speedtest1.wasm
cflags.speedtest1 := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM
speedtest1.cses := $(speedtest1.c) $(sqlite3-wasm.c)
-$(eval $(call call-make-pre-js,speedtest1,vanilla))
+$(eval $(call call-make-pre-post,speedtest1,vanilla))
$(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \
$(pre-post-speedtest1.deps.vanilla) \
$(EXPORTED_FUNCTIONS.speedtest1)
diff --git a/manifest b/manifest
index dba0c8dd58..723b0f765d 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhance\soo1.DB.exec()\sto\ssimplify\sreturning\swhole\sresult\ssets.
-D 2023-01-28T05:09:26.765
+C Overhaul\sext/wasm/GNUmakefile\sto\sconsolidate\swhat\samounts\sto\smuch\scopy/paste/slightly-edit\sduplication\sinto\sa\ssingle\sfunction,\scalled\sonce\sper\sdistinctive\sbuild\smode\s(vanilla,\sESM,\sbundler-friendly).
+D 2023-01-28T09:11:08.421
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile 8d82b51a23f9c84c770abd72f18d95a95044a03a216e0246ebd1b3668619c77e
+F ext/wasm/GNUmakefile a32c527fb162489266c11cfbb3f0d02e9140c3e88ce884cdc1a8a79477b3cf06
F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 24d3a53dea5e596230558e233cbbd9d0288b4c394cd5ea7b650fd99bff4cde2e
-R 32ae67991ccd2fab1735177a69f90f3b
+P 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d
+R 89098a85baa5f167018e750de6e19924
U stephan
-Z eea3cf1aefbfbb83af8cc08b772c2cf0
+Z 698b42e1629b67c07c9d270103d0775e
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index ccd158bf86..a7acc799ab 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d
\ No newline at end of file
+168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682
\ No newline at end of file
From c7170350d7f7c04ec520c5fdbafeabb9eeae7cd7 Mon Sep 17 00:00:00 2001
From: stephan
Date: Sat, 28 Jan 2023 09:51:41 +0000
Subject: [PATCH 15/65] Makefile doc touchups - no code/build changes.
FossilOrigin-Name: 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7
---
ext/wasm/GNUmakefile | 34 ++++++++++++++--------------------
manifest | 12 ++++++------
manifest.uuid | 2 +-
3 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index 018d7edd53..92173e79f1 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -582,14 +582,15 @@ endef
sqlite3.wasm := $(dir.dout)/sqlite3.wasm
sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c
# sqlite3-wasm.o vs sqlite3-wasm.c: building against the latter
-# (predictably) results in a slightly faster binary, but we're close
+# (predictably) results in a slightly faster binary. We're close
# enough to the target speed requirements that the 500ms makes a
-# difference. Thus we build all binaries against sqlite3-wasm.c
-# instead of building a shared copy of sqlite3-wasm.o.
+# difference, so we build all binaries against sqlite3-wasm.c instead
+# of building a shared copy of sqlite3-wasm.o to link against.
########################################################################
-# SQLITE3.xJS.RECIPE = the $(call)able recipe body for $(sqlite3.js)
-# and $(sqlite3.mjs). $1 = one of (vanilla, esm). $2 must be 1 for
-# ES6-style builds, 0 for other builds.
+# SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3-WASMFS.xJS.RECIPE and
+# SETUP_LIB_BUILD_MODE, factored into a separate piece to avoid code
+# duplication. $1 is 1 if the build mode needs this workaround (esm,
+# bundler-friendly) and 0 if not (vanilla).
#
# Reminder for ESM builds: even if we use -sEXPORT_ES6=0, emcc _still_
# adds:
@@ -603,11 +604,6 @@ sqlite3-wasm.c := $(dir.api)/sqlite3-wasm.c
#
# Upstream RFE:
# https://github.com/emscripten-core/emscripten/issues/18237
-########################################################################
-# SQLITE3.xJS.EXPORT-DEFAULT is part of SQLITE3[-WASMFS].xJS.RECIPE,
-# factored into a separate piece to avoid code duplication. $1 is 1 if
-# the build mode needs this workaround (esm, bundler-friendly) and 0
-# if not (vanilla).
define SQLITE3.xJS.ESM-EXPORT-DEFAULT
if [ x1 = x$(1) ]; then \
echo "Fragile workaround for an Emscripten annoyance. See SQLITE3.xJS.RECIPE."; \
@@ -707,17 +703,16 @@ $(eval $(call SETUP_LIB_BUILD_MODE,bundler-friendly,1,\
#
########################################################################
########################################################################
-# We have to ensure that we do not build both $(sqlite3.js) and
-# $(sqlite3.mjs) in parallel because both result in the creation of
-# $(sqlite3.wasm). We have no(?) way to build just the .mjs file
-# without also building the .wasm file. i.e. we're building
-# $(sqlite3.wasm) multiple times, but that's apparently unavoidable
-# (and harmless, just a waste of build time).
+# We have to ensure that we do not build both $(sqlite3*.*js) in
+# parallel because both result in the creation of $(sqlite3.wasm). We
+# have no way to build just the .mjs file without also building the
+# .wasm file because the generated .mjs file has to include info about
+# the imports needed by the wasm file, so they have to be built
+# together. i.e. we're building $(sqlite3.wasm) multiple times, but
+# that's unavoidable (and harmless, just a waste of build time).
$(sqlite3.wasm): $(sqlite3.js)
$(sqlite3.mjs): $(sqlite3.js)
$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs)
-# maintenance reminder: the deps on ^^^ must all be such that they are
-# never built in parallel.
CLEAN_FILES += $(sqlite3.wasm)
########################################################################
@@ -755,7 +750,6 @@ emcc.speedtest1 += -sALLOW_MEMORY_GROWTH
emcc.speedtest1 += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.$(emcc.INITIAL_MEMORY))
emcc.speedtest1.common += -sINVOKE_RUN=0
emcc.speedtest1.common += --no-entry
-#emcc.speedtest1.common += -flto
emcc.speedtest1.common += -sABORTING_MALLOC
emcc.speedtest1.common += -sSTRICT_JS
emcc.speedtest1.common += -sMODULARIZE
diff --git a/manifest b/manifest
index 723b0f765d..2da9056d6d 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Overhaul\sext/wasm/GNUmakefile\sto\sconsolidate\swhat\samounts\sto\smuch\scopy/paste/slightly-edit\sduplication\sinto\sa\ssingle\sfunction,\scalled\sonce\sper\sdistinctive\sbuild\smode\s(vanilla,\sESM,\sbundler-friendly).
-D 2023-01-28T09:11:08.421
+C Makefile\sdoc\stouchups\s-\sno\scode/build\schanges.
+D 2023-01-28T09:51:41.063
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile a32c527fb162489266c11cfbb3f0d02e9140c3e88ce884cdc1a8a79477b3cf06
+F ext/wasm/GNUmakefile 6fee35e99b82c948a1a4675bb4d1d037800c2171274bd8ab3779fac53aca6d1a
F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d
-R 89098a85baa5f167018e750de6e19924
+P 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682
+R 63fed4ef637e391371d6a01d8747792f
U stephan
-Z 698b42e1629b67c07c9d270103d0775e
+Z ef029a1e60dbc16f9c5e60c686e321d3
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index a7acc799ab..499905f2a1 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682
\ No newline at end of file
+3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7
\ No newline at end of file
From 54c9250b09c18507b0a169200219b2d351f6865f Mon Sep 17 00:00:00 2001
From: dan
Date: Sat, 28 Jan 2023 16:37:30 +0000
Subject: [PATCH 16/65] Update sqllimits1.test to account for the fact that if
an odd value is specified as the length in bytes of a utf-16 string, it is
truncated to the largest smaller even number.
FossilOrigin-Name: 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398
---
manifest | 14 ++++++------
manifest.uuid | 2 +-
test/sqllimits1.test | 54 +++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/manifest b/manifest
index 2da9056d6d..2df45c6199 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Makefile\sdoc\stouchups\s-\sno\scode/build\schanges.
-D 2023-01-28T09:51:41.063
+C Update\ssqllimits1.test\sto\saccount\sfor\sthe\sfact\sthat\sif\san\sodd\svalue\sis\sspecified\sas\sthe\slength\sin\sbytes\sof\sa\sutf-16\sstring,\sit\sis\struncated\sto\sthe\slargest\ssmaller\seven\snumber.
+D 2023-01-28T16:37:30.454
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -1524,7 +1524,7 @@ F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
F test/spellfix4.test 51c7c26514ade169855c66bcf130bd5acfb4d7fd090cc624645ab275ae6a41fb
F test/sqldiff1.test 182058e09c7082de5c6a470ff9c291337bbeb650052c2cc68fbb3d7e25861d91
-F test/sqllimits1.test 69d110987dbdb4bea9dbc3f151c93b4697ae6cd7e6c3a519119dc1140c8607fd
+F test/sqllimits1.test b28e5cc8d337aaf290614d96a47e8fbfb720bb7ad35620c9d5432996fd413ac4
F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a
F test/startup.c 1beb5ca66fcc0fce95c3444db9d1674f90fc605499a574ae2434dcfc10d22805
F test/stat.test 123212a20ceb496893d5254a5f6c76442ce549fdc08d1702d8288a2bbaac8408
@@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 168e5a93013d8650c180e19788e5f301b5d5ae8501d0ce728004fd750ca9e682
-R 63fed4ef637e391371d6a01d8747792f
-U stephan
-Z ef029a1e60dbc16f9c5e60c686e321d3
+P 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7
+R df4d514a8cefe2ba4ba7ec67cb263215
+U dan
+Z 6dd497de705b6f37d14013dd4a408f6f
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 499905f2a1..36a4397e7f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7
\ No newline at end of file
+74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398
\ No newline at end of file
diff --git a/test/sqllimits1.test b/test/sqllimits1.test
index 1c3f66b7fa..f16208f234 100644
--- a/test/sqllimits1.test
+++ b/test/sqllimits1.test
@@ -16,6 +16,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+set testprefix sqllimits1
# Verify that the default per-connection limits are the same as
# the compile-time hard limits.
@@ -347,7 +348,7 @@ do_test sqllimits1-5.14.6 {
} {SQLITE_TOOBIG}
ifcapable utf16 {
do_test sqllimits1-5.14.7 {
- catch {sqlite3_bind_text16 $::STMT 1 $::str1 $np1} res
+ catch {sqlite3_bind_text16 $::STMT 1 $::str1 [expr $np1+1]} res
set res
} {SQLITE_TOOBIG}
}
@@ -923,4 +924,55 @@ do_catchsql_test sqllimits1-18.2 {
UNION VALUES(11);
} {1 {too many terms in compound SELECT}}
+#-------------------------------------------------------------------------
+#
+reset_db
+ifcapable utf16 {
+ do_execsql_test 19.0 {
+ PRAGMA encoding = 'utf16';
+ }
+ set bigstr [string repeat abcdefghij 5000]
+ set bigstr16 [encoding convertto unicode $bigstr]
+
+ do_test 19.1 {
+ string length $bigstr16
+ } {100000}
+
+ do_test 19.2 {
+ set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL]
+ sqlite3_bind_text16 $::stmt 1 $bigstr16 100000
+ sqlite3_step $::stmt
+ set val [sqlite3_column_int $::stmt 0]
+ sqlite3_finalize $::stmt
+ set val
+ } {50000}
+
+ sqlite3_limit db SQLITE_LIMIT_LENGTH 100000
+
+ do_test 19.3 {
+ set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL]
+ sqlite3_bind_text16 $::stmt 1 $bigstr16 100000
+ sqlite3_step $::stmt
+ set val [sqlite3_column_int $::stmt 0]
+ sqlite3_finalize $::stmt
+ set val
+ } {50000}
+
+ sqlite3_limit db SQLITE_LIMIT_LENGTH 99999
+
+ do_test 19.4 {
+ set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL]
+ list [catch { sqlite3_bind_text16 $::stmt 1 $bigstr16 100000 } msg] $msg
+ } {1 SQLITE_TOOBIG}
+ sqlite3_finalize $::stmt
+
+ sqlite3_limit db SQLITE_LIMIT_LENGTH 100000
+
+ do_test 19.5 {
+ set ::stmt [sqlite3_prepare db "SELECT length( ? )" -1 TAIL]
+ list [catch { sqlite3_bind_text16 $::stmt 1 $bigstr16 100002 } msg] $msg
+ } {1 SQLITE_TOOBIG}
+ sqlite3_finalize $::stmt
+}
+
finish_test
From 20438431c88c2852a501765c7dbb57c3fc5f45ed Mon Sep 17 00:00:00 2001
From: dan
Date: Sat, 28 Jan 2023 17:37:37 +0000
Subject: [PATCH 17/65] Fix a problem causing "PRAGMA quick_check" to return
spurious corruption errors for a WITHOUT ROWID for which all columns are
either virtual or part of the primary key, and for which the order of the
columns in the primary key definition is different from the order in the
table.
FossilOrigin-Name: a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
---
manifest | 13 +++++++------
manifest.uuid | 2 +-
src/pragma.c | 19 ++++++++++++++-----
test/quickcheck.test | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 56 insertions(+), 12 deletions(-)
create mode 100644 test/quickcheck.test
diff --git a/manifest b/manifest
index 2df45c6199..4d88d8d4a4 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\ssqllimits1.test\sto\saccount\sfor\sthe\sfact\sthat\sif\san\sodd\svalue\sis\sspecified\sas\sthe\slength\sin\sbytes\sof\sa\sutf-16\sstring,\sit\sis\struncated\sto\sthe\slargest\ssmaller\seven\snumber.
-D 2023-01-28T16:37:30.454
+C Fix\sa\sproblem\scausing\s"PRAGMA\squick_check"\sto\sreturn\sspurious\scorruption\serrors\sfor\sa\sWITHOUT\sROWID\sfor\swhich\sall\scolumns\sare\seither\svirtual\sor\spart\sof\sthe\sprimary\skey,\sand\sfor\swhich\sthe\sorder\sof\sthe\scolumns\sin\sthe\sprimary\skey\sdefinition\sis\sdifferent\sfrom\sthe\sorder\sin\sthe\stable.
+D 2023-01-28T17:37:37.660
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -613,7 +613,7 @@ F src/parse.y 8e67d820030d2655b9942ffe61c1e7e6b96cea2f2f72183533299393907d0564
F src/pcache.c f4268f7f73c6a3db12ce22fd25bc68dc42315d19599414ab1207d7cf32f79197
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c dee95e3cd2b61e6512dc814c5ab76d5eb36f0bfc9441dbb4260fccc0d12bbddc
-F src/pragma.c 23e74aaa441a03e6d97098db5883f53ee50cc50d294ecefb916437b8484012b3
+F src/pragma.c 82d5090a35eac75876d3b41f48d06b2370553c9576bf2942233c462e03eb94c9
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c ce87a08cfddd45a147150db34190b1986f2d4a0e0828858cb6bd908c78fb02e3
F src/printf.c ff4b05e38bf928ff1b80d3dda4f977b10fe39ecbfe69c018224c7e5594fb2455
@@ -1388,6 +1388,7 @@ F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/pushdown.test f270b8071c02efc218430e0d388c155e1962eaa1d3a3ab186dd38ad6d7e178a4
F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
+F test/quickcheck.test f86b25b33455af0189b4d3fe7bd6e553115e80b2d7ec9bbe9a6b37fce0881bfe
F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26
F test/quota.test bfb269ce81ea52f593f9648316cd5013d766dd2a
F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8
@@ -2044,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3458a481b9ee391122dba531358d664d5219ce4a58cbce93d07df57cc64dc2c7
-R df4d514a8cefe2ba4ba7ec67cb263215
+P 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398
+R bd3038bc22be97846ba0cea160d15dc3
U dan
-Z 6dd497de705b6f37d14013dd4a408f6f
+Z be0e76aa8633e358a87d4d35c141ada3
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 36a4397e7f..ee3c2b5a3e 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398
\ No newline at end of file
+a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
\ No newline at end of file
diff --git a/src/pragma.c b/src/pragma.c
index 527b2a734c..522a12d331 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1785,12 +1785,21 @@ void sqlite3Pragma(
** will also prepopulate the cursor column cache that is used
** by the OP_IsType code, so it is a required step.
*/
- mxCol = pTab->nCol-1;
- while( mxCol>=0
- && ((pTab->aCol[mxCol].colFlags & COLFLAG_VIRTUAL)!=0
- || pTab->iPKey==mxCol) ) mxCol--;
+ assert( !IsVirtual(pTab) );
+ if( HasRowid(pTab) ){
+ mxCol = -1;
+ for(j=0; jnCol; j++){
+ if( (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)==0 ) mxCol++;
+ }
+ if( mxCol==pTab->iPKey ) mxCol--;
+ }else{
+ /* COLFLAG_VIRTUAL columns are not included in the WITHOUT ROWID
+ ** PK index column-count, so there is no need to account for them
+ ** in this case. */
+ mxCol = sqlite3PrimaryKeyIndex(pTab)->nColumn-1;
+ }
if( mxCol>=0 ){
- sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, mxCol, 3);
+ sqlite3VdbeAddOp3(v, OP_Column, iDataCur, mxCol, 3);
sqlite3VdbeTypeofColumn(v, 3);
}
diff --git a/test/quickcheck.test b/test/quickcheck.test
new file mode 100644
index 0000000000..94016e845f
--- /dev/null
+++ b/test/quickcheck.test
@@ -0,0 +1,34 @@
+# 2023 January 28
+#
+# 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.
+#
+#***********************************************************************
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix quickcheck
+
+do_execsql_test 1.0 {
+ CREATE TABLE t1(
+ a INTEGER NOT NULL, b INTEGER NOT NULL, c AS (a+1),
+ PRIMARY KEY(b, a)
+ ) WITHOUT ROWID;
+
+ INSERT INTO t1 VALUES(1, 2);
+ INSERT INTO t1 VALUES(3, 4);
+}
+
+do_execsql_test 1.1 {
+ PRAGMA quick_check
+} {
+ ok
+}
+
+finish_test
+
From 8cc8d36e4cd9b7a437b42f5a0a8f3763062813c5 Mon Sep 17 00:00:00 2001
From: drh <>
Date: Sat, 28 Jan 2023 21:01:33 +0000
Subject: [PATCH 18/65] Show more details about the SrcItem.fg field in
tree-trace output.
FossilOrigin-Name: 3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/treeview.c | 7 +++++++
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 4d88d8d4a4..06a3b193ba 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\scausing\s"PRAGMA\squick_check"\sto\sreturn\sspurious\scorruption\serrors\sfor\sa\sWITHOUT\sROWID\sfor\swhich\sall\scolumns\sare\seither\svirtual\sor\spart\sof\sthe\sprimary\skey,\sand\sfor\swhich\sthe\sorder\sof\sthe\scolumns\sin\sthe\sprimary\skey\sdefinition\sis\sdifferent\sfrom\sthe\sorder\sin\sthe\stable.
-D 2023-01-28T17:37:37.660
+C Show\smore\sdetails\sabout\sthe\sSrcItem.fg\sfield\sin\stree-trace\soutput.
+D 2023-01-28T21:01:33.369
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -685,7 +685,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 1305797eab3542a0896b552c6e7669c972c1468e11e92b370533c1f37a37082b
-F src/treeview.c 29b1dc7e0f84ba090734febe27393d4719682af0cae1b902d5ebf0236ecebea4
+F src/treeview.c fccf3b8c517c1f55cb380c1522febe6921fcb2bd800c16c78cab571d0eb0ccbd
F src/trigger.c 5e68b790f022b8dafbfb0eb244786512a95c9575fc198719d2557d73e5795858
F src/update.c f118e51768d2c1309e3c81e9f91141b22b8a1339cbc5969b1b2d810feaa25b22
F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
@@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398
-R bd3038bc22be97846ba0cea160d15dc3
-U dan
-Z be0e76aa8633e358a87d4d35c141ada3
+P a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
+R 92c8f8e400ced672286c461a5d51f1a5
+U drh
+Z b3d362fa27b1bfd30226a85010f3f7a0
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index ee3c2b5a3e..c6abe9a9a7 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
\ No newline at end of file
+3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97
\ No newline at end of file
diff --git a/src/treeview.c b/src/treeview.c
index 9df16a12bf..9f630b1561 100644
--- a/src/treeview.c
+++ b/src/treeview.c
@@ -218,6 +218,13 @@ void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
sqlite3_str_appendf(&x, " ON");
}
+ if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc");
+ if( pItem->fg.isCorrelated ) sqlite3_str_appendf(&x, " isCorrelated");
+ if( pItem->fg.isMaterialized ) sqlite3_str_appendf(&x, " isMaterialized");
+ if( pItem->fg.viaCoroutine ) sqlite3_str_appendf(&x, " viaCoroutine");
+ if( pItem->fg.notCte ) sqlite3_str_appendf(&x, " notCte");
+ if( pItem->fg.isNestedFrom ) sqlite3_str_appendf(&x, " isNestedFrom");
+
sqlite3StrAccumFinish(&x);
sqlite3TreeViewItem(pView, zLine, inSrc-1);
n = 0;
From 05a377fd466f7546f8ed979925a2c5bfeb6f70ed Mon Sep 17 00:00:00 2001
From: dan
Date: Sat, 28 Jan 2023 21:06:15 +0000
Subject: [PATCH 19/65] Do not assume that sub-queries that contain window
functions are uncorrelated.
FossilOrigin-Name: f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac
---
manifest | 14 +++++++-------
manifest.uuid | 2 +-
src/window.c | 1 +
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/manifest b/manifest
index 06a3b193ba..99b0ff4c5e 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Show\smore\sdetails\sabout\sthe\sSrcItem.fg\sfield\sin\stree-trace\soutput.
-D 2023-01-28T21:01:33.369
+C Do\snot\sassume\sthat\ssub-queries\sthat\scontain\swindow\sfunctions\sare\suncorrelated.
+D 2023-01-28T21:06:15.825
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -711,7 +711,7 @@ F src/where.c e75ca01cc4025c0023a4e32c137ad933ecaf1d5fbaf9f88ffae7db216ac2f762
F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c
F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2
F src/whereexpr.c 7c5671a04b00c876bec5e99fd4e6f688065feb4773160fbf76fd7900d2901777
-F src/window.c 9ea4dc243420e029586c8e1ed5929fad2eae438279341ae9defc66e8f905aabc
+F src/window.c 76a27cff9ea2ded0c2c3527187029259440fabcc4cc4c07b11d942c78494a614
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9
@@ -2045,8 +2045,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
-R 92c8f8e400ced672286c461a5d51f1a5
-U drh
-Z b3d362fa27b1bfd30226a85010f3f7a0
+P 3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97
+R 15c7aa257d7f9f8322c2cff93b9d4aee
+U dan
+Z b5cdea142483e57c2a66955139fc295d
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index c6abe9a9a7..b782372af7 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97
\ No newline at end of file
+f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac
\ No newline at end of file
diff --git a/src/window.c b/src/window.c
index 8dd35ee30b..56de38ba39 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1079,6 +1079,7 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
if( p->pSrc ){
Table *pTab2;
p->pSrc->a[0].pSelect = pSub;
+ p->pSrc->a[0].fg.isCorrelated = 1;
sqlite3SrcListAssignCursors(pParse, p->pSrc);
pSub->selFlags |= SF_Expanded|SF_OrderByReqd;
pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE);
From 2f5330036d19b0dcbf82f7a29c6192ce7ca9df93 Mon Sep 17 00:00:00 2001
From: stephan
Date: Sun, 29 Jan 2023 05:09:39 +0000
Subject: [PATCH 20/65] Correct the handling of the worker1 and promiser JS
files in the face of the bundler-friendly changes. Those files require
separate, bundler-friendly copies.
FossilOrigin-Name: 9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10
---
ext/wasm/GNUmakefile | 27 ++++++++++++++++++++++++---
ext/wasm/README-dist.txt | 9 ++++++---
ext/wasm/dist.make | 22 +++++++++++++++-------
ext/wasm/index.html | 2 +-
manifest | 20 ++++++++++----------
manifest.uuid | 2 +-
6 files changed, 57 insertions(+), 25 deletions(-)
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index 92173e79f1..7ffd866f24 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -327,8 +327,6 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js
# "External" API files which are part of our distribution
# but not part of the sqlite3-api.js amalgamation.
SOAP.js := $(dir.api)/sqlite3-opfs-async-proxy.js
-sqlite3-worker1.js := $(dir.api)/sqlite3-worker1.js
-sqlite3-worker1-promiser.js := $(dir.api)/sqlite3-worker1-promiser.js
# COPY_XAPI = a $(call)able function to copy $1 to $(dir.dout), where
# $1 must be one of the "external" JS API files.
define COPY_XAPI
@@ -336,7 +334,7 @@ sqlite3-api.ext.jses += $$(dir.dout)/$$(notdir $(1))
$$(dir.dout)/$$(notdir $(1)): $(1) $$(MAKEFILE)
cp $$< $$@
endef
-$(foreach X,$(SOAP.js) $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js),\
+$(foreach X,$(SOAP.js),\
$(eval $(call COPY_XAPI,$(X))))
all quick: $(sqlite3-api.ext.jses)
q: quick
@@ -715,6 +713,29 @@ $(sqlite3.mjs): $(sqlite3.js)
$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs)
CLEAN_FILES += $(sqlite3.wasm)
+########################################################################
+# We need separate copies of certain supplementary JS files for the
+# bundler-friendly build. Concretely, any supplemental JS files which
+# themselves use importScripts() or Workers or URL() constructors
+# which refer to other in-tree (m)JS files quire a bundler-friendly
+# copy.
+sqlite3-worker1.js.in := $(dir.api)/sqlite3-worker1.c-pp.js
+sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js
+sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js
+sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js
+sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.js
+sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js
+$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js)))
+$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\
+ $(c-pp.D.bundler-friendly)))
+$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js)))
+$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\
+ $(sqlite3-worker1-promiser-bundler-friendly.js),\
+ $(c-pp.D.bundler-friendly)))
+$(sqlite3-bundler-friendly.mjs): $(sqlite3-worker1-bundler-friendly.js) \
+ $(sqlite3-worker1-promiser-bundler-friendly.js)
+$(sqlite3.js) $(sqlite3.mjs): $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js)
+
########################################################################
# batch-runner.js is part of one of the test apps which reads in SQL
# dumps generated by $(speedtest1) and executes them.
diff --git a/ext/wasm/README-dist.txt b/ext/wasm/README-dist.txt
index db0862628b..6656a2072a 100644
--- a/ext/wasm/README-dist.txt
+++ b/ext/wasm/README-dist.txt
@@ -11,9 +11,12 @@ build:
- jswasm/sqlite3.mjs is the same but in ES6 module form
-- jswasm/sqlite3-bundler-friendly.mjs is the same as the ES6 module
- with small tweaks to make it compatible with "bundler" tools
- commonly seen in node.js-based projects.
+- jswasm/*-bundler-friendly.js and .mjs are variants which are
+ intended to be compatible with "bundler" tools commonly seen in
+ node.js-based projects. Projects using such tools should use those
+ variants, where available, instead of files without the
+ "-bundler-friendly" suffix. Some files do not have separate
+ variants.
- jswasm/sqlite3.wasm is the binary WASM file imported by all of the
above-listed JS files.
diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make
index ffc2613703..d2fa920be7 100644
--- a/ext/wasm/dist.make
+++ b/ext/wasm/dist.make
@@ -56,6 +56,18 @@ dist.common.extras := \
$(dir.common)/SqliteTestUtil.js
.PHONY: dist snapshot
+define DIST_STRIP_COMMENTS
+# $1 = source js file
+# $2 = flags for $(bin.stripcomments)
+$(bin.stripccomments) $(2) < $(1) > $(dist-dir.jswasm)/$(notdir $(1));
+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-worker1-promiser-bundler-friendly.js)
+# 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)
########################################################################
# dist: create the end-user deliverable archive.
#
@@ -71,7 +83,7 @@ dist.common.extras := \
# target name equal to the archive name.
dist: \
$(bin.stripccomments) $(bin.version-info) \
- $(dist.build) \
+ $(dist.build) $(STRIP_K1.js) $(STRIP_K2.js) \
$(MAKEFILE) $(MAKEFILE.dist)
@echo "Making end-user deliverables..."
@rm -fr $(dist-dir.top)
@@ -80,12 +92,8 @@ dist: \
@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)
- @$(bin.stripccomments) -k -k < $(sqlite3.js) \
- > $(dist-dir.jswasm)/$(notdir $(sqlite3.js))
- @$(bin.stripccomments) -k -k < $(sqlite3.mjs) \
- > $(dist-dir.jswasm)/$(notdir $(sqlite3.mjs))
- @$(bin.stripccomments) -k -k < $(sqlite3-bundler-friendly.mjs) \
- > $(dist-dir.jswasm)/$(notdir $(sqlite3-bundler-friendly.mjs))
+ $(foreach JS,$(STRIP_K1.js),$(call DIST_STRIP_COMMENTS,$(JS),-k))
+ $(foreach JS,$(STRIP_K2.js),$(call DIST_STRIP_COMMENTS,$(JS),-k -k))
@cp -p $(dist.common.extras) $(dist-dir.common)
@set -e; \
vnum=$$($(bin.version-info) --download-version); \
diff --git a/ext/wasm/index.html b/ext/wasm/index.html
index 767cc5e74a..969d9553eb 100644
--- a/ext/wasm/index.html
+++ b/ext/wasm/index.html
@@ -131,7 +131,7 @@