1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Make semantics for UDF xFinal() result handling and error reporting handling more flexible.

FossilOrigin-Name: 89f3e1982ec32c010af67d15ef780847df20de568669e5c9d02f3cf084f51330
This commit is contained in:
stephan
2022-10-20 23:48:38 +00:00
parent 96b6371d70
commit 6f3286cafd
5 changed files with 81 additions and 58 deletions

View File

@ -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() ){