mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp
changeset 41 ea59c434026a
parent 29 8192e5b5c935
child 38 b93f525c9244
--- a/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp	Fri Jun 11 13:36:36 2010 +0300
+++ b/mpserviceplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp	Wed Jun 23 18:10:13 2010 +0300
@@ -273,13 +273,18 @@
         TInt count(iDatabaseHandles.Count());
         for ( TInt i = 0; i < count ; ++i )
             {
+            if ( ! iDatabaseHandles[i].iOpen )
+                {
+                MPX_DEBUG1("CMPXDbManager::CopyDBsToRamL DB not open (assuming drive is not present)");
+                continue;
+                }
             if ( iDatabaseHandles[i].iUseRAMdb )
                 {
                 // already used
                 MPX_DEBUG1("CMPXDbManager::CopyDBsToRamL iUseRAMdb already ETrue");
                 continue;
                 }
-            CloseDatabaseAtIndexL( i ); // let leave: not much we can't do if we can't close the original DB
+            CloseDatabaseAtIndexL( i ); // let leave: not much we can do if we can't close the original DB
             DoCopyDBToRam( i, aIsMTPInUse ); // copies if it can
             TRAPD( err, OpenDatabaseAtIndexL( i ) );
             if ( err != KErrNone )
@@ -2018,12 +2023,7 @@
         User::Leave(KErrNotReady);
         }
     
-#ifndef __RAMDISK_PERF_ENABLE 
-    
     EnsureDiskSpaceL(aDrive);
-    
-#endif //__RAMDISK_PERF_ENABLE
-
     }
     
 // ----------------------------------------------------------------------------
@@ -2863,19 +2863,24 @@
     TInt count(iDatabaseHandles.Count());
     for (TInt i = 0; i < count; ++i)
         {
+        DatabaseHandle& database = iDatabaseHandles[i];
         if (((KDbManagerAllDrives == aDrive) ||
-            (aDrive == iDatabaseHandles[i].iDrive)) &&
-            iDatabaseHandles[i].iOpen)
+            (aDrive == database.iDrive)) &&
+            database.iOpen
+#ifdef __RAMDISK_PERF_ENABLE
+            && !database.iUseRAMdb
+#endif
+            )
             {
             if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0,
-                iDatabaseHandles[i].iDrive))
+                database.iDrive))
                 {
                 MPX_DEBUG1("CMPXDbManager::EnsureDiskSpaceL Error diskspace full");
                 User::Leave(KErrDiskFull);
                 }
             }
 
-        if (aDrive == iDatabaseHandles[i].iDrive)
+        if (aDrive == database.iDrive)
             {
             // exit if just one drive to check
             break;