[Digikam-users] Some questions about digikam4.db

Jean-François Rabasse jean-francois.rabasse at wanadoo.fr
Wed Nov 9 20:05:10 GMT 2011


On Wed, 9 Nov 2011, Gilles Caulier wrote:

> Make a backup and drop table using sqlite manager.
>
> http://www.sqlitemanager.org/
>
> If it work, perhaps somebody can write a script to automatize this task
>
> Gilles

>> 2011/11/9 Anders Stedtlund <falolaf at gmail.com>
>>
>> Hi,
>>
>> I have just tested anyway. (Have backup of course...)
>>
>> Deleted Thumbnails and compacted. Now the size of digikam4.db is
>> ~20MB. digiKam starts and everything seems to be working...
>>
>> I can see that there is actually 4 tables that have been removed:
>> CustomIdentifiers
>> FilePaths
>> Thumbnails
>> UniqueHashes
>>
>> How about removing them all from the old db? What might happen?
>>
>> /Anders

Hello,

Just a hint,
probably no need that somebody writes a script to automatize that
kind of task.
The command line SQLite client can already work with commands files.

Write SQL commands (and metacommands, at least the final .exit) you want
to do in a simple text file. Let's call it "cleanup" and it contains the
two following lines :

   delete from Thumbnails;
   .exit

then run the command (after backup of your .db file, as usual) :
   sqlite3 -init cleanup digikam4.db

and you're done.

And if you wish to do more jobs and empty more tables, as Anders
suggested, just change the file into :

delete from Thumbnails;
delete from CustomIdentifiers;
delete from FilePaths;
delete from UniqueHashes;
.exit


> Make a backup and drop table using sqlite manager.

Gilles, did you meant "drop" or "empty" the table ?
IMHO I think dropping tables should be discouraged.

  delete from Thumbnails;
will remove all data tuples in the table, making the table empty.

  drop table Thumbnails;
will destroy also the table, thus altering the DB schema and most
applications don't really love missing tables.

I don't know what the sqlitebrowser does exactly, but this issue should
probably be considered.

Jean-François


More information about the Digikam-users mailing list