Allows Statements to log their executed SQL.
| 75 | |
| 76 | // Allows Statements to log their executed SQL. |
| 77 | bool 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 | |
| 88 | bool Database::Deserialize( |
| 89 | Napi::Env env, |
no test coverage detected