Some temporary debugging messages.
authorMikko Keinänen <mikko.keinanen@gmail.com>
Mon, 27 Sep 2010 20:08:27 +0000 (23:08 +0300)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Mon, 27 Sep 2010 20:08:27 +0000 (23:08 +0300)
src/db/dbmediaimagecontainer.cpp

index 0705f3c..5df814a 100644 (file)
@@ -44,8 +44,10 @@ int DbMediaImageContainer::insertDataObjectToModel(const EmuFrontObject *efo)
 
     // check if this media image container is already in the database
     int fileId = -1;
-    if ((fileId = getMediaImageContainer(mic->getCheckSum())) >= 0)
+    if ((fileId = getMediaImageContainer(mic->getCheckSum())) >= 0) {
+        qDebug() << "Media image container already in db with id " << fileId << ".";
         return fileId;
+   }
 
     if (!mic->getFilePath())
         throw new EmuFrontException("Cannot install media image "
@@ -54,6 +56,8 @@ int DbMediaImageContainer::insertDataObjectToModel(const EmuFrontObject *efo)
     QList<MediaImage*> images = mic->getMediaImages();
     QList<int> ids = dbMediaImage->storeMediaImages(images);
 
+    qDebug() << "Stored " << ids.count() << " media images.";
+
     if (ids.count() <= 0)
         return -1;
 
@@ -68,6 +72,8 @@ int DbMediaImageContainer::insertDataObjectToModel(const EmuFrontObject *efo)
         // file id is also the media image container id
         fileId = DbFile::insertDataObjectToModel(mic);
 
+        qDebug() << "Inserted media image container to file table with id " << fileId << ".";
+
         if (fileId < 0) {
             // TODO: note we most surely need to catch the exception
             // in the calling code block and clean
@@ -91,7 +97,9 @@ int DbMediaImageContainer::insertDataObjectToModel(const EmuFrontObject *efo)
             DbFile::deleteDataObject(fileId);
             throw new EmuFrontException("Failed inserting media image to database!");
         }
+        qDebug() << "Inserted media image container " << fileId << " to mediaimagecontainer table.";
         linkMediaImagesWithContainer(fileId, ids);
+        qDebug() << "Linked media image container with media images.";
     } catch (EmuFrontException e) {
         dbMediaImage->removeOrphanedMediaImages(ids);
         throw e;
@@ -176,6 +184,7 @@ void DbMediaImageContainer::linkMediaImagesWithContainer(int micId, QList<int> m
     q.bindValue(":micid", micId);
 
     foreach(int miid, miIds) {
+        qDebug() << "Linking media image container " << micId << " to media image " << miid  << ".";
         q.bindValue(":miid", miid);
         if (!q.exec()) {
             throw new EmuFrontException(QString("Failed linking media "