mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 53 3de6c4cf6b67
equal deleted inserted replaced
60:bdd9da0d70fe 66:1f1dad4af8f8
  3987     TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
  3987     TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
  3988     TInt table = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountTable);
  3988     TInt table = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountTable);
  3989     switch(table)
  3989     switch(table)
  3990         {
  3990         {
  3991         case EMPXCollectionCountTrack:
  3991         case EMPXCollectionCountTrack:
  3992             count = (TInt)iDbHandler->GetMusicCountL(drive);
  3992             TRAPD( trackerr, count = (TInt)iDbHandler->GetMusicCountL(drive) );
       
  3993             MPX_DEBUG2( "CMPXDbPlugin::DoGetCollectionCountL, trackerr =%d", trackerr );
       
  3994             if ( trackerr == KErrCorrupt )
       
  3995                 {
       
  3996                 iDbHandler->CloseDatabaseL( drive );
       
  3997                 iDbHandler->RecreateDatabaseFileL( drive );
       
  3998                 iDbHandler->OpenDatabaseL( drive );
       
  3999                 count = (TInt)iDbHandler->GetMusicCountL(drive);
       
  4000                 }
       
  4001             
  3993             break;
  4002             break;
  3994         case EMPXCollectionCountPlaylist:
  4003         case EMPXCollectionCountPlaylist:
  3995             count = (TInt)iDbHandler->GetPlaylistCountL(drive);
  4004             TRAPD( playlisterr, count = (TInt)iDbHandler->GetPlaylistCountL(drive) );
       
  4005             MPX_DEBUG2( "CMPXDbPlugin::DoGetCollectionCountL, playlisterr =%d", playlisterr );
       
  4006             if ( playlisterr == KErrCorrupt )
       
  4007                 {
       
  4008                 iDbHandler->CloseDatabaseL( drive );
       
  4009                 iDbHandler->RecreateDatabaseFileL( drive );
       
  4010                 iDbHandler->OpenDatabaseL( drive );
       
  4011                 count = (TInt)iDbHandler->GetPlaylistCountL(drive);
       
  4012                 }
  3996             break;
  4013             break;
  3997         case EMPXCollectionCountTotal:
  4014         case EMPXCollectionCountTotal:
  3998             count = (TInt)iDbHandler->GetTotalCountL(drive);
  4015             TRAPD( totalerr, count = (TInt)iDbHandler->GetTotalCountL(drive) );
       
  4016             MPX_DEBUG2( "CMPXDbPlugin::DoGetCollectionCountL, totalerr =%d", totalerr );
       
  4017             if ( totalerr == KErrCorrupt )
       
  4018                 {
       
  4019                 iDbHandler->CloseDatabaseL( drive );
       
  4020                 iDbHandler->RecreateDatabaseFileL( drive );
       
  4021                 iDbHandler->OpenDatabaseL( drive );
       
  4022                 count = (TInt)iDbHandler->GetTotalCountL(drive);
       
  4023                 }
  3999             break;
  4024             break;
  4000         default:
  4025         default:
  4001             User::Leave(KErrArgument);
  4026             User::Leave(KErrArgument);
  4002         }
  4027         }
  4003     ((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);
  4028     ((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);