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 v8::Local<v8::Value> args_fast[4];
27 v8::Local<v8::Value>* args = NULL;
28 if (argc != 0) {
29 args = argc <= 4 ? args_fast : ALLOC_ARRAY<v8::Local<v8::Value>>(argc);
30 Data::GetArgumentsJS(isolate, args, argv, argc, self->safe_ints);
31 }
32
33 v8::MaybeLocal<v8::Value> maybeReturnValue = self->fn.Get(isolate)->Call(OnlyContext, v8::Undefined(isolate), argc, args);
34 if (args != args_fast) delete[] args;
35
36 if (maybeReturnValue.IsEmpty()) self->PropagateJSError(invocation);
37 else Data::ResultValueFromJS(isolate, invocation, maybeReturnValue.ToLocalChecked(), self);
38 }
39
40protected:
41

Callers

nothing calls this directly

Calls 3

PropagateJSErrorMethod · 0.95
GetArgumentsJSFunction · 0.85
ResultValueFromJSFunction · 0.85

Tested by

no test coverage detected