[digikam] [Bug 345025] New: Wrong sql statement updating thumbnail modification date

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 345025] New: Wrong sql statement updating thumbnail modification date

Alvaro Soliverez
https://bugs.kde.org/show_bug.cgi?id=345025

            Bug ID: 345025
           Summary: Wrong sql statement updating thumbnail modification
                    date
           Product: digikam
           Version: 4.7.0
          Platform: Archlinux Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Database
          Assignee: [hidden email]
          Reporter: [hidden email]

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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 345025] Wrong sql statement updating thumbnail modification date

Gilles Caulier-4
https://bugs.kde.org/show_bug.cgi?id=345025

Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #1 from Gilles Caulier <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 345025] Wrong sql statement updating thumbnail modification date

Alvaro Soliverez
In reply to this post by Alvaro Soliverez
https://bugs.kde.org/show_bug.cgi?id=345025

--- Comment #2 from Alvaro Soliverez <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 345025] Wrong sql statement updating thumbnail modification date

Gilles Caulier-4
In reply to this post by Alvaro Soliverez
https://bugs.kde.org/show_bug.cgi?id=345025

Gilles Caulier <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Latest Commit|                            |http://commits.kde.org/digi
                   |                            |kam/5d2fcc5dd65724cc1e37f64
                   |                            |5956eb8d1010e861e
             Status|UNCONFIRMED                 |RESOLVED
   Version Fixed In|                            |4.9.0

--- Comment #3 from Gilles Caulier <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 345025] Wrong sql statement updating thumbnail modification date

Gilles Caulier-4
In reply to this post by Alvaro Soliverez
https://bugs.kde.org/show_bug.cgi?id=345025

--- Comment #4 from Gilles Caulier <[hidden email]> ---
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,

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 345025] Wrong sql statement updating thumbnail modification date

bugzilla_noreply
In reply to this post by Alvaro Soliverez
https://bugs.kde.org/show_bug.cgi?id=345025

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Database                    |Database-Thumbs

--
You are receiving this mail because:
You are the assignee for the bug.