landmarks/locationlandmarks/localaccess/src/EPos_CPosLmLocalDatabase.cpp
changeset 18 3825cf2dc8c2
parent 0 667063e416a2
equal deleted inserted replaced
1:788b770ce3ae 18:3825cf2dc8c2
   319 // -----------------------------------------------------------------------------
   319 // -----------------------------------------------------------------------------
   320 // -----------------------------------------------------------------------------
   320 // -----------------------------------------------------------------------------
   321 //
   321 //
   322 EXPORT_C void CPosLmLocalDatabase::CommitServerTransactionLX()
   322 EXPORT_C void CPosLmLocalDatabase::CommitServerTransactionLX()
   323     {
   323     {
       
   324     //coverity[naming_error : FALSE]
   324     CommitServerTransactionL();
   325     CommitServerTransactionL();
   325     CleanupStack::Pop(); // rollback
   326     CleanupStack::Pop(); // rollback
   326     }
   327     }
   327 
   328 
   328 // -----------------------------------------------------------------------------
   329 // -----------------------------------------------------------------------------
   714     else
   715     else
   715         {
   716         {
   716         TInt err = iDbAccess->OpenDatabaseL(*iDbUri);
   717         TInt err = iDbAccess->OpenDatabaseL(*iDbUri);
   717         if (err != KErrNone)
   718         if (err != KErrNone)
   718             {
   719             {
   719             // Re-create database if below error codes
   720             // As this is a default landmarks db, all errors other than OutOfMemory 
   720             if (err == KErrCorrupt || err == KErrNotSupported)
   721             // should be handled by replacing a corrupt db or creating a new db if one is missing. 
       
   722             if (err == KErrNoMemory)
   721                 {
   723                 {
   722                 iSubSession->CreateDefaultDbL(*iDbUri, ETrue);
   724                 User::Leave(err);
   723                 }
   725                 }
   724             else
   726             else
   725                 {
   727                 {
   726                 iSubSession->CreateDefaultDbL(*iDbUri, EFalse);
   728                 if ((err == KErrNotFound) || (err == KErrPathNotFound)
       
   729                         || (err == KErrArgument) || (err == KErrAlreadyExists))
       
   730                     {
       
   731                     // Create a new database [default landmarks db]     
       
   732                     iSubSession->CreateDefaultDbL(*iDbUri, EFalse);
       
   733                     }
       
   734                 else
       
   735                     {
       
   736                     // Try deleting the corrupted database and then create a new one                
       
   737                     iSubSession->CreateDefaultDbL(*iDbUri, ETrue);
       
   738                     }
       
   739                 *DatabaseAccess()->InitFlagPtr() = ECreated;
       
   740                 User::LeaveIfError(iDbAccess->OpenDatabaseL(*iDbUri));
   727                 }
   741                 }
   728             *DatabaseAccess()->InitFlagPtr() = ECreated;
       
   729             User::LeaveIfError(iDbAccess->OpenDatabaseL(*iDbUri));
       
   730             }
   742             }
   731         }
   743         }
   732     CleanupStack::PopAndDestroy(); // DbLock
   744     CleanupStack::PopAndDestroy(); // DbLock
   733     }
   745     }
   734 
   746