Page MenuHomePhorge

D5505.1769022433.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D5505.1769022433.diff

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
@@ -23,10 +23,6 @@
* following the RAII pattern
*/
class DatabaseQueryExecutor {
- virtual void setMetadata(std::string entry_name, std::string data) const = 0;
- virtual void clearMetadata(std::string entry_name) const = 0;
- virtual std::string getMetadata(std::string entry_name) const = 0;
-
public:
virtual std::string getDraft(std::string key) const = 0;
virtual std::unique_ptr<Thread> getThread(std::string threadID) const = 0;
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
@@ -13,9 +13,6 @@
void migrate() const;
static void assign_encryption_key();
static auto &getStorage();
- void setMetadata(std::string entry_name, std::string data) const override;
- void clearMetadata(std::string entry_name) const override;
- std::string getMetadata(std::string entry_name) const override;
static std::once_flag initialized;
static int sqlcipherEncryptionKeySize;
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
@@ -899,38 +899,30 @@
}
void SQLiteQueryExecutor::setNotifyToken(std::string token) const {
- this->setMetadata("notify_token", token);
+ Metadata entry{
+ "notify_token",
+ token,
+ };
+ SQLiteQueryExecutor::getStorage().replace(entry);
}
void SQLiteQueryExecutor::clearNotifyToken() const {
- this->clearMetadata("notify_token");
+ SQLiteQueryExecutor::getStorage().remove<Metadata>("notify_token");
}
void SQLiteQueryExecutor::setCurrentUserID(std::string userID) const {
- this->setMetadata("current_user_id", userID);
-}
-
-std::string SQLiteQueryExecutor::getCurrentUserID() const {
- return this->getMetadata("current_user_id");
-}
-
-void SQLiteQueryExecutor::setMetadata(std::string entry_name, std::string data)
- const {
Metadata entry{
- entry_name,
- data,
+ "current_user_id",
+ userID,
};
SQLiteQueryExecutor::getStorage().replace(entry);
}
-void SQLiteQueryExecutor::clearMetadata(std::string entry_name) const {
- SQLiteQueryExecutor::getStorage().remove<Metadata>(entry_name);
-}
-
-std::string SQLiteQueryExecutor::getMetadata(std::string entry_name) const {
- std::unique_ptr<Metadata> entry =
- SQLiteQueryExecutor::getStorage().get_pointer<Metadata>(entry_name);
- return (entry == nullptr) ? "" : entry->data;
+std::string SQLiteQueryExecutor::getCurrentUserID() const {
+ std::unique_ptr<Metadata> currentUserID =
+ SQLiteQueryExecutor::getStorage().get_pointer<Metadata>(
+ "current_user_id");
+ return (currentUserID == nullptr) ? "" : currentUserID->data;
}
void SQLiteQueryExecutor::clearSensitiveData() const {

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 21, 7:07 PM (17 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5970843
Default Alt Text
D5505.1769022433.diff (3 KB)

Event Timeline