[Pkg-owncloud-commits] [owncloud-client] 294/470: SyncJournalDb: Close the db on error in getFileRecord()
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 648328fbe22383164354b4aae8ab9bfecfa03028
Author: Klaas Freitag <freitag at owncloud.com>
Date: Mon Apr 11 12:40:19 2016 +0200
SyncJournalDb: Close the db on error in getFileRecord()
The idea is that the next call to any database operation will try to
reopen the database through the checkConnect() method. So even if there
was a disconnect trom the db file, this will reestablish the connection.
---
src/libsync/syncjournaldb.cpp | 9 +++++++--
src/libsync/syncjournaldb.h | 5 ++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/libsync/syncjournaldb.cpp b/src/libsync/syncjournaldb.cpp
index 26cfa6d..215bd00 100644
--- a/src/libsync/syncjournaldb.cpp
+++ b/src/libsync/syncjournaldb.cpp
@@ -770,7 +770,7 @@ bool SyncJournalDb::deleteFileRecord(const QString& filename, bool recursively)
}
-SyncJournalFileRecord SyncJournalDb::getFileRecord( const QString& filename )
+SyncJournalFileRecord SyncJournalDb::getFileRecord(const QString& filename)
{
QMutexLocker locker(&_mutex);
@@ -784,6 +784,8 @@ SyncJournalFileRecord SyncJournalDb::getFileRecord( const QString& filename )
if (!_getFileRecordQuery->exec()) {
QString err = _getFileRecordQuery->error();
qDebug() << "Error creating prepared statement: " << _getFileRecordQuery->lastQuery() << ", Error:" << err;;
+ locker.unlock();
+ close();
return rec;
}
@@ -806,7 +808,10 @@ SyncJournalFileRecord SyncJournalDb::getFileRecord( const QString& filename )
}
} else {
QString err = _getFileRecordQuery->error();
- qDebug() << "No journal entry found for " << filename;
+ qDebug() << "No journal entry found for " << filename << "Error: " << err;
+ locker.unlock();
+ close();
+ locker.relock();
}
_getFileRecordQuery->reset_and_clear_bindings();
}
diff --git a/src/libsync/syncjournaldb.h b/src/libsync/syncjournaldb.h
index 29cc2a9..c6b40bf 100644
--- a/src/libsync/syncjournaldb.h
+++ b/src/libsync/syncjournaldb.h
@@ -38,7 +38,10 @@ class OWNCLOUDSYNC_EXPORT SyncJournalDb : public QObject
public:
explicit SyncJournalDb(const QString& path, QObject *parent = 0);
virtual ~SyncJournalDb();
- SyncJournalFileRecord getFileRecord( const QString& filename );
+
+ // to verify that the record could be queried successfully check
+ // with SyncJournalFileRecord::isValid()
+ SyncJournalFileRecord getFileRecord(const QString& filename);
bool setFileRecord( const SyncJournalFileRecord& record );
/// Like setFileRecord, but preserves checksums
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list