mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp
changeset 37 eb79a7c355bf
parent 35 fdb31ab341af
child 38 b93f525c9244
equal deleted inserted replaced
36:a0afa279b8fe 37:eb79a7c355bf
   271             }
   271             }
   272 
   272 
   273         TInt count(iDatabaseHandles.Count());
   273         TInt count(iDatabaseHandles.Count());
   274         for ( TInt i = 0; i < count ; ++i )
   274         for ( TInt i = 0; i < count ; ++i )
   275             {
   275             {
       
   276             if ( ! iDatabaseHandles[i].iOpen )
       
   277                 {
       
   278                 MPX_DEBUG1("CMPXDbManager::CopyDBsToRamL DB not open (assuming drive is not present)");
       
   279                 continue;
       
   280                 }
   276             if ( iDatabaseHandles[i].iUseRAMdb )
   281             if ( iDatabaseHandles[i].iUseRAMdb )
   277                 {
   282                 {
   278                 // already used
   283                 // already used
   279                 MPX_DEBUG1("CMPXDbManager::CopyDBsToRamL iUseRAMdb already ETrue");
   284                 MPX_DEBUG1("CMPXDbManager::CopyDBsToRamL iUseRAMdb already ETrue");
   280                 continue;
   285                 continue;
   281                 }
   286                 }
   282             CloseDatabaseAtIndexL( i ); // let leave: not much we can't do if we can't close the original DB
   287             CloseDatabaseAtIndexL( i ); // let leave: not much we can do if we can't close the original DB
   283             DoCopyDBToRam( i, aIsMTPInUse ); // copies if it can
   288             DoCopyDBToRam( i, aIsMTPInUse ); // copies if it can
   284             TRAPD( err, OpenDatabaseAtIndexL( i ) );
   289             TRAPD( err, OpenDatabaseAtIndexL( i ) );
   285             if ( err != KErrNone )
   290             if ( err != KErrNone )
   286                 {
   291                 {
   287                 MPX_DEBUG2("CMPXDbManager::CopyDBsToRamL OpenDatabaseAtIndexL leave=%d", err);
   292                 MPX_DEBUG2("CMPXDbManager::CopyDBsToRamL OpenDatabaseAtIndexL leave=%d", err);
  2016         {
  2021         {
  2017         MPX_DEBUG1("invalid driveId, leave with KErrNotReady");
  2022         MPX_DEBUG1("invalid driveId, leave with KErrNotReady");
  2018         User::Leave(KErrNotReady);
  2023         User::Leave(KErrNotReady);
  2019         }
  2024         }
  2020     
  2025     
  2021 #ifndef __RAMDISK_PERF_ENABLE 
       
  2022     
       
  2023     EnsureDiskSpaceL(aDrive);
  2026     EnsureDiskSpaceL(aDrive);
  2024     
       
  2025 #endif //__RAMDISK_PERF_ENABLE
       
  2026 
       
  2027     }
  2027     }
  2028     
  2028     
  2029 // ----------------------------------------------------------------------------
  2029 // ----------------------------------------------------------------------------
  2030 // Regenerate all databases.
  2030 // Regenerate all databases.
  2031 // ----------------------------------------------------------------------------
  2031 // ----------------------------------------------------------------------------
  2861 
  2861 
  2862     // handle other drives (eg. removable EDriveE)
  2862     // handle other drives (eg. removable EDriveE)
  2863     TInt count(iDatabaseHandles.Count());
  2863     TInt count(iDatabaseHandles.Count());
  2864     for (TInt i = 0; i < count; ++i)
  2864     for (TInt i = 0; i < count; ++i)
  2865         {
  2865         {
       
  2866         DatabaseHandle& database = iDatabaseHandles[i];
  2866         if (((KDbManagerAllDrives == aDrive) ||
  2867         if (((KDbManagerAllDrives == aDrive) ||
  2867             (aDrive == iDatabaseHandles[i].iDrive)) &&
  2868             (aDrive == database.iDrive)) &&
  2868             iDatabaseHandles[i].iOpen)
  2869             database.iOpen
       
  2870 #ifdef __RAMDISK_PERF_ENABLE
       
  2871             && !database.iUseRAMdb
       
  2872 #endif
       
  2873             )
  2869             {
  2874             {
  2870             if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0,
  2875             if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0,
  2871                 iDatabaseHandles[i].iDrive))
  2876                 database.iDrive))
  2872                 {
  2877                 {
  2873                 MPX_DEBUG1("CMPXDbManager::EnsureDiskSpaceL Error diskspace full");
  2878                 MPX_DEBUG1("CMPXDbManager::EnsureDiskSpaceL Error diskspace full");
  2874                 User::Leave(KErrDiskFull);
  2879                 User::Leave(KErrDiskFull);
  2875                 }
  2880                 }
  2876             }
  2881             }
  2877 
  2882 
  2878         if (aDrive == iDatabaseHandles[i].iDrive)
  2883         if (aDrive == database.iDrive)
  2879             {
  2884             {
  2880             // exit if just one drive to check
  2885             // exit if just one drive to check
  2881             break;
  2886             break;
  2882             }
  2887             }
  2883         }
  2888         }