From 956392694abaaa832ec3186f7b6af5043f71e623 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Oct 2022 15:38:03 +0000 Subject: [PATCH 1/7] Add a top-level license and build-time version info header to generated sqlite3*.js. Correct a broken link in ext/wasm/index.html. FossilOrigin-Name: 0f1a06e8e39a1fbc74f1aff9cc59787282dfbf847d6c5c7edb3f7d410db0e4b7 --- ext/wasm/GNUmakefile | 24 ++++++++++++++--- ext/wasm/api/extern-post-js.js | 3 ++- ext/wasm/api/extern-pre-js.js | 3 +++ ext/wasm/api/post-js-footer.js | 3 ++- ext/wasm/api/pre-js.js | 7 +++++ ext/wasm/api/sqlite3-api-cleanup.js | 27 +++++++++---------- .../api/sqlite3-license-version-header.js | 25 +++++++++++++++++ ext/wasm/index.html | 2 +- manifest | 27 ++++++++++--------- manifest.uuid | 2 +- 10 files changed, 88 insertions(+), 35 deletions(-) create mode 100644 ext/wasm/api/sqlite3-license-version-header.js diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index cf0e8b1081..c4c2886da3 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -49,6 +49,7 @@ dir.fiddle := fiddle CLEAN_FILES := *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ emcc_enable_bigint ?= 1 sqlite3.c := $(dir.top)/sqlite3.c +sqlite3.h := $(dir.top)/sqlite3.h SQLITE_OPT = \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_RTREE \ @@ -109,7 +110,7 @@ emcc_opt_full := $(emcc_opt) -g3 ######################################################################## -$(sqlite3.c): +$(sqlite3.c) $(sqlite3.h): $(MAKE) -C $(dir.top) sqlite3.c clean: @@ -130,7 +131,10 @@ EXPORTED_FUNCTIONS.api: $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE) cat $(EXPORTED_FUNCTIONS.api.in) > $@ CLEAN_FILES += EXPORTED_FUNCTIONS.api -sqlite3-api.jses := $(dir.api)/sqlite3-api-prologue.js +sqlite3-license-version.js := sqlite3-license-version.js +sqlite3-license-version-header.js := $(dir.api)/sqlite3-license-version-header.js +sqlite3-api.jses := $(sqlite3-license-version.js) +sqlite3-api.jses += $(dir.api)/sqlite3-api-prologue.js sqlite3-api.jses += $(dir.common)/whwasmutil.js sqlite3-api.jses += $(dir.jacc)/jaccwabyt.js sqlite3-api.jses += $(dir.api)/sqlite3-api-glue.js @@ -141,6 +145,7 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js sqlite3-api.js := sqlite3-api.js CLEAN_FILES += $(sqlite3-api.js) +CLEAN_FILES += $(sqlite3-license-version.js) $(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE) @echo "Making $@..." @for i in $(sqlite3-api.jses); do \ @@ -171,9 +176,20 @@ extern-pre-js.js := $(dir.api)/extern-pre-js.js pre-post-common.flags := \ --post-js=$(post-js.js) \ --extern-post-js=$(extern-post-js.js) \ - --extern-pre-js=$(extern-pre-js.js) + --extern-pre-js=$(dir.wasm)/$(sqlite3-license-version.js) pre-post-jses.deps := $(post-js.js) \ - $(extern-post-js.js) $(extern-pre-js.js) + $(extern-post-js.js) $(extern-pre-js.js) $(sqlite3-license-version.js) +$(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 '*/'; \ + } > $@ + ######################################################################## # call-make-pre-js creates rules for pre-js-$(1).js. $1 = the base # name of the JS file on whose behalf this pre-js is for. diff --git a/ext/wasm/api/extern-post-js.js b/ext/wasm/api/extern-post-js.js index 5ebb5a31e7..51e8d12b2b 100644 --- a/ext/wasm/api/extern-post-js.js +++ b/ext/wasm/api/extern-post-js.js @@ -1,5 +1,6 @@ /* extern-post-js.js must be appended to the resulting sqlite3.js - file. */ + file. It gets its name from being used as the value for + the --extern-post-js=... Emscripten flag. */ (function(){ /** In order to hide the sqlite3InitModule()'s resulting Emscripten diff --git a/ext/wasm/api/extern-pre-js.js b/ext/wasm/api/extern-pre-js.js index 26d066d2ee..7d47d33e33 100644 --- a/ext/wasm/api/extern-pre-js.js +++ b/ext/wasm/api/extern-pre-js.js @@ -1,4 +1,7 @@ /* extern-pre-js.js must be prepended to the resulting sqlite3.js file. This file is currently only used for holding snippets during test and development. + + It gets its name from being used as the value for the + --extern-pre-js=... Emscripten flag. */ diff --git a/ext/wasm/api/post-js-footer.js b/ext/wasm/api/post-js-footer.js index ee470928ba..58882cbd9c 100644 --- a/ext/wasm/api/post-js-footer.js +++ b/ext/wasm/api/post-js-footer.js @@ -1,3 +1,4 @@ /* The current function scope was opened via post-js-header.js, which - gets prepended to this at build-time. */ + gets prepended to this at build-time. This file closes that + scope. */ })/*postRun.push(...)*/; diff --git a/ext/wasm/api/pre-js.js b/ext/wasm/api/pre-js.js index 502ecf348f..b6630416dd 100644 --- a/ext/wasm/api/pre-js.js +++ b/ext/wasm/api/pre-js.js @@ -1,3 +1,9 @@ +/** + BEGIN FILE: api/pre-js.js + + This file is intended to be prepended to the sqlite3.js build using + Emscripten's --pre-js=THIS_FILE flag (or equivalent). +*/ Module['locateFile'] = function(path, prefix) { return prefix + path; }; @@ -39,3 +45,4 @@ Module[xInstantiateWasm] = function callee(imports,onSuccess){ scripts. */ Module[xInstantiateWasm].uri = 'sqlite3.wasm'; +/* END FILE: api/pre-js.js */ diff --git a/ext/wasm/api/sqlite3-api-cleanup.js b/ext/wasm/api/sqlite3-api-cleanup.js index c2a3425891..555e5d31c5 100644 --- a/ext/wasm/api/sqlite3-api-cleanup.js +++ b/ext/wasm/api/sqlite3-api-cleanup.js @@ -20,17 +20,15 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build /** Install a suitable default configuration for sqlite3ApiBootstrap(). */ - const SABC = self.sqlite3ApiConfig || Object.create(null); - if(undefined===SABC.Module){ - SABC.Module = Module /* ==> Currently needs to be exposed here for - test code. NOT part of the public API. */; - } - if(undefined===SABC.exports){ - SABC.exports = Module['asm']; - } - if(undefined===SABC.memory){ - SABC.memory = Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */; - } + const SABC = Object.assign( + Object.create(null), { + Module: Module /* ==> Currently needs to be exposed here for + test code. NOT part of the public API. */, + exports: Module['asm'], + memory: Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */ + }, + self.sqlite3ApiConfig || Object.create(null) + ); /** For current (2022-08-22) purposes, automatically call @@ -38,10 +36,11 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build point, as we really want client code to be able to call this to configure certain parts. Clients may modify self.sqlite3ApiBootstrap.defaultConfig to tweak the default - configuration used by a no-args call to sqlite3ApiBootstrap(). + configuration used by a no-args call to sqlite3ApiBootstrap(), + but must have first loaded their WASM module in order to be + able to provide the necessary configuration state. */ //console.warn("self.sqlite3ApiConfig = ",self.sqlite3ApiConfig); - const rmApiConfig = (SABC !== self.sqlite3ApiConfig); self.sqlite3ApiConfig = SABC; let sqlite3; try{ @@ -51,7 +50,7 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build throw e; }finally{ delete self.sqlite3ApiBootstrap; - if(rmApiConfig) delete self.sqlite3ApiConfig; + delete self.sqlite3ApiConfig; } if(self.location && +self.location.port > 1024){ diff --git a/ext/wasm/api/sqlite3-license-version-header.js b/ext/wasm/api/sqlite3-license-version-header.js new file mode 100644 index 0000000000..f8b3eddc5f --- /dev/null +++ b/ext/wasm/api/sqlite3-license-version-header.js @@ -0,0 +1,25 @@ +/* +** LICENSE for the sqlite3 WebAssembly/JavaScript APIs. +** +** This bundle (typically released as sqlite3.js or sqlite3-wasmfs.js) +** is an amalgamation of JavaScript source code from two projects: +** +** 1) https://emscripten.org: the Emscripten "glue code" is covered by +** the terms of the MIT license and University of Illinois/NCSA +** Open Source License, as described at: +** +** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html +** +** 2) https://sqlite.org: all code and documentation labeled as being +** from this source are released under the same terms as the sqlite3 +** C library: +** +** 2022-10-16 +** +** 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. +*/ diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 01d178bb7a..a7f0974fbe 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -46,7 +46,7 @@
  • tester1: Core unit and regression tests for the various APIs and surrounding utility code.
  • -
  • tester1-worker: same thing +
  • tester1-worker: same thing but running in a Worker.
  • diff --git a/manifest b/manifest index df43c1449f..2f0d88b24d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\susing\sthe\spush-down\soptimization\son\scompound\sSELECTs\swhere\scomponent\sSELECTs\suse\sdifferent\scollation\ssequences.\sdbsqlfuzz\s11516f050100243e5a845f5a2b48a90ed2efaf2e. -D 2022-10-14T19:30:34.777 +C Add\sa\stop-level\slicense\sand\sbuild-time\sversion\sinfo\sheader\sto\sgenerated\ssqlite3*.js.\sCorrect\sa\sbroken\slink\sin\sext/wasm/index.html. +D 2022-10-16T15:38:03.833 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -473,22 +473,23 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c F ext/wasm/EXPORTED_RUNTIME_METHODS.fiddle 0e88c8cfc3719e4b7e74980d9da664c709e68acf863e48386cda376edfd3bfb0 -F ext/wasm/GNUmakefile 4ec270532b921c7c4b437fbdb06f6a0ce41f3bd874395ce70dbc933c8553efa9 +F ext/wasm/GNUmakefile e298b8a91fab19b758fc9e843601d50129afec1e5a6fcf4328affe3f34f40b3e F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 89983a8d122c35a90c65ec667844b95a78bcd04f3198a99c1e0c8368c1a0b03a F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 62758e8dd98741d41505f69130cc767013d2e871ebb9e4313d8f8b97d95071d8 -F ext/wasm/api/extern-post-js.js dc68cbf552d8ea085181400a6963907c32e0b088b03ffd8969b1869fea246629 -F ext/wasm/api/extern-pre-js.js 20143b16b672d0a576fbf768a786d12ee1f84e222126477072389b992542a5b2 -F ext/wasm/api/post-js-footer.js b64319261d920211b8700004d08b956a6c285f3b0bba81456260a713ed04900c +F ext/wasm/api/extern-post-js.js dfae3a5f621ae94f1fae671f8013ed6464355f11e2adda38ed8b10bf1929f337 +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 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b -F ext/wasm/api/pre-js.js 2db711eb637991b383fc6b5c0f3df65ec48a7201e5730e304beba8de2d3f9b0b -F ext/wasm/api/sqlite3-api-cleanup.js 5d22d1d3818ecacb23bfa223d5970cd0617d8cdbb48c8bc4bbd463f05b021a99 +F ext/wasm/api/pre-js.js 5b550904322d73127badd4347ca967ea525b901573559736f92d326ad9b7bb76 +F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588 F ext/wasm/api/sqlite3-api-glue.js 842dc03783aecc951a543a209523343a6fda9af258fb0bee08e8cc2dc3c4d8ae F ext/wasm/api/sqlite3-api-oo1.js 00f5cfce0989d2e08d7b21765d703c69234245d03a0cce8fcb32ccfcd53ffdbb F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616 F ext/wasm/api/sqlite3-api-prologue.js b7c82a22d50658a48463fa646a23135273bc2cfa843aedda32627ff281c12e4d F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8 +F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasm.c 4c131945ced4b08a694d287abcdb066b896d961ef79ee5241805ecc37e83d63a F ext/wasm/batch-runner.html cf1a410c92bad50fcec2ddc71390b4e9df63a6ea1bef12a5163a66a0af4d78d9 @@ -507,7 +508,7 @@ F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d695 F ext/wasm/fiddle/fiddle-worker.js 531859a471924a0ea48afa218e6877f0c164ca324d51e15843ed6ecc1c65c7ee F ext/wasm/fiddle/fiddle.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 -F ext/wasm/index.html 9ae9f9629310ed3ee88901aa14e20195815583806af245da08c2ecb43ced2243 +F ext/wasm/index.html f41ff0b3cef07196b18f3f917c46560a0d5289064d344b438b254c41ed0f2c76 F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215 F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06 @@ -2031,8 +2032,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 565d74c36f2dd4612860c7ee561682c50db28cfa5384346528292019dbfdf86c -R 75e7f9b91b017a681d1ae11ac5186379 -U dan -Z 42c84fae9e00b1c8a3d198c324edcd95 +P ed14863dd72e35fa3a23320c3d5a8166515faea39a555c28a27b2d35e701eac4 +R 664fdd2b5e755302311ec6a1ceb0cf59 +U stephan +Z 70648a34d9cd28a66a6a4694b2eeaced # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 65ef760f0e..0ece5330b0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed14863dd72e35fa3a23320c3d5a8166515faea39a555c28a27b2d35e701eac4 \ No newline at end of file +0f1a06e8e39a1fbc74f1aff9cc59787282dfbf847d6c5c7edb3f7d410db0e4b7 \ No newline at end of file From 8ffc98999d4fae6598aff02cabf63ba4c3829c95 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Oct 2022 16:38:15 +0000 Subject: [PATCH 2/7] JS: add build-time-generated version info to the sqlite3.version object. Remove some stray debug output from tester1.js. FossilOrigin-Name: b5f462c2d85d503f6492ec20580d57cb4c926712f6306a6be764bd09d1f5e8b8 --- ext/wasm/GNUmakefile | 17 +++++++++++++++++ ext/wasm/api/README.md | 4 ++++ ext/wasm/api/sqlite3-api-glue.js | 5 ----- ext/wasm/api/sqlite3-api-prologue.js | 11 +++++++++++ ext/wasm/tester1.js | 10 ++++------ ext/wasm/version-json.c | 26 ++++++++++++++++++++++++++ manifest | 21 +++++++++++---------- manifest.uuid | 2 +- 8 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 ext/wasm/version-json.c diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index c4c2886da3..45ab3b8386 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -125,6 +125,10 @@ else $(info Development build. Use '$(MAKE) release' for a smaller release build.) endif +version-json: version-json.c $(sqlite3.c) $(MAKEFILE) + $(CC) -O0 -I$(dir.top) -o $@ $(SQLITE_OPT) -DHAVE_MREMAP=0 $< $(sqlite3.c) +CLEAN_FILES := version-json + EXPORTED_FUNCTIONS.api.in := $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api EXPORTED_FUNCTIONS.api: $(EXPORTED_FUNCTIONS.api.in) $(MAKEFILE) @@ -133,11 +137,13 @@ CLEAN_FILES += EXPORTED_FUNCTIONS.api sqlite3-license-version.js := sqlite3-license-version.js sqlite3-license-version-header.js := $(dir.api)/sqlite3-license-version-header.js +sqlite3-api-build-version.js := $(dir.api)/sqlite3-api-build-version.js sqlite3-api.jses := $(sqlite3-license-version.js) sqlite3-api.jses += $(dir.api)/sqlite3-api-prologue.js sqlite3-api.jses += $(dir.common)/whwasmutil.js sqlite3-api.jses += $(dir.jacc)/jaccwabyt.js sqlite3-api.jses += $(dir.api)/sqlite3-api-glue.js +sqlite3-api.jses += $(sqlite3-api-build-version.js) sqlite3-api.jses += $(dir.api)/sqlite3-api-oo1.js sqlite3-api.jses += $(dir.api)/sqlite3-api-worker1.js sqlite3-api.jses += $(dir.api)/sqlite3-api-opfs.js @@ -146,6 +152,7 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js sqlite3-api.js := sqlite3-api.js CLEAN_FILES += $(sqlite3-api.js) CLEAN_FILES += $(sqlite3-license-version.js) +CLEAN_FILES += $(sqlite3-api-build-version.js) $(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE) @echo "Making $@..." @for i in $(sqlite3-api.jses); do \ @@ -154,6 +161,16 @@ $(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE) echo "/* END FILE: $$i */"; \ done > $@ +$(sqlite3-api-build-version.js): version-json + @echo "Making $@..." + @{ \ + echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \ + echo -n ' sqlite3.version = '; \ + ./version-json; \ + echo ';'; \ + echo '});'; \ + } > $@ + ######################################################################## # --post-js and --pre-js are emcc flags we use to append/prepend JS to # the generated emscripten module file. diff --git a/ext/wasm/api/README.md b/ext/wasm/api/README.md index edac17fa1e..dfb13c569f 100644 --- a/ext/wasm/api/README.md +++ b/ext/wasm/api/README.md @@ -48,6 +48,10 @@ browser client: Invokes functionality exposed by the previous two files to flesh out low-level parts of `sqlite3-api-prologue.js`. Most of these pieces related to the `sqlite3.capi.wasm` object. +- `sqlite3-api-build-version.js`\ + Gets created by the build process and populates the + `sqlite3.version` object. This part is not critical, but records the + version of the library against which this module was built. - `sqlite3-api-oo1.js`\ Provides a high-level object-oriented wrapper to the lower-level C API, colloquially known as OO API #1. Its API is similar to other diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js index fd1f0c3e02..bfacef3b3c 100644 --- a/ext/wasm/api/sqlite3-api-glue.js +++ b/ext/wasm/api/sqlite3-api-glue.js @@ -688,9 +688,4 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } }/*kvvfs*/ - sqlite3.version = Object.assign(Object.create(null),{ - library: sqlite3.capi.sqlite3_libversion(), - sourceId: sqlite3.capi.sqlite3_sourceid() - }); }); - diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js index a267e93454..7d9ae96914 100644 --- a/ext/wasm/api/sqlite3-api-prologue.js +++ b/ext/wasm/api/sqlite3-api-prologue.js @@ -1281,6 +1281,17 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( SQLite3Error: SQLite3Error, capi, config, + /** + Holds the version info of the sqlite3 source tree from which + the generated sqlite3-api.js gets built. Note that its version + may well differ from that reported by sqlite3_libversion(), but + that should be considered a source file mismatch, as the JS and + WASM files are intended to be built and distributed together. + + This object is initially a placeholder which gets replaced by a + build-generated object. + */ + version: Object.create(null), /** Performs any optional asynchronous library-level initialization which might be required. This function returns a Promise which diff --git a/ext/wasm/tester1.js b/ext/wasm/tester1.js index 37a992d619..72991c451c 100644 --- a/ext/wasm/tester1.js +++ b/ext/wasm/tester1.js @@ -696,10 +696,10 @@ if(autoResolvePtr){ wts.$ppV = 0; T.assert(!wts.$ppV); - WTStruct.debugFlags(0x03); + //WTStruct.debugFlags(0x03); wts.$ppV = wts; T.assert(wts === wts.$ppV) - WTStruct.debugFlags(0); + //WTStruct.debugFlags(0); } wts.setMemberCString('cstr', "A C-string."); T.assert(Array.isArray(wts.ondispose)). @@ -1022,7 +1022,7 @@ ;/*end of C/WASM utils checks*/ //////////////////////////////////////////////////////////////////////// - T.g('sqlite3.oo1 sanity checks') + T.g('sqlite3.oo1') .t('Create db', function(sqlite3){ const db = this.db = new sqlite3.oo1.DB(); T.assert(Number.isInteger(db.pointer)). @@ -1037,8 +1037,7 @@ }) //////////////////////////////////////////////////////////////////// - .t('DB.Stmt sanity checks', function(S){ - let pId; + .t('DB.Stmt', function(S){ let st = this.db.prepare( new TextEncoder('utf-8').encode("select 3 as a") ); @@ -1073,7 +1072,6 @@ .assert(false===st.step()) .assert(!st._mayGet) ; - pId = st.pointer; T.assert(0===capi.sqlite3_strglob("*.txt", "foo.txt")). assert(0!==capi.sqlite3_strglob("*.txt", "foo.xtx")). assert(0===capi.sqlite3_strlike("%.txt", "foo.txt", 0)). diff --git a/ext/wasm/version-json.c b/ext/wasm/version-json.c new file mode 100644 index 0000000000..cb5083a40a --- /dev/null +++ b/ext/wasm/version-json.c @@ -0,0 +1,26 @@ +/* +** 2022-10-16 +** +** The author disclaims copyright to this source code. In place of a +** legal notice, here is a blessing: +** +** * May you do good and not evil. +** * May you find forgiveness for yourself and forgive others. +** * May you share freely, never taking more than you give. +** +************************************************************************* +** This file simply outputs sqlite3 version information in JSON form, +** intended for embedding in the sqlite3 JS API build. +*/ +#include +#include "sqlite3.h" +int main(int argc, char const * const * argv){ + if(argc || argv){/*unused*/} + printf("{\"libVersion\": \"%s\", " + "\"libVersionNumber\": %d, " + "\"sourceId\": \"%s\"}"/*missing newline is intentional*/, + SQLITE_VERSION, + SQLITE_VERSION_NUMBER, + SQLITE_SOURCE_ID); + return 0; +} diff --git a/manifest b/manifest index 2f0d88b24d..6e78bd13e1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stop-level\slicense\sand\sbuild-time\sversion\sinfo\sheader\sto\sgenerated\ssqlite3*.js.\sCorrect\sa\sbroken\slink\sin\sext/wasm/index.html. -D 2022-10-16T15:38:03.833 +C JS:\sadd\sbuild-time-generated\sversion\sinfo\sto\sthe\ssqlite3.version\sobject.\sRemove\ssome\sstray\sdebug\soutput\sfrom\stester1.js. +D 2022-10-16T16:38:15.159 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -473,21 +473,21 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c F ext/wasm/EXPORTED_RUNTIME_METHODS.fiddle 0e88c8cfc3719e4b7e74980d9da664c709e68acf863e48386cda376edfd3bfb0 -F ext/wasm/GNUmakefile e298b8a91fab19b758fc9e843601d50129afec1e5a6fcf4328affe3f34f40b3e +F ext/wasm/GNUmakefile ce1eb95ca32b23ce3400b26e99c23f6b2737a5356cb4eff2b8b364d7630a8cc9 F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 89983a8d122c35a90c65ec667844b95a78bcd04f3198a99c1e0c8368c1a0b03a F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 -F ext/wasm/api/README.md 62758e8dd98741d41505f69130cc767013d2e871ebb9e4313d8f8b97d95071d8 +F ext/wasm/api/README.md 946398dd80bfd673f098b9d6ca3564e1fc77b03e660274d132f267c407b8703c F ext/wasm/api/extern-post-js.js dfae3a5f621ae94f1fae671f8013ed6464355f11e2adda38ed8b10bf1929f337 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 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1ecc5ba9e64ef90a8b F ext/wasm/api/pre-js.js 5b550904322d73127badd4347ca967ea525b901573559736f92d326ad9b7bb76 F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588 -F ext/wasm/api/sqlite3-api-glue.js 842dc03783aecc951a543a209523343a6fda9af258fb0bee08e8cc2dc3c4d8ae +F ext/wasm/api/sqlite3-api-glue.js 05eb701460bb72edbe3bf923bd51262551614612c37802fc597eabb4c6b83232 F ext/wasm/api/sqlite3-api-oo1.js 00f5cfce0989d2e08d7b21765d703c69234245d03a0cce8fcb32ccfcd53ffdbb F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616 -F ext/wasm/api/sqlite3-api-prologue.js b7c82a22d50658a48463fa646a23135273bc2cfa843aedda32627ff281c12e4d +F ext/wasm/api/sqlite3-api-prologue.js a17b35814c6399a2e69c7836e5fd2eaa71f755ee51f96cb69d68cbf99985d45b F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 @@ -527,12 +527,13 @@ F ext/wasm/test-opfs-vfs.html eb69dda21eb414b8f5e3f7c1cc0f774103cc9c0f87b2d28a33 F ext/wasm/test-opfs-vfs.js 56c3d725044c668fa7910451e96c1195d25ad95825f9ac79f747a7759d1973d0 F ext/wasm/tester1-worker.html 0af7a22025ff1da72a84765d64f8f221844a57c6e6e314acf3a30f176101fd3f F ext/wasm/tester1.html fde0e0bdeaaa2c39877c749dc86a8c1c306f771c3d75b89a6289a5ed11243e9d -F ext/wasm/tester1.js d6a66fc36c7571b8050314b6d0e93e69cd6def88df14fb3ef2403e7aa244ec36 +F ext/wasm/tester1.js fd333bc7608a91c86ae6147aa489840c06f4131119cc26d66976874a50da7cab F ext/wasm/testing-worker1-promiser.html 6eaec6e04a56cf24cf4fa8ef49d78ce8905dde1354235c9125dca6885f7ce893 F ext/wasm/testing-worker1-promiser.js bd788e33c1807e0a6dda9c9a9d784bd3350ca49c9dd8ae2cc8719b506b6e013e F ext/wasm/testing1.html 50575755e43232dbe4c2f97c9086b3118eb91ec2ee1fae931e6d7669fb17fcae F ext/wasm/testing2.html a66951c38137ff1d687df79466351f3c734fa9c6d9cce71d3cf97c291b2167e3 F ext/wasm/testing2.js 88f40ef3cd8201bdadd120a711c36bbf0ce56cc0eab1d5e7debb71fed7822494 +F ext/wasm/version-json.c 03c6fb4efefd7c5b14f618b36648e71da741e39059ea5059c39495fdceaed144 F ext/wasm/wasmfs.make 3cce1820006196de140f90f2da4b4ea657083fb5bfee7d125be43f7a85748c8f F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 @@ -2032,8 +2033,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 ed14863dd72e35fa3a23320c3d5a8166515faea39a555c28a27b2d35e701eac4 -R 664fdd2b5e755302311ec6a1ceb0cf59 +P 0f1a06e8e39a1fbc74f1aff9cc59787282dfbf847d6c5c7edb3f7d410db0e4b7 +R 33971fddc9aa38f4e82f55e933f782a8 U stephan -Z 70648a34d9cd28a66a6a4694b2eeaced +Z 0dd1ff3eef43ed68b7aa15bcdfe291e6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0ece5330b0..5d2cd089f9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0f1a06e8e39a1fbc74f1aff9cc59787282dfbf847d6c5c7edb3f7d410db0e4b7 \ No newline at end of file +b5f462c2d85d503f6492ec20580d57cb4c926712f6306a6be764bd09d1f5e8b8 \ No newline at end of file From 824bb5b8db88d064640a8e9d72b2204b916433e0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Oct 2022 18:50:55 +0000 Subject: [PATCH 3/7] Add aggregate function support to sqlite3.oo1.DB.createFunction(). Change signature of the options object used by that function so that the callback property names match those of the corresponding C APIs. FossilOrigin-Name: a7db6e4b50beebfb1c97e0c4de49538d8199c166b18a0b1b175736c593128a00 --- ext/wasm/api/sqlite3-api-oo1.js | 111 +++++++++++++++++++++++--------- ext/wasm/demo-123.js | 2 +- ext/wasm/tester1.js | 69 ++++++++++++++++++-- manifest | 16 ++--- manifest.uuid | 2 +- 5 files changed, 151 insertions(+), 49 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index fa6c6d8e5f..f775406756 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -45,8 +45,10 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ /** If object opts has _its own_ property named p then that property's value is returned, else dflt is returned. */ - const getOwnOption = (opts, p, dflt)=> - opts.hasOwnProperty(p) ? opts[p] : dflt; + const getOwnOption = (opts, p, dflt)=>{ + const d = Object.getOwnPropertyDescriptor(opts,p); + return d ? d.value : dflt; + }; // Documented in DB.checkRc() const checkSqlite3Rc = function(dbPtr, sqliteResultCode){ @@ -810,12 +812,14 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ `xFunc` to align with the C API documentation). In the final case, the function's name must be the 'name' property. - This can currently only be used to create scalar functions, not - aggregate or window functions (requires only a bit of - refactoring to support aggregates and window functions). + The first two call forms can only be used for creating scalar + functions. Creating an aggregate function requires the + options-object form (see below for details). UDFs cannot currently be removed from a DB handle after they're - added. + added. More correctly, they can be removed as documented for + sqlite3_create_function_v2(), but doing so will "leak" the + JS-created WASM binding of those functions. On success, returns this object. Throws on error. @@ -825,18 +829,35 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ cannot be determined. The docs for sqlite3_create_function_v2() describe the conversions in more detail. + The values set in the options object differ for scalar and + aggregate functions: + + - Scalar: set the `xFunc` function-type property to the UDF + function. + + - Aggregate: set the `xStep` and `xFinal` function-type + properties to the "step" and "final" callbacks for the + aggregate. Do not set the `xFunc` property. + + The options object may optionally have an `xDestroy` + function-type property, as per + sqlite3_create_function_v2(). Its argument will be the + WASM-pointer-type value of the `pApp` property, and this + function will throw if `pApp` is defined but is not null, + undefined, or a numeric (WASM pointer) value. + The optional options object may contain flags to modify how the function is defined: - - .arity: the number of arguments which SQL calls to this - function expect or require. The default value is - `callback.length` (i.e. the number of declared parameters it - has) **MINUS 1** (see below for why). As a special case, if - callback.length is 0, its arity is also 0 instead of -1. A - negative arity value means that the function is variadic and - may accept any number of arguments, up to sqlite3's - compile-time limits. sqlite3 will enforce the argument count if - is zero or greater. + - `arity`: the number of arguments which SQL calls to this + function expect or require. The default value is `xFunc.length` + or `xStep.length` (i.e. the number of declared parameters it + has) **MINUS 1** (see below for why). As a special case, if the + `length` is 0, its arity is also 0 instead of -1. A negative + arity value means that the function is variadic and may accept + any number of arguments, up to sqlite3's compile-time + limits. sqlite3 will enforce the argument count if is zero or + greater. The callback always receives a pointer to an `sqlite3_context` object as its first argument. Any arguments after that are from @@ -852,44 +873,70 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ - .deterministic = SQLITE_DETERMINISTIC - .directOnly = SQLITE_DIRECTONLY - .innocuous = SQLITE_INNOCUOUS - - TODO: for the (optionsObject) form, accept callbacks for - aggregate and window functions. - */ - createFunction: function f(name, callback, opt){ + createFunction: function f(name, xFunc, opt){ + let xStep, xFinal; + const isFunc = (f)=>(f instanceof Function); switch(arguments.length){ case 1: /* (optionsObject) */ opt = name; name = opt.name; - callback = opt.xFunc || opt.callback; + xFunc = opt.xFunc; break; case 2: /* (name, callback|optionsObject) */ - if(!(callback instanceof Function)){ - opt = callback; - callback = opt.xFunc || opt.callback; + if(!isFunc(xFunc)){ + opt = xFunc; + xFunc = opt.xFunc; } break; + case 3: /* name, xFunc, opt */ + break; default: break; } if(!opt) opt = {}; - if(!(callback instanceof Function)){ - toss3("Invalid arguments: expecting a callback function."); - }else if('string' !== typeof name){ + if('string' !== typeof name){ toss3("Invalid arguments: missing function name."); } + xStep = opt.xStep; + xFinal = opt.xFinal; + if(isFunc(xFunc)){ + if(isFunc(xStep) || isFunc(xFinal)){ + toss3("Ambiguous arguments: scalar or aggregate?"); + } + xStep = xFinal = null; + }else if(isFunc(xStep)){ + if(!isFunc(xFinal)){ + toss3("Missing xFinal() callback for aggregate UDF."); + } + xFunc = null; + }else if(isFunc(xFinal)){ + toss3("Missing xStep() callback for aggregate UDF."); + }else{ + toss3("Missing function-type properties."); + } + const pApp = opt.pApp; + if(undefined!==pApp && (('number'!==typeof pApp) + || !capi.util.isInt32(pApp))){ + toss3("Invalid value for pApp property. Must be a legal WASM pointer value."); + } + const xDestroy = opt.xDestroy; + if(xDestroy && !isFunc(xDestroy)){ + toss3("xDestroy property must be a function."); + } let fFlags = 0 /*flags for sqlite3_create_function_v2()*/; if(getOwnOption(opt, 'deterministic')) fFlags |= capi.SQLITE_DETERMINISTIC; if(getOwnOption(opt, 'directOnly')) fFlags |= capi.SQLITE_DIRECTONLY; if(getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS; name = name.toLowerCase(); + const xArity = xFunc || xStep; + const arity = getOwnOption(opt, 'arity'); DB.checkRc(this, capi.sqlite3_create_function_v2( this.pointer, name, - (opt.hasOwnProperty('arity') - ? +opt.arity - : (callback.length ? callback.length-1/*for pCtx arg*/ : 0)), - capi.SQLITE_UTF8 | fFlags, null/*pApp*/, callback, - null/*xStep*/, null/*xFinal*/, null/*xDestroy*/)); + ('number'===typeof arity + ? arity + : (xArity.length ? xArity.length-1/*for pCtx arg*/ : 0)), + capi.SQLITE_UTF8 | fFlags, pApp, + xFunc, xStep, xFinal, xDestroy)); return this; }/*createFunction()*/, /** diff --git a/ext/wasm/demo-123.js b/ext/wasm/demo-123.js index ff36aaf4e2..04a999488a 100644 --- a/ext/wasm/demo-123.js +++ b/ext/wasm/demo-123.js @@ -160,7 +160,7 @@ log("Create a scalar UDF..."); db.createFunction({ name: 'twice', - callback: function(pCx, arg){ // note the call arg count + xFunc: function(pCx, arg){ // note the call arg count return arg + arg; } }); diff --git a/ext/wasm/tester1.js b/ext/wasm/tester1.js index 72991c451c..aef9d2301b 100644 --- a/ext/wasm/tester1.js +++ b/ext/wasm/tester1.js @@ -1179,14 +1179,14 @@ assert(5===db.selectValue("select foo($a,$b)",{$a:0,$b:5})); db.createFunction("bar", { arity: -1, - callback: function(pCx){ - var rc = 0; - for(let i = 1; i < arguments.length; ++i) rc += arguments[i]; + xFunc: (pCx,...args)=>{ + let rc = 0; + for(const v of args) rc += v; return rc; } }).createFunction({ name: "asis", - callback: (pCx,arg)=>arg + xFunc: (pCx,arg)=>arg }); T.assert(0===db.selectValue("select bar()")). assert(1===db.selectValue("select bar(1)")). @@ -1225,9 +1225,64 @@ //////////////////////////////////////////////////////////////////// .t({ - name: 'Aggregate UDFs (tests are TODO)', - predicate: testIsTodo - }) + name: 'Aggregate UDFs', + test: function(sqlite3){ + const db = this.db; + const aggState = {summer: 0, summerN: 0}; + db.createFunction({ + name: 'summer', + xStep: function(pCtx, n){ + aggState.summer += n; + }, + xFinal: function(pCtx){ + const rc = aggState.summer; + aggState.summer = 0; + return rc; + } + }); + let v = db.selectValue([ + "with cte(v) as (", + "select 3 union all select 5 union all select 7", + ") select summer(v) from cte" + ]); + T.assert(15===v); + T.mustThrowMatching(()=>db.selectValue("select summer(1,2)"), + /wrong number of arguments/); + db.createFunction({ + name: 'summerN', + arity: -1, + xStep: function(pCtx, ...args){ + for(const v of args) aggState.summerN += v; + }, + xFinal: function(pCtx){ + const rc = aggState.summerN; + aggState.summerN = 0; + return rc; + } + }); + T.assert(18===db.selectValue('select summerN(1,8,9)')); + T.mustThrowMatching(()=>{ + db.createFunction('nope',{ + xFunc: ()=>{}, xStep: ()=>{} + }); + }, /scalar or aggregate\?/); + T.mustThrowMatching(()=>{ + db.createFunction('nope',{xStep: ()=>{}}); + }, /Missing xFinal/); + T.mustThrowMatching(()=>{ + db.createFunction('nope',{xFinal: ()=>{}}); + }, /Missing xStep/); + T.mustThrowMatching(()=>{ + db.createFunction('nope',{}); + }, /Missing function-type properties/); + T.mustThrowMatching(()=>{ + db.createFunction('nope',{xFunc:()=>{}, xDestroy:'nope'}); + }, /xDestroy property must be a function/); + T.mustThrowMatching(()=>{ + db.createFunction('nope',{xFunc:()=>{}, pApp:'nope'}); + }, /Invalid value for pApp/); + } + }/*aggregate UDFs*/) //////////////////////////////////////////////////////////////////// .t({ diff --git a/manifest b/manifest index 6e78bd13e1..00b073fd77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JS:\sadd\sbuild-time-generated\sversion\sinfo\sto\sthe\ssqlite3.version\sobject.\sRemove\ssome\sstray\sdebug\soutput\sfrom\stester1.js. -D 2022-10-16T16:38:15.159 +C Add\saggregate\sfunction\ssupport\sto\ssqlite3.oo1.DB.createFunction().\sChange\ssignature\sof\sthe\soptions\sobject\sused\sby\sthat\sfunction\sso\sthat\sthe\scallback\sproperty\snames\smatch\sthose\sof\sthe\scorresponding\sC\sAPIs. +D 2022-10-16T18:50:55.647 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -485,7 +485,7 @@ F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1 F ext/wasm/api/pre-js.js 5b550904322d73127badd4347ca967ea525b901573559736f92d326ad9b7bb76 F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588 F ext/wasm/api/sqlite3-api-glue.js 05eb701460bb72edbe3bf923bd51262551614612c37802fc597eabb4c6b83232 -F ext/wasm/api/sqlite3-api-oo1.js 00f5cfce0989d2e08d7b21765d703c69234245d03a0cce8fcb32ccfcd53ffdbb +F ext/wasm/api/sqlite3-api-oo1.js f7f1fa6e6364347e99d0619ac1d3766dabab1e114cdf343259f38372576b6650 F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616 F ext/wasm/api/sqlite3-api-prologue.js a17b35814c6399a2e69c7836e5fd2eaa71f755ee51f96cb69d68cbf99985d45b F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8 @@ -500,7 +500,7 @@ F ext/wasm/common/testing.css 53394885077edd3db22d2a0896192334dfc06fb3d1da0b646e F ext/wasm/common/whwasmutil.js 50d2ede0b0fa01c1d467e1801fab79f5e46bb02bcbd2b0232e4fdc6090a47818 F ext/wasm/demo-123-worker.html e50b51dc7271b9d3cc830cb7c2fba294d622f56b7acb199f7257d11195a63d49 F ext/wasm/demo-123.html 7c239c9951d1b113f9f532969ac039294cf1dcfee2b3ae0a2c1ed2b3d59f8dfa -F ext/wasm/demo-123.js d563cf9d725692ccd940c46df1c026d87863e0544942a2ba2015f17fba3f6f74 +F ext/wasm/demo-123.js e0cbeb3495e14103763d5c49794a24d67cf3d78e0ed5b82843be70c0c2ee4b3b F ext/wasm/demo-kvvfs1.html 7d4f28873de67f51ac18c584b7d920825139866a96049a49c424d6f5a0ea5e7f F ext/wasm/demo-kvvfs1.js 105596bd2ccd0b1deb5fde8e99b536e8242d4bb5932fac0c8403ff3a6bc547e8 F ext/wasm/fiddle.make 3f4efd62bc2a9c883bfcea52ae2755114a62d444d6d042df287f4aef301d6c6c @@ -527,7 +527,7 @@ F ext/wasm/test-opfs-vfs.html eb69dda21eb414b8f5e3f7c1cc0f774103cc9c0f87b2d28a33 F ext/wasm/test-opfs-vfs.js 56c3d725044c668fa7910451e96c1195d25ad95825f9ac79f747a7759d1973d0 F ext/wasm/tester1-worker.html 0af7a22025ff1da72a84765d64f8f221844a57c6e6e314acf3a30f176101fd3f F ext/wasm/tester1.html fde0e0bdeaaa2c39877c749dc86a8c1c306f771c3d75b89a6289a5ed11243e9d -F ext/wasm/tester1.js fd333bc7608a91c86ae6147aa489840c06f4131119cc26d66976874a50da7cab +F ext/wasm/tester1.js 8161dcc4b21902dadec2d3a5dc5700cab9c1641db0603e2ea56ea2a8de6cbab3 F ext/wasm/testing-worker1-promiser.html 6eaec6e04a56cf24cf4fa8ef49d78ce8905dde1354235c9125dca6885f7ce893 F ext/wasm/testing-worker1-promiser.js bd788e33c1807e0a6dda9c9a9d784bd3350ca49c9dd8ae2cc8719b506b6e013e F ext/wasm/testing1.html 50575755e43232dbe4c2f97c9086b3118eb91ec2ee1fae931e6d7669fb17fcae @@ -2033,8 +2033,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 0f1a06e8e39a1fbc74f1aff9cc59787282dfbf847d6c5c7edb3f7d410db0e4b7 -R 33971fddc9aa38f4e82f55e933f782a8 +P b5f462c2d85d503f6492ec20580d57cb4c926712f6306a6be764bd09d1f5e8b8 +R dc71c7ee6cfc588ad89cef2f6b6a3e75 U stephan -Z 0dd1ff3eef43ed68b7aa15bcdfe291e6 +Z 295c02a265fc3379708e7d138c173321 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5d2cd089f9..f04ed5fbac 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b5f462c2d85d503f6492ec20580d57cb4c926712f6306a6be764bd09d1f5e8b8 \ No newline at end of file +a7db6e4b50beebfb1c97e0c4de49538d8199c166b18a0b1b175736c593128a00 \ No newline at end of file From 2676fc58c86a497f8f2510dfe48e843d7371d88b Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Oct 2022 18:57:15 +0000 Subject: [PATCH 4/7] Minor tweak to get bring an edge case of oo1.DB.createFunction() into aggreement with its docs. FossilOrigin-Name: 8d59ccd9f357fbed0b0790508ca9027194fc4b0131029f9f460c7b4bde806a5f --- ext/wasm/api/sqlite3-api-oo1.js | 5 +++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index f775406756..f1014fcc00 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -915,8 +915,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ toss3("Missing function-type properties."); } const pApp = opt.pApp; - if(undefined!==pApp && (('number'!==typeof pApp) - || !capi.util.isInt32(pApp))){ + if(undefined!==pApp && + null!==pApp && + (('number'!==typeof pApp) || !capi.util.isInt32(pApp))){ toss3("Invalid value for pApp property. Must be a legal WASM pointer value."); } const xDestroy = opt.xDestroy; diff --git a/manifest b/manifest index 00b073fd77..d7401cafab 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\saggregate\sfunction\ssupport\sto\ssqlite3.oo1.DB.createFunction().\sChange\ssignature\sof\sthe\soptions\sobject\sused\sby\sthat\sfunction\sso\sthat\sthe\scallback\sproperty\snames\smatch\sthose\sof\sthe\scorresponding\sC\sAPIs. -D 2022-10-16T18:50:55.647 +C Minor\stweak\sto\sget\sbring\san\sedge\scase\sof\soo1.DB.createFunction()\sinto\saggreement\swith\sits\sdocs. +D 2022-10-16T18:57:15.939 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -485,7 +485,7 @@ F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1 F ext/wasm/api/pre-js.js 5b550904322d73127badd4347ca967ea525b901573559736f92d326ad9b7bb76 F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588 F ext/wasm/api/sqlite3-api-glue.js 05eb701460bb72edbe3bf923bd51262551614612c37802fc597eabb4c6b83232 -F ext/wasm/api/sqlite3-api-oo1.js f7f1fa6e6364347e99d0619ac1d3766dabab1e114cdf343259f38372576b6650 +F ext/wasm/api/sqlite3-api-oo1.js 9a5f0c00d476c504f16dcd456e1743dbc2826ca3d10645dfa62663a39e3ed0d8 F ext/wasm/api/sqlite3-api-opfs.js 5a8ab3b76880c8ada8710ca9ba1ca5b160872edfd8bd5322e4f179a7f41cc616 F ext/wasm/api/sqlite3-api-prologue.js a17b35814c6399a2e69c7836e5fd2eaa71f755ee51f96cb69d68cbf99985d45b F ext/wasm/api/sqlite3-api-worker1.js 7f4f46cb6b512a48572d7567233896e6a9c46570c44bdc3d13419730c7c221c8 @@ -2033,8 +2033,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 b5f462c2d85d503f6492ec20580d57cb4c926712f6306a6be764bd09d1f5e8b8 -R dc71c7ee6cfc588ad89cef2f6b6a3e75 +P a7db6e4b50beebfb1c97e0c4de49538d8199c166b18a0b1b175736c593128a00 +R 3422110515a596def98dff69dd1bdfc7 U stephan -Z 295c02a265fc3379708e7d138c173321 +Z eb1680ea30bd7067803bb7e8ee35441a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f04ed5fbac..946bd8b7e8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a7db6e4b50beebfb1c97e0c4de49538d8199c166b18a0b1b175736c593128a00 \ No newline at end of file +8d59ccd9f357fbed0b0790508ca9027194fc4b0131029f9f460c7b4bde806a5f \ No newline at end of file From e493f8f0cd2f04a7ef84c06dfef0040db3f6cf64 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 16 Oct 2022 23:33:24 +0000 Subject: [PATCH 5/7] Typo fix. FossilOrigin-Name: 650126c92aa191d6361a32ec90ca7def60a2df22ba6bec1d2354692fe3504423 --- ext/wasm/index.html | 11 +++++------ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ext/wasm/index.html b/ext/wasm/index.html index a7f0974fbe..663d4c9240 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -87,12 +87,11 @@ worker due to an Emscripten limitation.
  • test-opfs-vfs (same - with verbose output and sanity-checking tests) is an - experiment in implementing a syncronous sqlite3 VFS proxy - for a fully asynchronous backend interface (namely OPFS), - using SharedArrayBuffer and the Atomics APIs to regulate - communication between the synchronous interface and the - async impl. + with verbose output and sanity-checking tests) is an + sqlite3_vfs OPFS proxy using SharedArrayBuffer and the + Atomics APIs to regulate communication between the + synchronous sqlite3_vfs interface and the async OPFS + impl.
  • diff --git a/manifest b/manifest index d7401cafab..a206aae7bb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\stweak\sto\sget\sbring\san\sedge\scase\sof\soo1.DB.createFunction()\sinto\saggreement\swith\sits\sdocs. -D 2022-10-16T18:57:15.939 +C Typo\sfix. +D 2022-10-16T23:33:24.941 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -508,7 +508,7 @@ F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d695 F ext/wasm/fiddle/fiddle-worker.js 531859a471924a0ea48afa218e6877f0c164ca324d51e15843ed6ecc1c65c7ee F ext/wasm/fiddle/fiddle.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 -F ext/wasm/index.html f41ff0b3cef07196b18f3f917c46560a0d5289064d344b438b254c41ed0f2c76 +F ext/wasm/index.html d75b516236c6869568ff691b9b7ff61307d6436e059b5657dadc473b6f41e581 F ext/wasm/jaccwabyt/jaccwabyt.js 0d7f32817456a0f3937fcfd934afeb32154ca33580ab264dab6c285e6dbbd215 F ext/wasm/jaccwabyt/jaccwabyt.md 9aa6951b529a8b29f578ec8f0355713c39584c92cf1708f63ba0cf917cb5b68e F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06 @@ -2033,8 +2033,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 a7db6e4b50beebfb1c97e0c4de49538d8199c166b18a0b1b175736c593128a00 -R 3422110515a596def98dff69dd1bdfc7 +P 8d59ccd9f357fbed0b0790508ca9027194fc4b0131029f9f460c7b4bde806a5f +R 7eb92d13aa47fc635e45e77480d0d518 U stephan -Z eb1680ea30bd7067803bb7e8ee35441a +Z e9d4f2e253f6a0945cb00e8689db7471 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 946bd8b7e8..e7aecb1f4e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8d59ccd9f357fbed0b0790508ca9027194fc4b0131029f9f460c7b4bde806a5f \ No newline at end of file +650126c92aa191d6361a32ec90ca7def60a2df22ba6bec1d2354692fe3504423 \ No newline at end of file From 135c9ff6f7077435614e5226dbb5361e33bd1cac Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Oct 2022 09:56:51 +0000 Subject: [PATCH 6/7] Remove a use of alloca() that does more harm than good. FossilOrigin-Name: 2ab3cf4d71b23a4c0b69f977828d82df7bbc080c29ae189e0d78d38efee50c96 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/wherecode.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index a206aae7bb..93a3db2696 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Typo\sfix. -D 2022-10-16T23:33:24.941 +C Remove\sa\suse\sof\salloca()\sthat\sdoes\smore\sharm\sthan\sgood. +D 2022-10-17T09:56:51.582 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -708,7 +708,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b F src/where.c 63e712bcad47f70e94c2150976cd7da5040933699e3938d4189d064acbe40891 F src/whereInt.h 70cd30de9ed784aa33fa6bd1245f060617de7a00d992469b6d8e419eed915743 -F src/wherecode.c bb88be457df3a6a01c844074ab79a9ba74279e73185f1362383aa697e3cae5dc +F src/wherecode.c 8ec5a413f12af06638dcca36d0954be2151eea6f293d3c67397cef6a90d6adf1 F src/whereexpr.c 55a39f42aaf982574fbf52906371a84cceed98a994422198dfd03db4fce4cc46 F src/window.c 928e215840e2f2d9a2746e018c9643ef42c66c4ab6630ef0df7fa388fa145e86 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 @@ -2033,8 +2033,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 8d59ccd9f357fbed0b0790508ca9027194fc4b0131029f9f460c7b4bde806a5f -R 7eb92d13aa47fc635e45e77480d0d518 -U stephan -Z e9d4f2e253f6a0945cb00e8689db7471 +P 650126c92aa191d6361a32ec90ca7def60a2df22ba6bec1d2354692fe3504423 +R 0976ce63c2884a014f8f48854ee7e700 +U drh +Z eaf9cf4bd31fd72933cff88a3ffeecd2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e7aecb1f4e..ee9a25c253 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -650126c92aa191d6361a32ec90ca7def60a2df22ba6bec1d2354692fe3504423 \ No newline at end of file +2ab3cf4d71b23a4c0b69f977828d82df7bbc080c29ae189e0d78d38efee50c96 \ No newline at end of file diff --git a/src/wherecode.c b/src/wherecode.c index 85d9be5011..c2e7278d1a 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -2314,7 +2314,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( int nNotReady; /* The number of notReady tables */ SrcItem *origSrc; /* Original list of tables */ nNotReady = pWInfo->nLevel - iLevel - 1; - pOrTab = sqlite3StackAllocRaw(db, + pOrTab = sqlite3DbMallocRawNN(db, sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); if( pOrTab==0 ) return notReady; pOrTab->nAlloc = (u8)(nNotReady + 1); @@ -2567,7 +2567,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( assert( pLevel->op==OP_Return ); pLevel->p2 = sqlite3VdbeCurrentAddr(v); - if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); } + if( pWInfo->nLevel>1 ){ sqlite3DbFreeNN(db, pOrTab); } if( !untestedTerms ) disableTerm(pLevel, pTerm); }else #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ From ce4b0fdf8a04b2ccaf2a587d0f8d9f3382355d51 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 17 Oct 2022 10:15:41 +0000 Subject: [PATCH 7/7] Make use of alloca() in wherePathSolver() when SQLITE_USE_ALLOCA is defined. FossilOrigin-Name: 45752471521f8d4a6cad4bce40f907018acd403ffd3b8170020c34e4e0b6b91b --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqliteInt.h | 4 ++++ src/where.c | 9 +++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 93a3db2696..f650226ca1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\suse\sof\salloca()\sthat\sdoes\smore\sharm\sthan\sgood. -D 2022-10-17T09:56:51.582 +C Make\suse\sof\salloca()\sin\swherePathSolver()\swhen\sSQLITE_USE_ALLOCA\sis\sdefined. +D 2022-10-17T10:15:41.927 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -624,7 +624,7 @@ F src/shell.c.in 2915eaf22bda89ad6533851a051de4773c249185360fe1fc7b4477b8f9063b2 F src/sqlite.h.in d9c8a6243fc0a1c270d69db33758e34b810af3462f9bc5b4af113b347e07c69d F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 5336beea1868d99d2f62e628dbea55e97267dbff8193291ab175e960c5df9141 -F src/sqliteInt.h d15694b228fe5082587e13ac14f3e449621a5fe6d5933f5dee6e3c9491260da3 +F src/sqliteInt.h 27916b91f3aafd09d1b50f62948e0d506a58933f4cf5f5c136233658fbd39e60 F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -706,7 +706,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b -F src/where.c 63e712bcad47f70e94c2150976cd7da5040933699e3938d4189d064acbe40891 +F src/where.c ab74681d07e310fb81c01c2bb1068378764cfff9e431e2b01aacc7a3678a018d F src/whereInt.h 70cd30de9ed784aa33fa6bd1245f060617de7a00d992469b6d8e419eed915743 F src/wherecode.c 8ec5a413f12af06638dcca36d0954be2151eea6f293d3c67397cef6a90d6adf1 F src/whereexpr.c 55a39f42aaf982574fbf52906371a84cceed98a994422198dfd03db4fce4cc46 @@ -2033,8 +2033,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 650126c92aa191d6361a32ec90ca7def60a2df22ba6bec1d2354692fe3504423 -R 0976ce63c2884a014f8f48854ee7e700 +P 2ab3cf4d71b23a4c0b69f977828d82df7bbc080c29ae189e0d78d38efee50c96 +R fd1636fa451b5b8e84570a9195b2236a U drh -Z eaf9cf4bd31fd72933cff88a3ffeecd2 +Z 2743069ef130a7abdc131b5ac7f77275 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ee9a25c253..d362e0dc32 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2ab3cf4d71b23a4c0b69f977828d82df7bbc080c29ae189e0d78d38efee50c96 \ No newline at end of file +45752471521f8d4a6cad4bce40f907018acd403ffd3b8170020c34e4e0b6b91b \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 6f1109f2f6..05bc6dd4c5 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4391,12 +4391,16 @@ int sqlite3HeapNearlyFull(void); */ #ifdef SQLITE_USE_ALLOCA # define sqlite3StackAllocRaw(D,N) alloca(N) +# define sqlite3StackAllocRawNN(D,N) alloca(N) # define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N) # define sqlite3StackFree(D,P) +# define sqlite3StackFreeNN(D,P) #else # define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N) +# define sqlite3StackAllocRawNN(D,N) sqlite3DbMallocRawNN(D,N) # define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N) # define sqlite3StackFree(D,P) sqlite3DbFree(D,P) +# define sqlite3StackFreeNN(D,P) sqlite3DbFreeNN(D,P) #endif /* Do not allow both MEMSYS5 and MEMSYS3 to be defined together. If they diff --git a/src/where.c b/src/where.c index b0c0ea7d4e..2bd3e055db 100644 --- a/src/where.c +++ b/src/where.c @@ -4701,7 +4701,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ int mxChoice; /* Maximum number of simultaneous paths tracked */ int nLoop; /* Number of terms in the join */ Parse *pParse; /* Parsing context */ - sqlite3 *db; /* The database connection */ int iLoop; /* Loop counter over the terms of the join */ int ii, jj; /* Loop counters */ int mxI = 0; /* Index of next entry to replace */ @@ -4720,7 +4719,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ int nSpace; /* Bytes of space allocated at pSpace */ pParse = pWInfo->pParse; - db = pParse->db; nLoop = pWInfo->nLevel; /* TUNING: For simple queries, only the best path is tracked. ** For 2-way joins, the 5 best paths are followed. @@ -4743,7 +4741,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ /* Allocate and initialize space for aTo, aFrom and aSortCost[] */ nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2; nSpace += sizeof(LogEst) * nOrderBy; - pSpace = sqlite3DbMallocRawNN(db, nSpace); + pSpace = sqlite3StackAllocRawNN(pParse->db, nSpace); if( pSpace==0 ) return SQLITE_NOMEM_BKPT; aTo = (WherePath*)pSpace; aFrom = aTo+mxChoice; @@ -5001,7 +4999,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ if( nFrom==0 ){ sqlite3ErrorMsg(pParse, "no query solution"); - sqlite3DbFreeNN(db, pSpace); + sqlite3StackFreeNN(pParse->db, pSpace); return SQLITE_ERROR; } @@ -5083,8 +5081,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ pWInfo->nRowOut = pFrom->nRow; /* Free temporary memory and return success */ - assert( db!=0 ); - sqlite3DbNNFreeNN(db, pSpace); + sqlite3StackFreeNN(pParse->db, pSpace); return SQLITE_OK; }