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

Method Log

src/objects/database.cpp:78–87  ·  view source on GitHub ↗

Allows Statements to log their executed SQL.

Source from the content-addressed store, hash-verified

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