mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 53 3de6c4cf6b67
--- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp	Wed Sep 15 12:09:46 2010 +0300
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp	Wed Oct 13 14:28:40 2010 +0300
@@ -3050,7 +3050,18 @@
         }
 
     TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
-    TInt count = (TInt)iDbHandler->GetTotalCountL(drive);
+
+    TInt count = 0;
+    TRAPD( totalerr, count = (TInt)iDbHandler->GetTotalCountL(drive) );
+    MPX_DEBUG2( "CMPXPodcastDbPlugin::DoGetCollectionCountL, totalerr =%d", totalerr );
+    if ( totalerr == KErrCorrupt )
+        {
+        iDbHandler->CloseDatabaseL( drive );
+        iDbHandler->RecreateDatabaseFileL( drive );
+        iDbHandler->OpenDatabaseL( drive );
+        count = (TInt)iDbHandler->GetTotalCountL(drive);
+        }
+        
     ((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);
     }