metadataengine/server/src/mdsmaintenanceengine.cpp
branchRCL_3
changeset 49 f23c07ec56e2
parent 47 b73252188534
child 50 85f623e1ef41
equal deleted inserted replaced
47:b73252188534 49:f23c07ec56e2
   118     __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 );
   118     __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 );
   119 	
   119 	
   120     TBool isValid(EFalse);
   120     TBool isValid(EFalse);
   121     TRAPD(err, isValid = iMaintenance->ValidateL( ));
   121     TRAPD(err, isValid = iMaintenance->ValidateL( ));
   122     
   122     
   123     if(err == KErrCorrupt)
   123     if( err == KErrCorrupt )
   124         {
   124         {
   125         DeleteDatabase();
   125         DeleteDatabase();
   126         User::Leave( err );
   126         User::Leave( err );
   127         }
   127         }
   128     
   128     
   172 				__LOG1( ELogAlways, "Schema reading error: %d", schemaError );
   172 				__LOG1( ELogAlways, "Schema reading error: %d", schemaError );
   173 				DeleteDatabase();
   173 				DeleteDatabase();
   174 				User::Leave( schemaError );
   174 				User::Leave( schemaError );
   175 				}
   175 				}
   176 			}
   176 			}
   177 
       
   178 		if ( FailedImports() != 0 )
       
   179   			{
       
   180 	       	User::Leave( KErrBadName );
       
   181        		}
       
   182 		
   177 		
   183 		// try to read default import file from C drive
   178 		// try to read default import file from C drive
   184        	TRAPD( err, ImportMetadataL( aManipulate, aSchema, KMdsDefaultImportFile ) );
   179        	TRAPD( err, ImportMetadataL( aManipulate, aSchema, KMdsDefaultImportFile ) );
   185        	if ( err == KErrNotFound || err == KErrPathNotFound )
   180        	if ( err == KErrNotFound || err == KErrPathNotFound )
   186        		{
   181        		{
   187        		// if default import file is not found, try to read from rom (Z) drive
   182        		// if default import file is not found, try to read from rom (Z) drive
   188        		// and ignore errors
   183        		// and ignore errors
   189        		TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) );
   184        		TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) );
   190        		}
   185        		}
       
   186 
       
   187 #ifdef _DEBUG
       
   188         if ( FailedImports() != 0 )
       
   189             {
       
   190             User::Leave( KErrBadName );
       
   191             }
       
   192 #endif
   191        	
   193        	
   192        	__LOG1( ELogAlways, "MDS DB tables created %d", 0 );
   194        	__LOG1( ELogAlways, "MDS DB tables created %d", 0 );
   193 
   195 
   194         // Revert back to default MDS server priority when server is up and running
   196         // Revert back to default MDS server priority when server is up and running
   195         process.SetPriority( EPriorityBackground );
   197         process.SetPriority( EPriorityBackground );
   204         if( err != KErrNone )
   206         if( err != KErrNone )
   205         	{ 
   207         	{ 
   206 			DeleteDatabase();
   208 			DeleteDatabase();
   207 			User::Leave( err );
   209 			User::Leave( err );
   208         	}
   210         	}
       
   211         
       
   212         if( !iMaintenance->CheckForCorruptionL() )
       
   213             {
       
   214             DeleteDatabase();
       
   215             User::Leave( KErrCorrupt );
       
   216             }
   209         }
   217         }
   210     __LOG1( ELogAlways, "CMdSMaintenanceEngine::InstallL complete: %d", 0 );
   218     __LOG1( ELogAlways, "CMdSMaintenanceEngine::InstallL complete: %d", 0 );
   211     }
   219     }
   212 
   220 
   213 // ------------------------------------------------
   221 // ------------------------------------------------