persistentstorage/sql/SRC/Server/SqlBur.cpp
changeset 55 44f437012c90
parent 51 7d4490026038
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
   104 	SetActive();
   104 	SetActive();
   105 	}
   105 	}
   106 
   106 
   107 /** 
   107 /** 
   108 RunL() is called when the value of the {KUidSystemCategory, KUidBackupRestoreKey} gets changed.
   108 RunL() is called when the value of the {KUidSystemCategory, KUidBackupRestoreKey} gets changed.
   109 That indicates: a backup or a restore is about to begin.
   109 That indicates: a backup or a restore is about to begin or about to end.
   110 
   110 
   111 How the function works:
   111 How the function works:
   112  - When a backup or restore notification is received, the function will subscribe again for notifications from
   112  - When a backup or restore notification is received, the function will subscribe again for notifications from
   113    the backup and restore property and will read the property status;
   113    the backup and restore property and will read the property status;
   114  - If the property status is conn::EBURUnset or conn::EBURNormal, the function will destroy iSqlBurCallback
   114  - If the property status is conn::EBURUnset or conn::EBURNormal, the function will destroy iSqlBurCallback
   249 	delete iSqlBurCallback;
   249 	delete iSqlBurCallback;
   250 	iSqlBurCallback = NULL;
   250 	iSqlBurCallback = NULL;
   251 	}
   251 	}
   252 
   252 
   253 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   253 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   254 ///////////////////////////////   CSqlBackupClient    /////////////////////////////////////////////////////////////
   254 ///////////////////////////////   CSqlBurCallback    //////////////////////////////////////////////////////////////
   255 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   255 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   256 
   256 
   257 
   257 
   258 /** 
   258 /** 
   259 Creates new CSqlBurCallback instance.
   259 Creates new CSqlBurCallback instance.
   466 					KSqlBurMagicNum,			// %8x
   466 					KSqlBurMagicNum,			// %8x
   467 					KSqlBurHeaderVersion,		// %4x
   467 					KSqlBurHeaderVersion,		// %4x
   468 					fileSize,					// %16lx
   468 					fileSize,					// %16lx
   469 					fname.Length(),				// %8x
   469 					fname.Length(),				// %8x
   470 					&fname);					// %S
   470 					&fname);					// %S
   471 				SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL5, "0x%X;CSqlBackupClient::GetBackupDataSectionL;fileName=%S;hdrPtr=|%S|;fileSize=%lld", (TUint)this, __SQLPRNSTR(fname), __SQLPRNSTR(iBuffer), fileSize));
   471 				SQL_TRACE_BUR(OstTraceExt4(TRACE_INTERNALS, CSQLBACKUPCLIENT_GETBACKUPDATASECTIONL5, "0x%X;CSqlBurCallback::GetBackupDataSectionL;fileName=%S;hdrPtr=|%S|;fileSize=%lld", (TUint)this, __SQLPRNSTR(fname), __SQLPRNSTR(iBuffer), fileSize));
   472 				
   472 				
   473 				// we need it to look like an 8bit buffer
   473 				// we need it to look like an 8bit buffer
   474 				TPtr8 hdrPtr8((TUint8*)iBuffer.Ptr(), iBuffer.Size(), iBuffer.Size());
   474 				TPtr8 hdrPtr8((TUint8*)iBuffer.Ptr(), iBuffer.Size(), iBuffer.Size());
   475 							
   475 							
   476 				TInt len = Min(hdrPtr8.Size(), bufFreeSpace);
   476 				TInt len = Min(hdrPtr8.Size(), bufFreeSpace);
   836 				TBuf<KMaxUidName + sizeof(KSqlBurAllFiles)> fileNameMask(uidName);
   836 				TBuf<KMaxUidName + sizeof(KSqlBurAllFiles)> fileNameMask(uidName);
   837 				fileNameMask.Append(KSqlBurAllFiles);
   837 				fileNameMask.Append(KSqlBurAllFiles);
   838 				__SQLLEAVE_IF_ERROR(iParse.Set(fileNameMask, &iRestoreDir, 0));
   838 				__SQLLEAVE_IF_ERROR(iParse.Set(fileNameMask, &iRestoreDir, 0));
   839 				CDir* dir = NULL;
   839 				CDir* dir = NULL;
   840 				TPtrC searchPattern(iParse.FullName());
   840 				TPtrC searchPattern(iParse.FullName());
   841 				SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL55, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;search pattern=%S", (TUint)this, __SQLPRNSTR(searchPattern)));
   841 				SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL5A, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;search pattern=%S", (TUint)this, __SQLPRNSTR(searchPattern)));
   842 				restoreErr = iInterface.Fs().GetDir(searchPattern, KEntryAttNormal, ESortNone, dir);
   842 				restoreErr = iInterface.Fs().GetDir(searchPattern, KEntryAttNormal, ESortNone, dir);
   843 				if(restoreErr == KErrNone)
   843 				if(restoreErr == KErrNone)
   844 					{
   844 					{
   845 					SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL6, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;restored files=%d", (TUint)this, dir->Count()));
   845 					SQL_TRACE_BUR(OstTraceExt2(TRACE_INTERNALS, CSQLBACKUPCLIENT_RESTOREBASEDATASECTONL6, "0x%X;CSqlBurCallback::RestoreBaseDataSectionL;restored files=%d", (TUint)this, dir->Count()));
   846 					for(TInt i=0;i<dir->Count();++i)
   846 					for(TInt i=0;i<dir->Count();++i)