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

Method Log

src/objects/database.cpp:80–90  ·  view source on GitHub ↗

Allows Statements to log their executed SQL.

Source from the content-addressed store, hash-verified

78
79// Allows Statements to log their executed SQL.
80bool Database::Log(v8::Isolate* isolate, sqlite3_stmt* handle) {
81 assert(was_js_error == false);
82 if (!has_logger) return false;
83 char* expanded = sqlite3_expanded_sql(handle);
84 v8::Local<v8::Value> arg = StringFromUtf8(isolate, expanded ? expanded : sqlite3_sql(handle), -1);
85 was_js_error = logger.Get(isolate).As<v8::Function>()
86 ->Call(OnlyContext, v8::Undefined(isolate), 1, &arg)
87 .IsEmpty();
88 if (expanded) sqlite3_free(expanded);
89 return was_js_error;
90}
91
92bool Database::Deserialize(
93 v8::Local<v8::Object> buffer,

Callers 2

NODE_METHODFunction · 0.80
NextMethod · 0.80

Calls 1

StringFromUtf8Function · 0.85

Tested by

no test coverage detected