[KPhotoAlbum] error while executing the SQL backend command
Bart Visscher
kphotoalbum at thisnet.nl
Sat Jun 6 12:30:23 BST 2009
Hi,
I used the following patch to get rid of the exif sql errors. The first 2 hunks
are to get the filename correctly in the sqlite db. I checked it with
sqlitebrowser, and it now shows the filename. Before there was multibyte
encoding garbage. I don't know how to do it correctly maybe the Qt code does a
fixup.
The last part skips non images because Exiv2::ImageFactory::open gives an
exception for avi files that are in my collection.
Bart Visscher
Index: Exif/Database.cpp
===================================================================
--- Exif/Database.cpp (revision 978187)
+++ Exif/Database.cpp (working copy)
@@ -168,7 +169,7 @@
return;
QSqlQuery query( QString::fromLatin1( "DELETE FROM exif WHERE fileName=?" ), _db );
- query.bindValue( 0, _doUTF8Conversion ? fileName.toUtf8() : fileName.toLatin1() );
+ query.bindValue( 0, fileName );
if ( !query.exec() )
showError( query );
}
@@ -185,7 +186,7 @@
}
QSqlQuery query( QString::fromLatin1( "INSERT into exif values (?, %1) " ).arg( formalList.join( QString::fromLatin1( ", " ) ) ), _db );
- query.bindValue( 0, _doUTF8Conversion ? filename.toUtf8() : filename.toLatin1() );
+ query.bindValue( 0, filename );
int i = 1;
for( DatabaseElementList::Iterator tagIt = elms.begin(); tagIt != elms.end(); ++tagIt ) {
(*tagIt)->bindValues( &query, i, data );
@@ -314,7 +315,9 @@
bool success = true;
Q_FOREACH(const DB::ImageInfoPtr info, allImages.fetchInfos()) {
dialog.setValue(i++);
- success &= add(info->fileName(DB::AbsolutePath));
+ if (info->mediaType() == DB::Image) {
+ success &= add(info->fileName(DB::AbsolutePath));
+ }
if ( i % 10 )
qApp->processEvents();
if (!success || dialog.wasCanceled())
More information about the Kphotoalbum
mailing list