diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h @@ -66,7 +66,6 @@ virtual std::string getCurrentUserID() const = 0; virtual void setDeviceID(std::string deviceID) const = 0; virtual std::string getDeviceID() const = 0; - virtual void clearSensitiveData() const = 0; }; } // namespace comm 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 @@ -65,7 +65,7 @@ std::string getCurrentUserID() const override; void setDeviceID(std::string deviceID) const override; std::string getDeviceID() const override; - void clearSensitiveData() const override; + static void clearSensitiveData(); }; } // namespace comm 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 @@ -1105,7 +1105,7 @@ return (entry == nullptr) ? "" : entry->data; } -void SQLiteQueryExecutor::clearSensitiveData() const { +void SQLiteQueryExecutor::clearSensitiveData() { if (file_exists(SQLiteQueryExecutor::sqliteFilePath) && std::remove(SQLiteQueryExecutor::sqliteFilePath.c_str())) { std::ostringstream errorStream; diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp @@ -1042,7 +1042,7 @@ taskType job = [this, promise]() { std::string error; try { - DatabaseManager::getQueryExecutor().clearSensitiveData(); + SQLiteQueryExecutor::clearSensitiveData(); } catch (const std::exception &e) { error = e.what(); }