[Digikam-users] SQLITE INSERT

Andy Choens andy.choens at gmail.com
Sun Apr 29 21:21:06 BST 2007


HI,

I am slowly but surely figuring out how to reproduce my F-Spot database in 
Digikam.

I know I accomplsh most of this with exiv2, but I have decided this "problem" 
gives me an excuse to learn more about SQL. Thus, my solution *must* be a SQL 
solution, for educational type reasons.

I have pulled my information out of F-Spot's database. Multiple table SQL 
queries are easy. I can use regular expressions magic to reformat the f-spot 
info into the type of info digikam needs. So far, so good.

Digikam has indexed all of my photos, and I reproduced my tag structure in 
Digikam. Now all I need to do is to re-associate photos with tags. Therein 
lies my problem. 

If someone could help me with the following SQLITE problem, I'll be able to 
take the last, crucial step.

I need to insert the appropriate imageid and tag id into ImageTags. As I 
understand SQL that is as simple as:

INSERT INTO "ImageTags" VALUES(443,150);

But, I need to be able to match the imageid in ImageTags to specific values of 
dirid and name. I would like to make a statement along the lines of.

INSERT INTO ImageTags VALUES(Images.id, 1)
WHERE (Images.dirid = '2003/') AND (Images.name='dscn1234.jpg');

I believe the logic is sound, but I can't figure out the SQL. Should I use 
some kind of INNER JOIN to make a temporary database with the necessary 
properties? If so, can I use the value from Images.id as a VALUES parameter?

Thanks!
--andydigik

--andy



More information about the Digikam-users mailing list