Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33448000
D5505.1769022433.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D5505.1769022433.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5505: Revert "Refactor some SQLiteQueryExecutor code"
Attached
Detach File
Event Timeline
Log In to Comment