metadataengine/server/src/mdsserver.cpp
branchRCL_3
changeset 30 3e156c80c15d
parent 27 4a4892eec172
child 47 b73252188534
equal deleted inserted replaced
27:4a4892eec172 30:3e156c80c15d
   398     iSchema = CMdsSchema::NewL();
   398     iSchema = CMdsSchema::NewL();
   399 
   399 
   400     iManipulate = CMdSManipulationEngine::NewL( *iSchema, *iNotifier, 
   400     iManipulate = CMdSManipulationEngine::NewL( *iSchema, *iNotifier, 
   401         *iLockList );
   401         *iLockList );
   402 
   402 
   403     iMaintenance->InstallL( *iManipulate, *iSchema );
   403     // TRAP InstallL - first time for if there has been schema update, and 
       
   404     // the DB version is too old. Delete the DB and try to recreate it
       
   405     TRAPD( error, iMaintenance->InstallL( *iManipulate, *iSchema ) );
       
   406     if( error == KErrCorrupt )
       
   407         {
       
   408         delete iSchema;
       
   409         iSchema = NULL; // for CS
       
   410         iSchema = CMdsSchema::NewL();
       
   411         
       
   412         delete iManipulate;
       
   413         iManipulate = NULL; // for CS
       
   414         iManipulate = CMdSManipulationEngine::NewL( *iSchema, *iNotifier, 
       
   415             *iLockList );
       
   416     
       
   417         CMdSMaintenanceEngine::InitConnectionL();    
       
   418         // TRAP InstallL - second time for if the schema file in private not updated
       
   419         // during update, and the first attempt to recreate the DB fails. 
       
   420         // Then schema file in rom is used for final attempt to recreate the DB
       
   421         TRAP( error, iMaintenance->InstallL( *iManipulate, *iSchema ) );
       
   422         if( error == KErrCorrupt )
       
   423             {
       
   424             delete iSchema;
       
   425             iSchema = NULL; // for CS
       
   426             iSchema = CMdsSchema::NewL();
       
   427             
       
   428             delete iManipulate;
       
   429             iManipulate = NULL; // for CS
       
   430             iManipulate = CMdSManipulationEngine::NewL( *iSchema, *iNotifier, 
       
   431                 *iLockList );
       
   432         
       
   433             CMdSMaintenanceEngine::InitConnectionL();    
       
   434             // If the DB cannot be created from ANY available schema file, nothing can be 
       
   435             // can be done at this point, unfortunately
       
   436             iMaintenance->InstallL( *iManipulate, *iSchema );
       
   437             }
       
   438         }
       
   439     else if( error != KErrNone )
       
   440         {
       
   441         User::Leave( error );
       
   442         }
   404     }
   443     }
   405 
   444 
   406 void CMdSServer::DeInitializeL()
   445 void CMdSServer::DeInitializeL()
   407     {
   446     {
   408     if ( iMaintenance )
   447     if ( iMaintenance )