Discussion:
[KPhotoAlbum] EXIF DB questions
Tobias Leupold
2015-08-29 06:43:00 UTC
Permalink
Hi all,

still I don't know much about the EXIF DB, but I noticed one thing (and as
we're talking about it right now, I thought I should ask ;-)

With the recent lens patches, I get

Error running query: alter table exif add column Exif_Photo_LensModel
string
Error was: No query Unable to fetch row

when starting KPA. This does not seem to bother KPA, I just noticed it and
thought this could be interesting ...

And another thing: I usually run KPA with my default locale de_DE. When I
start it in the C locale (e. g. to be able to post an original error message
like the above), two things happen:

I get a lot of these messages:

Error running query: INSERT into exif values (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Error was: UNIQUE constraint failed: exif.filename Unable to fetch row

and: KPA starts to re-scan the whole collection.

Shouldn't the persistence layer be independent of the used locale?

Cheers, Tobias
Johannes Zarl-Zierl
2015-08-29 14:47:49 UTC
Permalink
Hi Tobias,
Post by Tobias Leupold
With the recent lens patches, I get
Error running query: alter table exif add column Exif_Photo_LensModel
string
Error was: No query Unable to fetch row
when starting KPA. This does not seem to bother KPA, I just noticed it and
thought this could be interesting ...
This sounds like you might have run the original patch for adding the lens
model. That version didn't include graceful upgrade of the exif db schema,
yet.

Can you show me the output of the following commands?

sqlite3 exif-info.db 'select * from settings;'
sqlite3 exif-info.db .schema
Post by Tobias Leupold
And another thing: I usually run KPA with my default locale de_DE. When I
start it in the C locale (e. g. to be able to post an original error message
Error running query: INSERT into exif values (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Error was: UNIQUE constraint failed: exif.filename Unable to fetch row
Maybe you have filenames that are somehow interpreted as being the same when
you use the c locale. I guess this doesn't happen with a locale of en_US.utf8?

Maybe you can get a more descriptive error message using sqlite. Can you try
running some queries (e.g. 'select filename from exif;') using the C locale
with sqlite? Maybe the sqlite client prints a more detailed error message
containing the keys that are deemed not unique...
Post by Tobias Leupold
and: KPA starts to re-scan the whole collection.
That's somewhat surprising. AFAICS KPA does not recreat the exif db even if
there has been a problem in the exif db.
Post by Tobias Leupold
Shouldn't the persistence layer be independent of the used locale?
Normally, yes. The data should always arrive in the exif db as utf-8. Having
no additional info, I would wager that using the C locale affects UTF-8
handling in the Qt SQL classes that we use.


Johannes
Tobias Leupold
2015-08-29 14:57:29 UTC
Permalink
Post by Johannes Zarl-Zierl
Can you show me the output of the following commands?
sqlite3 exif-info.db 'select * from settings;'
DBVersion|2
Post by Johannes Zarl-Zierl
sqlite3 exif-info.db .schema
CREATE TABLE settings (keyword TEXT PRIMARY KEY, value TEXT) without rowid;
CREATE TABLE exif (filename string PRIMARY KEY, Exif_Photo_FocalLength float,
Exif_Photo_ExposureTime float, Exif_Photo_ApertureValue float,
Exif_Photo_FNumber float, Exif_Photo_Flash int, Exif_Photo_Contrast int,
Exif_Photo_Sharpness int, Exif_Photo_Saturation int, Exif_Image_Orientation
int, Exif_Photo_MeteringMode int, Exif_Photo_ISOSpeedRatings int,
Exif_Photo_ExposureProgram int, Exif_Image_Make string, Exif_Image_Model
string, Exif_GPSInfo_GPSVersionID int, Exif_GPSInfo_GPSAltitude float,
Exif_GPSInfo_GPSAltitudeRef int, Exif_GPSInfo_GPSMeasureMode string,
Exif_GPSInfo_GPSDOP float, Exif_GPSInfo_GPSImgDirection float,
Exif_GPSInfo_GPSLatitude float, Exif_GPSInfo_GPSLatitudeRef string,
Exif_GPSInfo_GPSLongitude float, Exif_GPSInfo_GPSLongitudeRef string,
Exif_GPSInfo_GPSTimeStamp float , Exif_Photo_LensModel string);
Post by Johannes Zarl-Zierl
Maybe you have filenames that are somehow interpreted as being the same when
you use the c locale. I guess this doesn't happen with a locale of en_US.utf8?
With LC_ALL=en_US.utf8, this does not happen, but the UI is still German ...
Post by Johannes Zarl-Zierl
Maybe you can get a more descriptive error message using sqlite. Can you try
running some queries (e.g. 'select filename from exif;') using the C locale
with sqlite? Maybe the sqlite client prints a more detailed error message
containing the keys that are deemed not unique...
With "select filename from exif;", I get the very same output, no matter if I
use my normal locale or C. Anway, it seems to be only a small subset of my
images in the EXIF db, I only get 897 entries, but I have 8521 images ...

Well, could it be that my EXIF db is abit messed up? I'm using git master KPA
for my real collection if I mess with it ...
Johannes Zarl-Zierl
2015-08-29 23:48:39 UTC
Permalink
Post by Tobias Leupold
Post by Johannes Zarl-Zierl
Can you show me the output of the following commands?
sqlite3 exif-info.db 'select * from settings;'
DBVersion|2
The current git master uses DBVersion 3, the difference to version 2 being the
Exif_Photo_LensModel column.
Post by Tobias Leupold
Post by Johannes Zarl-Zierl
sqlite3 exif-info.db .schema
CREATE TABLE settings (keyword TEXT PRIMARY KEY, value TEXT) without rowid;
CREATE TABLE exif (filename string PRIMARY KEY, Exif_Photo_FocalLength
float, Exif_Photo_ExposureTime float, Exif_Photo_ApertureValue float,
Exif_Photo_FNumber float, Exif_Photo_Flash int, Exif_Photo_Contrast int,
Exif_Photo_Sharpness int, Exif_Photo_Saturation int, Exif_Image_Orientation
int, Exif_Photo_MeteringMode int, Exif_Photo_ISOSpeedRatings int,
Exif_Photo_ExposureProgram int, Exif_Image_Make string, Exif_Image_Model
string, Exif_GPSInfo_GPSVersionID int, Exif_GPSInfo_GPSAltitude float,
Exif_GPSInfo_GPSAltitudeRef int, Exif_GPSInfo_GPSMeasureMode string,
Exif_GPSInfo_GPSDOP float, Exif_GPSInfo_GPSImgDirection float,
Exif_GPSInfo_GPSLatitude float, Exif_GPSInfo_GPSLatitudeRef string,
Exif_GPSInfo_GPSLongitude float, Exif_GPSInfo_GPSLongitudeRef string,
Exif_GPSInfo_GPSTimeStamp float , Exif_Photo_LensModel string);
Your exif db already has the lens model column. I just realized that this is a
problem in the upgrade routine. The schema update fails to update the
DBVersion field.

You can try fixing this discrepancy manually for now:
sqlite4 exif-info.db "update settings set value = '3' where keyword =
'DBVersion';"
Post by Tobias Leupold
Post by Johannes Zarl-Zierl
Maybe you have filenames that are somehow interpreted as being the same
when you use the c locale. I guess this doesn't happen with a locale of
en_US.utf8?
With LC_ALL=en_US.utf8, this does not happen, but the UI is still German ...
Post by Johannes Zarl-Zierl
Maybe you can get a more descriptive error message using sqlite. Can you
try running some queries (e.g. 'select filename from exif;') using the C
locale with sqlite? Maybe the sqlite client prints a more detailed error
message containing the keys that are deemed not unique...
With "select filename from exif;", I get the very same output, no matter if
I use my normal locale or C. Anway, it seems to be only a small subset of
my images in the EXIF db, I only get 897 entries, but I have 8521 images
...
Well, could it be that my EXIF db is abit messed up? I'm using git master
KPA for my real collection if I mess with it ...
Seems like it. It would be normal if the number of entries differed a little
(video files, other image files that are not parsable by exiv2), but not by
such a large margin.

Johannes

Loading...