MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / xFunc

Method xFunc

src/util/custom-function.cpp:23–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 }
22
23 static void xFunc(sqlite3_context* invocation, int argc, sqlite3_value** argv) {
24 FUNCTION_START();
25
26 napi_value args_fast[4];
27 napi_value* args = NULL;
28 if (argc != 0) {
29 args = argc <= 4 ? args_fast : ALLOC_ARRAY<napi_value>(argc);
30 Data::GetArgumentsJS(env, args, argv, argc, self->safe_ints);
31 }
32
33 Napi::Value returnValue = SafeCall(env, self->fn.Value(), env.Undefined(), argc, args);
34 if (args != args_fast) delete[] args;
35
36 if (env.IsExceptionPending()) self->PropagateJSError(invocation);
37 else Data::ResultValueFromJS(env, invocation, returnValue, self);
38 }
39
40protected:
41

Callers

nothing calls this directly

Calls 4

PropagateJSErrorMethod · 0.95
GetArgumentsJSFunction · 0.85
SafeCallFunction · 0.85
ResultValueFromJSFunction · 0.85

Tested by

no test coverage detected