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

Method Log

src/objects/database.cpp:77–86  ·  view source on GitHub ↗

Allows Statements to log their executed SQL.

Source from the content-addressed store, hash-verified

75
76// Allows Statements to log their executed SQL.
77bool Database::Log(Napi::Env env, sqlite3_stmt* handle) {
78 assert(was_js_error == false);
79 if (!has_logger) return false;
80 char* expanded = sqlite3_expanded_sql(handle);
81 napi_value arg = StringFromUtf8(env, expanded ? expanded : sqlite3_sql(handle), -1);
82 SafeCall(env, logger.Value().As<Napi::Function>(), env.Undefined(), 1, &arg);
83 was_js_error = env.IsExceptionPending();
84 if (expanded) sqlite3_free(expanded);
85 return was_js_error;
86}
87
88bool Database::Deserialize(
89 Napi::Env env,

Callers 2

NODE_METHODFunction · 0.80
NextMethod · 0.80

Calls 2

StringFromUtf8Function · 0.85
SafeCallFunction · 0.85

Tested by

no test coverage detected