diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h @@ -26,6 +26,7 @@ static std::string encryptionKey; SQLiteQueryExecutor(); + SQLiteQueryExecutor(std::string sqliteFilePath); std::unique_ptr getThread(std::string threadID) const override; std::string getDraft(std::string key) const override; void updateDraft(std::string key, std::string text) const override; diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp @@ -939,6 +939,11 @@ SQLiteQueryExecutor::migrate(); } +SQLiteQueryExecutor::SQLiteQueryExecutor(std::string sqliteFilePath) { + SQLiteQueryExecutor::sqliteFilePath = sqliteFilePath; + SQLiteQueryExecutor::migrate(); +} + std::string SQLiteQueryExecutor::getDraft(std::string key) const { std::unique_ptr draft = SQLiteQueryExecutor::getStorage().get_pointer(key); @@ -1304,3 +1309,49 @@ #endif } // namespace comm + +// #ifdef EMSCRIPTEN +// using namespace emscripten; +// +// EMSCRIPTEN_BINDINGS(SQLiteQueryExecutor) { +// // vectors +// register_vector("DraftVector"); +// register_vector("ReportVector"); +// register_vector("StringVector"); +// +// // data structures +// value_object("Draft") +// .field("key", &Draft::key) +// .field("text", &Draft::text); +// value_object("Report") +// .field("id", &Report::id) +// .field("report", &Report::report); +// value_object("PersistItem") +// .field("key", &PersistItem::key) +// .field("item", &PersistItem::item); +// +// class_("SQLiteQueryExecutor") +// .constructor<>() +// .function("updateDraft", &SQLiteQueryExecutor::updateDraft) +// .function("updateDraft", &SQLiteQueryExecutor::updateDraft) +// .function("moveDraft", &SQLiteQueryExecutor::moveDraft) +// .function("getAllDrafts", &SQLiteQueryExecutor::getAllDrafts) +// .function("removeAllDrafts", &SQLiteQueryExecutor::removeAllDrafts) +// .function("setMetadata", &SQLiteQueryExecutor::setMetadata) +// .function("clearMetadata", &SQLiteQueryExecutor::clearMetadata) +// .function("getMetadata", &SQLiteQueryExecutor::getMetadata) +// .function("replaceReport", &SQLiteQueryExecutor::replaceReport) +// .function("removeReports", &SQLiteQueryExecutor::removeReports) +// .function("removeAllReports", &SQLiteQueryExecutor::removeAllReports) +// .function("getAllReports", &SQLiteQueryExecutor::getAllReports) +// .function( +// "setPersistStorageItem", +// &SQLiteQueryExecutor::setPersistStorageItem) +// .function( +// "removePersistStorageItem", +// &SQLiteQueryExecutor::removePersistStorageItem) +// .function( +// "getPersistStorageItem", +// &SQLiteQueryExecutor::getPersistStorageItem); +// } +// #endif