Page MenuHomePhorge

D14519.1768801972.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D14519.1768801972.diff

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
@@ -32,10 +32,10 @@
static int backupDataKeySize;
static std::string backupLogDataKey;
static int backupLogDataKeySize;
+ static std::unordered_set<std::string> backedUpTablesAllowlist;
#ifndef EMSCRIPTEN
static NativeSQLiteConnectionManager connectionManager;
- static std::unordered_set<std::string> backedUpTablesAllowlist;
static void generateBackupDataKey();
static void generateBackupLogDataKey();
static void initializeTablesForLogMonitoring();
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
@@ -38,8 +38,6 @@
std::string SQLiteQueryExecutor::backupLogDataKey;
int SQLiteQueryExecutor::backupLogDataKeySize = 32;
-#ifndef EMSCRIPTEN
-NativeSQLiteConnectionManager SQLiteQueryExecutor::connectionManager;
std::unordered_set<std::string> SQLiteQueryExecutor::backedUpTablesAllowlist = {
"drafts",
"threads",
@@ -49,6 +47,9 @@
"aux_users",
"entries",
};
+
+#ifndef EMSCRIPTEN
+NativeSQLiteConnectionManager SQLiteQueryExecutor::connectionManager;
#else
SQLiteConnectionManager SQLiteQueryExecutor::connectionManager;
#endif
@@ -3366,29 +3367,11 @@
throw std::runtime_error(error_message.str());
}
- sqlite3_backup *backupObj = sqlite3_backup_init(
- SQLiteQueryExecutor::getConnection(), "main", backupDB, "main");
- if (!backupObj) {
- std::stringstream error_message;
- error_message << "Failed to init backup for main compaction. Details: "
- << sqlite3_errmsg(SQLiteQueryExecutor::getConnection())
- << std::endl;
- sqlite3_close(backupDB);
- throw std::runtime_error(error_message.str());
- }
-
- int backupResult = sqlite3_backup_step(backupObj, -1);
- sqlite3_backup_finish(backupObj);
- sqlite3_close(backupDB);
- if (backupResult == SQLITE_BUSY || backupResult == SQLITE_LOCKED) {
- throw std::runtime_error(
- "Programmer error. Database in transaction during restore attempt.");
- } else if (backupResult != SQLITE_DONE) {
- std::stringstream error_message;
- error_message << "Failed to restore database from backup. Details: "
- << sqlite3_errstr(backupResult);
- throw std::runtime_error(error_message.str());
- }
+ std::vector<std::string> tablesVector(
+ SQLiteQueryExecutor::backedUpTablesAllowlist.begin(),
+ SQLiteQueryExecutor::backedUpTablesAllowlist.end());
+ copyTablesDataUsingAttach(
+ SQLiteQueryExecutor::getConnection(), plaintextBackupPath, tablesVector);
attempt_delete_file(
plaintextBackupPath,
diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 19, 5:52 AM (15 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5954666
Default Alt Text
D14519.1768801972.diff (3 KB)

Event Timeline