While going through slow queries in my MySQL server, I found this query. UPDATE Thumbnails SET modificationDate=43102 WHERE id='2014-07-13 23:41:14' There are several more examples of it. It looks like modificationDate and id got swapped. Of course, the id is invalid and results in id=2011 being updated. I tried to find the piece of code responsible to provide a patch, but I couldn't find it. Reproducible: Always
Code managing thumbnails database is located here : https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/show/libs/database/core Look all thumbnail* files. Gilles Caulier
Here is the culprit. The parameter order in that line is wrong. https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/database/core/thumbnaildb.cpp#L282
Git commit 5d2fcc5dd65724cc1e37f645956eb8d1010e861e by Gilles Caulier. Committed on 10/03/2015 at 21:43. Pushed by cgilles into branch 'master'. fix inverted parameters to update thumbnail date in database FIXED-IN: 4.9.0 M +5 -5 libs/database/core/thumbnaildb.cpp http://commits.kde.org/digikam/5d2fcc5dd65724cc1e37f645956eb8d1010e861e
Git commit c88f5f53bca3aa0bb29fed90edb92b5ea3598ce1 by Gilles Caulier. Committed on 10/03/2015 at 21:48. Pushed by cgilles into branch 'frameworks'. backport commit #5d2fcc5dd65724cc1e37f645956eb8d1010e861e from git/master to frameworks branch M +4 -4 libs/database/core/thumbnaildb.cpp http://commits.kde.org/digikam/c88f5f53bca3aa0bb29fed90edb92b5ea3598ce1 diff --git a/libs/database/core/thumbnaildb.cpp b/libs/database/core/thumbnaildb.cpp index e330d83..76b782f 100644 --- a/libs/database/core/thumbnaildb.cpp +++ b/libs/database/core/thumbnaildb.cpp @@ -255,9 +255,9 @@ DatabaseCoreBackend::QueryState ThumbnailDB::insertThumbnail(const DatabaseThumb { QVariant id; DatabaseCoreBackend::QueryState lastQueryState; - lastQueryState= d->db->execSql(QLatin1String("INSERT INTO Thumbnails (type, modificationDate, orientationHint, data) VALUES (?, ?, ?, ?);"), - info.type, info.modificationDate, info.orientationHint, info.data, - 0, &id); + lastQueryState = d->db->execSql(QLatin1String("INSERT INTO Thumbnails (type, modificationDate, orientationHint, data) VALUES (?, ?, ?, ?);"), + info.type, info.modificationDate, info.orientationHint, info.data, + 0, &id); if (DatabaseCoreBackend::NoErrors == lastQueryState) { @@ -279,7 +279,7 @@ DatabaseCoreBackend::QueryState ThumbnailDB::replaceThumbnail(const DatabaseThum DatabaseCoreBackend::QueryState ThumbnailDB::updateModificationDate(int thumbId, const QDateTime& modificationDate) { - return d->db->execSql(QLatin1String("UPDATE Thumbnails SET modificationDate=? WHERE id=?;"), thumbId, modificationDate); + return d->db->execSql(QLatin1String("UPDATE Thumbnails SET modificationDate=? WHERE id=?;"), modificationDate, thumbId); } void ThumbnailDB::replaceUniqueHash(const QString& oldUniqueHash, int oldFileSize,