From c229cd59db878641b7158bcd059df6bdd900e601 Mon Sep 17 00:00:00 2001 From: Oscar Franco Date: Sun, 15 Dec 2024 14:29:28 +0100 Subject: [PATCH] Replace OpSqliteError code to exception throwing --- cpp/DBHostObject.cpp | 127 +++++++---------------- cpp/PreparedStatementHostObject.cpp | 34 +++--- cpp/bridge.cpp | 154 +++++++++++----------------- cpp/bridge.h | 8 +- cpp/types.h | 4 - cpp/utils.cpp | 57 +++++----- cpp/utils.h | 2 +- example/src/tests/queries.spec.ts | 1 - 8 files changed, 143 insertions(+), 244 deletions(-) diff --git a/cpp/DBHostObject.cpp b/cpp/DBHostObject.cpp index eb15f09c..946891ac 100644 --- a/cpp/DBHostObject.cpp +++ b/cpp/DBHostObject.cpp @@ -35,23 +35,12 @@ void DBHostObject::flush_pending_reactive_queries( auto status = opsqlite_execute_prepared_statement(db, query->stmt, &results, metadata); - if (status.type == SQLiteError) { - invoker->invokeAsync( - [this, callback = query->callback, status = std::move(status)] { - auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, status.message)); - callback->asObject(rt).asFunction(rt).call(rt, error); - }); - } else { - invoker->invokeAsync( - [this, - results = std::make_shared>(results), - callback = query->callback, metadata, status = std::move(status)] { - auto jsiResult = create_result(rt, status, results.get(), metadata); - callback->asObject(rt).asFunction(rt).call(rt, jsiResult); - }); - } + invoker->invokeAsync( + [this, results = std::make_shared>(results), + callback = query->callback, metadata, status = std::move(status)] { + auto jsiResult = create_result(rt, status, results.get(), metadata); + callback->asObject(rt).asFunction(rt).call(rt, jsiResult); + }); } pending_reactive_queries.clear(); @@ -261,7 +250,7 @@ void DBHostObject::create_jsi_functions() { auto remove = HOSTFN("delete") { std::string path = std::string(base_path); - if (count == 1 && !args[0].isUndefined() && !args[0].isNull()) { + if (count == 1) { if (!args[1].isString()) { throw std::runtime_error( "[op-sqlite][open] database location must be a string"); @@ -320,16 +309,8 @@ void DBHostObject::create_jsi_functions() { invoker->invokeAsync([&rt, results = std::move(results), status = std::move(status), resolve, reject] { - if (status.type == SQLiteOk) { - auto jsiResult = create_raw_result(rt, status, &results); - resolve->asObject(rt).asFunction(rt).call(rt, - std::move(jsiResult)); - } else { - auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, status.message)); - reject->asObject(rt).asFunction(rt).call(rt, error); - } + auto jsiResult = create_raw_result(rt, status, &results); + resolve->asObject(rt).asFunction(rt).call(rt, std::move(jsiResult)); }); } catch (std::exception &exc) { @@ -365,9 +346,6 @@ void DBHostObject::create_jsi_functions() { auto status = opsqlite_execute(db, query, ¶ms); #endif - if (status.type != SQLiteOk) { - throw std::runtime_error(status.message); - } return create_js_rows(rt, status); }); @@ -380,12 +358,12 @@ void DBHostObject::create_jsi_functions() { } auto promiseCtr = rt.global().getPropertyAsFunction(rt, "Promise"); - auto promise = promiseCtr.callAsConstructor(rt, HOSTFN("executor") { - auto resolve = std::make_shared(rt, args[0]); - auto reject = std::make_shared(rt, args[1]); - + auto promise = promiseCtr.callAsConstructor(rt, + HOSTFN("executor") { auto task = [this, &rt, query = std::move(query), - params = std::move(params), resolve, reject]() { + params = std::move(params), + resolve = std::make_shared(rt, args[0]), + reject = std::make_shared(rt, args[1])]() { try { #ifdef OP_SQLITE_USE_LIBSQL @@ -400,23 +378,14 @@ void DBHostObject::create_jsi_functions() { invoker->invokeAsync([&rt, status = std::move(status), resolve, reject] { - if (status.type == SQLiteOk) { - auto jsiResult = create_js_rows(rt, status); - resolve->asObject(rt).asFunction(rt).call(rt, - std::move(jsiResult)); - } else { - auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, status.message)); - reject->asObject(rt).asFunction(rt).call(rt, error); - } + auto jsiResult = create_js_rows(rt, status); + resolve->asObject(rt).asFunction(rt).call(rt, std::move(jsiResult)); }); } catch (std::exception &exc) { auto what = exc.what(); - invoker->invokeAsync([&rt, what = std::move(what), reject] { + invoker->invokeAsync([&rt, what = std::string(what), reject] { auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( rt, jsi::String::createFromAscii(rt, what)); reject->asObject(rt).asFunction(rt).call(rt, error); @@ -427,7 +396,7 @@ void DBHostObject::create_jsi_functions() { thread_pool->queueWork(task); return {}; - })); + })); return promise; }); @@ -468,18 +437,10 @@ void DBHostObject::create_jsi_functions() { [&rt, results = std::make_shared>(results), metadata, status = std::move(status), resolve, reject] { - if (status.type == SQLiteOk) { - auto jsiResult = - create_result(rt, status, results.get(), metadata); - resolve->asObject(rt).asFunction(rt).call( - rt, std::move(jsiResult)); - } else { - auto errorCtr = - rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, status.message)); - reject->asObject(rt).asFunction(rt).call(rt, error); - } + auto jsiResult = + create_result(rt, status, results.get(), metadata); + resolve->asObject(rt).asFunction(rt).call(rt, + std::move(jsiResult)); }); } catch (std::exception &exc) { @@ -543,20 +504,13 @@ void DBHostObject::create_jsi_functions() { return; } - invoker->invokeAsync([&rt, batchResult = std::move(batchResult), - resolve, reject] { - if (batchResult.type == SQLiteOk) { - auto res = jsi::Object(rt); - res.setProperty(rt, "rowsAffected", - jsi::Value(batchResult.affectedRows)); - resolve->asObject(rt).asFunction(rt).call(rt, std::move(res)); - } else { - auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, batchResult.message)); - reject->asObject(rt).asFunction(rt).call(rt, error); - } - }); + invoker->invokeAsync( + [&rt, batchResult = std::move(batchResult), resolve, reject] { + auto res = jsi::Object(rt); + res.setProperty(rt, "rowsAffected", + jsi::Value(batchResult.affectedRows)); + resolve->asObject(rt).asFunction(rt).call(rt, std::move(res)); + }); } catch (std::exception &exc) { auto what = exc.what(); invoker->invokeAsync([&rt, what = std::move(what), reject] { @@ -603,21 +557,14 @@ void DBHostObject::create_jsi_functions() { try { const auto result = import_sql_file(db, sqlFileName); - invoker->invokeAsync([&rt, result = std::move(result), resolve, - reject] { - if (result.type == SQLiteOk) { - auto res = jsi::Object(rt); - res.setProperty(rt, "rowsAffected", - jsi::Value(result.affectedRows)); - res.setProperty(rt, "commands", jsi::Value(result.commands)); - resolve->asObject(rt).asFunction(rt).call(rt, std::move(res)); - } else { - auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, result.message)); - reject->asObject(rt).asFunction(rt).call(rt, error); - } - }); + invoker->invokeAsync( + [&rt, result = std::move(result), resolve, reject] { + auto res = jsi::Object(rt); + res.setProperty(rt, "rowsAffected", + jsi::Value(result.affectedRows)); + res.setProperty(rt, "commands", jsi::Value(result.commands)); + resolve->asObject(rt).asFunction(rt).call(rt, std::move(res)); + }); } catch (std::exception &exc) { auto what = exc.what(); invoker->invokeAsync([&rt, what = std::move(what), reject] { diff --git a/cpp/PreparedStatementHostObject.cpp b/cpp/PreparedStatementHostObject.cpp index c483d3da..bcbf6e17 100644 --- a/cpp/PreparedStatementHostObject.cpp +++ b/cpp/PreparedStatementHostObject.cpp @@ -60,26 +60,28 @@ jsi::Value PreparedStatementHostObject::get(jsi::Runtime &rt, auto status = opsqlite_libsql_execute_prepared_statement( _name, _stmt, &results, metadata); #else - auto status = opsqlite_execute_prepared_statement(_db, _stmt, - &results, metadata); -#endif - invoker->invokeAsync( - [&rt, status = std::move(status), - results = std::make_shared>(results), - metadata, resolve, reject] { - if (status.type == SQLiteOk) { + try { + auto status = opsqlite_execute_prepared_statement( + _db, _stmt, &results, metadata); + invoker->invokeAsync( + [&rt, status = std::move(status), + results = + std::make_shared>(results), + metadata, resolve] { auto jsiResult = create_result(rt, status, results.get(), metadata); resolve->asObject(rt).asFunction(rt).call( rt, std::move(jsiResult)); - } else { - auto errorCtr = - rt.global().getPropertyAsFunction(rt, "Error"); - auto error = errorCtr.callAsConstructor( - rt, jsi::String::createFromUtf8(rt, status.message)); - reject->asObject(rt).asFunction(rt).call(rt, error); - } - }); + }); + } catch (std::exception &exc) { + invoker->invokeAsync([&rt, &exc, reject] { + auto errorCtr = rt.global().getPropertyAsFunction(rt, "Error"); + auto error = errorCtr.callAsConstructor( + rt, jsi::String::createFromUtf8(rt, exc.what())); + reject->asObject(rt).asFunction(rt).call(rt, error); + }); + } +#endif }; _thread_pool->queueWork(task); diff --git a/cpp/bridge.cpp b/cpp/bridge.cpp index 4eb19197..04d51a4c 100644 --- a/cpp/bridge.cpp +++ b/cpp/bridge.cpp @@ -135,28 +135,21 @@ void opsqlite_close(sqlite3 *db) { } void opsqlite_attach(sqlite3 *db, std::string const &main_db_name, - std::string const &doc_path, - std::string const &secondary_db_name, - std::string const &alias) { - std::string secondary_db_path = opsqlite_get_db_path(secondary_db_name, doc_path); - std::string statement = "ATTACH DATABASE '" + secondary_db_path + "' AS " + alias; - - BridgeResult result = opsqlite_execute(db, statement, nullptr); - - if (result.type == SQLiteError) { - throw std::runtime_error(main_db_name + " was unable to attach another database: " + - std::string(result.message)); - } + std::string const &doc_path, + std::string const &secondary_db_name, + std::string const &alias) { + std::string secondary_db_path = + opsqlite_get_db_path(secondary_db_name, doc_path); + std::string statement = + "ATTACH DATABASE '" + secondary_db_path + "' AS " + alias; + + opsqlite_execute(db, statement, nullptr); } void opsqlite_detach(sqlite3 *db, std::string const &main_db_name, - std::string const &alias) { + std::string const &alias) { std::string statement = "DETACH DATABASE " + alias; - BridgeResult result = opsqlite_execute(db, statement, nullptr); - if (result.type == SQLiteError) { - throw std::runtime_error(main_db_name + "was unable to detach database: " + - std::string(result.message)); - } + opsqlite_execute(db, statement, nullptr); } void opsqlite_remove(sqlite3 *db, std::string const &name, @@ -284,16 +277,15 @@ BridgeResult opsqlite_execute_prepared_statement( sqlite3_reset(statement); if (isFailed) { - return {.type = SQLiteError, - .message = "[op-sqlite] SQLite code: " + std::to_string(result) + - " execution error: " + std::string(errorMessage)}; + throw std::runtime_error( + "[op-sqlite] SQLite code: " + std::to_string(result) + + " execution error: " + std::string(errorMessage)); } int changedRowCount = sqlite3_changes(db); long long latestInsertRowId = sqlite3_last_insert_rowid(db); - return {.type = SQLiteOk, - .affectedRows = changedRowCount, + return {.affectedRows = changedRowCount, .insertId = static_cast(latestInsertRowId)}; } @@ -337,10 +329,8 @@ BridgeResult opsqlite_execute(sqlite3 *db, std::string const &query, if (status != SQLITE_OK) { errorMessage = sqlite3_errmsg(db); - return {.type = SQLiteError, - .message = - "[op-sqlite] SQL prepare error: " + std::string(errorMessage), - .affectedRows = 0}; + throw std::runtime_error("[op-sqlite] SQL prepare error: " + + std::string(errorMessage)); } // The statement did not fail to parse but there is nothing to do, just @@ -436,17 +426,13 @@ BridgeResult opsqlite_execute(sqlite3 *db, std::string const &query, if (has_failed) { const char *message = sqlite3_errmsg(db); - return {.type = SQLiteError, - .message = - "[op-sqlite] SQL execution error: " + std::string(message), - .affectedRows = 0, - .insertId = 0}; + throw std::runtime_error("[op-sqlite] SQL execution error: " + + std::string(message)); } int changedRowCount = sqlite3_changes(db); long long latestInsertRowId = sqlite3_last_insert_rowid(db); - return {.type = SQLiteOk, - .affectedRows = changedRowCount, + return {.affectedRows = changedRowCount, .insertId = static_cast(latestInsertRowId), .rows = std::move(rows), .column_names = std::move(column_names)}; @@ -475,11 +461,10 @@ BridgeResult opsqlite_execute_host_objects( if (statementStatus != SQLITE_OK) { const char *message = sqlite3_errmsg(db); - return {.type = SQLiteError, - .message = - "[op-sqlite] SQL statement error on opsqlite_execute:\n" + - std::to_string(statementStatus) + " description:\n" + - std::string(message)}; + throw std::runtime_error( + "[op-sqlite] SQL statement error on opsqlite_execute:\n" + + std::to_string(statementStatus) + " description:\n" + + std::string(message)); } // The statement did not fail to parse but there is nothing to do, just @@ -598,18 +583,15 @@ BridgeResult opsqlite_execute_host_objects( strcmp(remainingStatement, "") != 0 && !isFailed); if (isFailed) { - - return {.type = SQLiteError, - .message = - "[op-sqlite] SQLite error code: " + std::to_string(result) + - ", description: " + std::string(errorMessage)}; + throw std::runtime_error( + "[op-sqlite] SQLite error code: " + std::to_string(result) + + ", description: " + std::string(errorMessage)); } int changedRowCount = sqlite3_changes(db); long long latestInsertRowId = sqlite3_last_insert_rowid(db); - return {.type = SQLiteOk, - .affectedRows = changedRowCount, + return {.affectedRows = changedRowCount, .insertId = static_cast(latestInsertRowId)}; } @@ -637,12 +619,9 @@ opsqlite_execute_raw(sqlite3 *db, std::string const &query, if (statementStatus != SQLITE_OK) { const char *message = sqlite3_errmsg(db); - return { - .type = SQLiteError, - .message = "[op-sqlite] SQL statement error:" + - std::to_string(statementStatus) + - " description:" + std::string(message), - }; + throw std::runtime_error("[op-sqlite] SQL statement error:" + + std::to_string(statementStatus) + + " description:" + std::string(message)); } // The statement did not fail to parse but there is nothing to do, just @@ -735,17 +714,14 @@ opsqlite_execute_raw(sqlite3 *db, std::string const &query, strcmp(remainingStatement, "") != 0 && !isFailed); if (isFailed) { - - return {.type = SQLiteError, - .message = - "[op-sqlite] SQLite error code: " + std::to_string(step) + - ", description: " + std::string(errorMessage)}; + throw std::runtime_error("[op-sqlite] SQLite error code: " + std::to_string(step) + + ", description: " + std::string(errorMessage)); } int changedRowCount = sqlite3_changes(db); long long latestInsertRowId = sqlite3_last_insert_rowid(db); - return {.type = SQLiteOk, + return { .affectedRows = changedRowCount, .insertId = static_cast(latestInsertRowId)}; } @@ -793,7 +769,7 @@ BridgeResult opsqlite_register_update_hook(std::string const &dbName, // // sqlite3_update_hook(db, &update_callback, (void *)key); - return {SQLiteOk}; + return {}; } BridgeResult opsqlite_deregister_update_hook(std::string const &dbName) { @@ -804,7 +780,7 @@ BridgeResult opsqlite_deregister_update_hook(std::string const &dbName) { // // sqlite3_update_hook(db, nullptr, nullptr); - return {SQLiteOk}; + return {}; } int commit_callback(void *dbName) { @@ -832,7 +808,7 @@ BridgeResult opsqlite_register_commit_hook(std::string const &dbName, // // sqlite3_commit_hook(db, &commit_callback, (void *)key); - return {SQLiteOk}; + return {}; } BridgeResult opsqlite_deregister_commit_hook(std::string const &dbName) { @@ -842,7 +818,7 @@ BridgeResult opsqlite_deregister_commit_hook(std::string const &dbName) { // commitCallbackMap.erase(dbName); // sqlite3_commit_hook(db, nullptr, nullptr); - return {SQLiteOk}; + return {}; } void rollback_callback(void *dbName) { @@ -868,7 +844,7 @@ BridgeResult opsqlite_register_rollback_hook(std::string const &dbName, // // sqlite3_rollback_hook(db, &rollback_callback, (void *)key); - return {SQLiteOk}; + return {}; } BridgeResult opsqlite_deregister_rollback_hook(std::string const &dbName) { @@ -879,7 +855,7 @@ BridgeResult opsqlite_deregister_rollback_hook(std::string const &dbName) { // // sqlite3_rollback_hook(db, nullptr, nullptr); - return {SQLiteOk}; + return {}; } void opsqlite_load_extension(sqlite3 *db, std::string &path, @@ -914,43 +890,29 @@ BatchResult opsqlite_execute_batch(sqlite3 *db, std::vector *commands) { size_t commandCount = commands->size(); if (commandCount <= 0) { - return BatchResult{ - .type = SQLiteError, - .message = "No SQL commands provided", - }; + throw std::invalid_argument("No SQL commands provided"); } - try { - int affectedRows = 0; - opsqlite_execute(db, "BEGIN EXCLUSIVE TRANSACTION", nullptr); - for (int i = 0; i < commandCount; i++) { - const auto &command = commands->at(i); - // We do not provide a datastructure to receive query data because we - // don't need/want to handle this results in a batch execution + + int affectedRows = 0; + opsqlite_execute(db, "BEGIN EXCLUSIVE TRANSACTION", nullptr); + for (int i = 0; i < commandCount; i++) { + const auto &command = commands->at(i); + // We do not provide a datastructure to receive query data because we + // don't need/want to handle this results in a batch execution + try { auto result = opsqlite_execute(db, command.sql, command.params.get()); - if (result.type == SQLiteError) { - opsqlite_execute(db, "ROLLBACK", nullptr); - return BatchResult{ - .type = SQLiteError, - .message = result.message, - }; - } else { - affectedRows += result.affectedRows; - } + affectedRows += result.affectedRows; + } catch(std::exception &exc) { + opsqlite_execute(db, "ROLLBACK", nullptr); + throw exc; } - opsqlite_execute(db, "COMMIT", nullptr); - return BatchResult{ - .type = SQLiteOk, - .affectedRows = affectedRows, - .commands = static_cast(commandCount), - }; - } catch (std::exception &exc) { - opsqlite_execute(db, "ROLLBACK", nullptr); - return BatchResult{ - .type = SQLiteError, - .message = exc.what(), - }; } + opsqlite_execute(db, "COMMIT", nullptr); + return BatchResult{ + .affectedRows = affectedRows, + .commands = static_cast(commandCount), + }; } } // namespace opsqlite diff --git a/cpp/bridge.h b/cpp/bridge.h index e08da343..337f4db5 100644 --- a/cpp/bridge.h +++ b/cpp/bridge.h @@ -39,12 +39,12 @@ void opsqlite_remove(sqlite3 *db, std::string const &name, std::string const &doc_path); void opsqlite_attach(sqlite3 *db, std::string const &main_db_name, - std::string const &doc_path, - std::string const &secondary_db_name, - std::string const &alias); + std::string const &doc_path, + std::string const &secondary_db_name, + std::string const &alias); void opsqlite_detach(sqlite3 *db, std::string const &main_db_name, - std::string const &alias); + std::string const &alias); BridgeResult opsqlite_execute(sqlite3 *db, std::string const &query, const std::vector *params); diff --git a/cpp/types.h b/cpp/types.h index 5e7de46f..1ec90733 100644 --- a/cpp/types.h +++ b/cpp/types.h @@ -14,10 +14,7 @@ struct ArrayBuffer { using JSVariant = std::variant; -enum ResultType { SQLiteOk, SQLiteError }; - struct BridgeResult { - ResultType type; std::string message; int affectedRows; double insertId; @@ -26,7 +23,6 @@ struct BridgeResult { }; struct BatchResult { - ResultType type; std::string message; int affectedRows; int commands; diff --git a/cpp/utils.cpp b/cpp/utils.cpp index fb6b037f..e7112f3d 100644 --- a/cpp/utils.cpp +++ b/cpp/utils.cpp @@ -117,10 +117,6 @@ std::vector to_variant_vec(jsi::Runtime &rt, jsi::Value const &xs) { } jsi::Value create_js_rows(jsi::Runtime &rt, const BridgeResult &status) { - if (status.type == SQLiteError) { - throw std::invalid_argument(status.message); - } - jsi::Object res = jsi::Object(rt); res.setProperty(rt, "rowsAffected", status.affectedRows); @@ -249,37 +245,34 @@ void to_batch_arguments(jsi::Runtime &rt, jsi::Array const &batchParams, BatchResult import_sql_file(sqlite3 *db, std::string fileLocation) { std::string line; std::ifstream sqFile(fileLocation); - if (sqFile.is_open()) { - try { - int affectedRows = 0; - int commands = 0; - opsqlite_execute(db, "BEGIN EXCLUSIVE TRANSACTION", nullptr); - while (std::getline(sqFile, line, '\n')) { - if (!line.empty()) { - BridgeResult result = opsqlite_execute(db, line, nullptr); - if (result.type == SQLiteError) { - opsqlite_execute(db, "ROLLBACK", nullptr); - sqFile.close(); - return {SQLiteError, result.message, 0, commands}; - } else { - affectedRows += result.affectedRows; - commands++; - } + if (!sqFile.is_open()) { + throw std::runtime_error("Could not open file: " + fileLocation); + } + + try { + int affectedRows = 0; + int commands = 0; + opsqlite_execute(db, "BEGIN EXCLUSIVE TRANSACTION", nullptr); + while (std::getline(sqFile, line, '\n')) { + if (!line.empty()) { + try { + auto result = opsqlite_execute(db, line, nullptr); + affectedRows += result.affectedRows; + commands++; + } catch (std::exception &exc) { + opsqlite_execute(db, "ROLLBACK", nullptr); + sqFile.close(); + throw exc; } } - sqFile.close(); - opsqlite_execute(db, "COMMIT", nullptr); - return {SQLiteOk, "", affectedRows, commands}; - } catch (...) { - sqFile.close(); - opsqlite_execute(db, "ROLLBACK", nullptr); - return {SQLiteError, - "[op-sqlite][loadSQLFile] Unexpected error, transaction was " - "rolledback", - 0, 0}; } - } else { - return {SQLiteError, "[op-sqlite][loadSQLFile] Could not open file", 0, 0}; + sqFile.close(); + opsqlite_execute(db, "COMMIT", nullptr); + return {"", affectedRows, commands}; + } catch (std::exception &exc) { + sqFile.close(); + opsqlite_execute(db, "ROLLBACK", nullptr); + throw exc; } } #endif diff --git a/cpp/utils.h b/cpp/utils.h index d2ea3d26..82624aaa 100644 --- a/cpp/utils.h +++ b/cpp/utils.h @@ -3,8 +3,8 @@ #include "DumbHostObject.h" #include "SmartHostObject.h" -#include "types.h" #include "sqlite3.h" +#include "types.h" #include #include #include diff --git a/example/src/tests/queries.spec.ts b/example/src/tests/queries.spec.ts index fc41514c..260cf56f 100644 --- a/example/src/tests/queries.spec.ts +++ b/example/src/tests/queries.spec.ts @@ -31,7 +31,6 @@ export function queriesTests() { afterEach(() => { if (db) { - db.close(); db.delete(); // @ts-ignore db = null;