diff options
author | stephan <stephan@noemail.net> | 2022-10-20 23:48:38 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-10-20 23:48:38 +0000 |
commit | 6f3286cafd92fbf2d29db10983f67703c94d3ef8 (patch) | |
tree | ce9b9b192b8f3aae3e264c53f56e885e0deed83d /ext/wasm/api/sqlite3-api-prologue.js | |
parent | 96b6371d709a91015204b14e4b83e61a209bbde2 (diff) | |
download | sqlite-6f3286cafd92fbf2d29db10983f67703c94d3ef8.tar.gz sqlite-6f3286cafd92fbf2d29db10983f67703c94d3ef8.zip |
Make semantics for UDF xFinal() result handling and error reporting handling more flexible.
FossilOrigin-Name: 89f3e1982ec32c010af67d15ef780847df20de568669e5c9d02f3cf084f51330
Diffstat (limited to 'ext/wasm/api/sqlite3-api-prologue.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-prologue.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js index da7d0740f..73d189c4f 100644 --- a/ext/wasm/api/sqlite3-api-prologue.js +++ b/ext/wasm/api/sqlite3-api-prologue.js @@ -1208,13 +1208,15 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( /** A thin wrapper around capi.sqlite3_aggregate_context() which behaves the same except that it throws a WasmAllocError if that - function returns 0. + function returns 0. As a special case, if n is falsy it does + _not_ throw if that function returns 0. That special case is + intended for use with xFinal() implementations. */ capi.sqlite3_js_aggregate_context = (pCtx, n)=>{ return capi.sqlite3_aggregate_context(pCtx, n) - || WasmAllocError.toss( - "Cannot allocate",n,"bytes for sqlite3_aggregate_context()" - ); + || (n ? WasmAllocError.toss("Cannot allocate",n, + "bytes for sqlite3_aggregate_context()") + : 0); }; if( capi.util.isMainWindow() ){ |