[SQL] invalid result of uniqueHash

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

[SQL] invalid result of uniqueHash

Markus Leuthold
Is there a reason why the uniqueHashVersion is not upgraded to v2 during the database schema upgrade to v8?

I see that there are two versions of uniqueHash:

 - DImgLoader::uniqueHash returns md5.result()
 - DImgLoader::uniqueHashV2 returns md5.result().toHex()

However, both hash versions are afterwards used the same way, ignoring the fact that only v2 is converted to hex. This doesn't feel right.

I have a database schema v8, but still the old uniqueHash version. My settings table doesn't contain a uniqueHashVersion key
I have a new image which results in the SQL error:

"REPLACE INTO Images  ( album, name, status, category, modificationDate, fileSize, uniqueHash )  VALUES (?,?,?,?,?,?,?);" 
Error messages: "QMYSQL3: Unable to execute statement" "Incorrect string value: '\\xF1\\x9E\\xA6\\x87' for column 'uniqueHash' at row 1" 1366 2 
Bound values:  (QVariant(int, 118053), QVariant(QString, "P4240656.JPG"), QVariant(int, 1), QVariant(int, 1), QVariant(QString, "2016-10-30T19:16:42"), QVariant(qlonglong, 6951936), QVariant(QString, "m�7�\U0005E987"))
digikam.dbengine: Failure executing query:

My assumtion is that for this particular image, the uniqueHashV1 creates an "incorrect string value" in the SQL statement due to the missing toHex() It doesn't happen with other pictures, or what to you guys think?

Instead of fixing this bug, it's probably better to upgrade the uniqueHash values to V2 in the next database schema update. How can I do that manually?

thanks for helping!
Kusi


Reply | Threaded
Open this post in threaded view
|

Re: [SQL] invalid result of uniqueHash

Gilles Caulier-4
See the report below :


Gilles Caulier

2016-11-26 18:43 GMT+01:00 Markus Leuthold <[hidden email]>:
Is there a reason why the uniqueHashVersion is not upgraded to v2 during the database schema upgrade to v8?

I see that there are two versions of uniqueHash:

 - DImgLoader::uniqueHash returns md5.result()
 - DImgLoader::uniqueHashV2 returns md5.result().toHex()

However, both hash versions are afterwards used the same way, ignoring the fact that only v2 is converted to hex. This doesn't feel right.

I have a database schema v8, but still the old uniqueHash version. My settings table doesn't contain a uniqueHashVersion key
I have a new image which results in the SQL error:

"REPLACE INTO Images  ( album, name, status, category, modificationDate, fileSize, uniqueHash )  VALUES (?,?,?,?,?,?,?);" 
Error messages: "QMYSQL3: Unable to execute statement" "Incorrect string value: '\\xF1\\x9E\\xA6\\x87' for column 'uniqueHash' at row 1" 1366 2 
Bound values:  (QVariant(int, 118053), QVariant(QString, "P4240656.JPG"), QVariant(int, 1), QVariant(int, 1), QVariant(QString, "2016-10-30T19:16:42"), QVariant(qlonglong, 6951936), QVariant(QString, "m�7�\U0005E987"))
digikam.dbengine: Failure executing query:

My assumtion is that for this particular image, the uniqueHashV1 creates an "incorrect string value" in the SQL statement due to the missing toHex() It doesn't happen with other pictures, or what to you guys think?

Instead of fixing this bug, it's probably better to upgrade the uniqueHash values to V2 in the next database schema update. How can I do that manually?

thanks for helping!
Kusi