}
}
+bool SyncJournalDb::open()
+{
+ QMutexLocker lock(&_mutex);
+ return checkConnect();
+}
+
+bool SyncJournalDb::isOpen()
+{
+ QMutexLocker lock(&_mutex);
+ return _db.isOpen();
+}
void SyncJournalDb::commitInternal(const QString &context, bool startTrans)
{
close();
}
-bool SyncJournalDb::isConnected()
-{
- QMutexLocker lock(&_mutex);
- return checkConnect();
-}
bool operator==(const SyncJournalDb::DownloadInfo &lhs,
const SyncJournalDb::DownloadInfo &rhs)
void commit(const QString &context, bool startTrans = true);
void commitIfNeededAndStartNewTransaction(const QString &context);
- void close();
-
- /**
- * return true if everything is correct
+ /** Open the db if it isn't already.
+ *
+ * This usually creates some temporary files next to the db file, like
+ * $dbfile-shm or $dbfile-wal.
+ *
+ * returns true if it could be openend or is currently opened.
*/
- bool isConnected();
+ bool open();
+
+ /** Returns whether the db is currently openend. */
+ bool isOpen();
+
+ /** Close the database */
+ void close();
/**
* Returns the checksum type for an id.
_vfs.data(), &Vfs::fileStatusChanged);
_vfs->start(vfsParams);
+
+ // Immediately mark the sqlite temporaries as excluded. They get recreated
+ // on db-open and need to get marked again every time.
+ QString stateDbFile = _journal.databaseFilePath();
+ _journal.open();
+ _vfs->fileStatusChanged(stateDbFile + "-wal", SyncFileStatus::StatusExcluded);
+ _vfs->fileStatusChanged(stateDbFile + "-shm", SyncFileStatus::StatusExcluded);
}
int Folder::slotDiscardDownloadProgress()
qCInfo(lcEngine) << verStr;
// This creates the DB if it does not exist yet.
- if (!_journal->isConnected()) {
+ if (!_journal->open()) {
qCWarning(lcEngine) << "No way to create a sync journal!";
syncError(tr("Unable to open or create the local sync database. Make sure you have write access in the sync folder."));
finalize(false);
qCInfo(lcEngine) << "#### Discovery end #################################################### " << _stopWatch.addLapTime(QLatin1String("Discovery Finished")) << "ms";
// Sanity check
- if (!_journal->isConnected()) {
+ if (!_journal->open()) {
qCWarning(lcEngine) << "Bailing out, DB failure";
syncError(tr("Cannot open the sync journal"));
finalize(false);