diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp b/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseManager.cpp @@ -51,6 +51,8 @@ thread_local SQLiteQueryExecutor restoredQueryExecutor( DatabaseManager::restoredConnectionManager, true); + restoredQueryExecutor.setConnectionManager( + DatabaseManager::restoredConnectionManager); return restoredQueryExecutor; } 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 @@ -37,6 +37,8 @@ bool skipMigration = false); ~SQLiteQueryExecutor(); + void setConnectionManager( + std::shared_ptr connectionManager); void migrate() const override; std::unique_ptr getThread(std::string threadID) 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 @@ -80,6 +80,11 @@ } } +void SQLiteQueryExecutor::setConnectionManager( + std::shared_ptr connectionManager) { + this->connectionManager = std::move(connectionManager); +} + sqlite3 *SQLiteQueryExecutor::getConnection() const { this->connectionManager->initializeConnection(); return this->connectionManager->getConnection();