本文整理汇总了C++中CContactDatabase::DamageDatabaseL方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::DamageDatabaseL方法的具体用法?C++ CContactDatabase::DamageDatabaseL怎么用?C++ CContactDatabase::DamageDatabaseL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::DamageDatabaseL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructL
/**
* Creates a new, nondamaged DB.
*/
void CTestResources::ConstructL(TBool aDamaged)
{
if (aDamaged)
{
// Create an empty DB...
CContactDatabase* db = CContactDatabase::ReplaceL(KTestDbName);
CleanupStack::PushL(db);
// Damage the DB...
db->DamageDatabaseL(0x666);
// Close the DB.
CleanupStack::PopAndDestroy(db);
// Open the damaged database. CContactDatabase::OpenL() does recovery
// by calling RecoverL().
iDb = CContactDatabase::OpenL(KTestDbName);
}
else
{
// Just create an empty DB
iDb = CContactDatabase::ReplaceL(KTestDbName);
}
iViewEventQueue = CContactViewEventQueue::NewL();
iViewSortOrder.AppendL(KUidContactFieldFamilyName);
iViewSortOrder.AppendL(KUidContactFieldGivenName);
iViewSortOrder.AppendL(KUidContactFieldCompanyName);
iLocalView = CContactLocalView::NewL
(*iViewEventQueue, *iDb, iViewSortOrder, EContactsOnly);
}
示例2: ExportContactsL
void CTestContactsPBAPExport::ExportContactsL()
{
TInt err = KErrNone;
// Retrieve the file name to which contact item is to be exported
RFs fsSession;
RFileWriteStream writeStream;
// connect to file system
User::LeaveIfError(fsSession.Connect());
CleanupClosePushL(fsSession);
GetInputFromIni();
// Makes one or more directories.
fsSession.MkDirAll(iExportTo);
// Replaces a single file with another
User::LeaveIfError(writeStream.Replace(fsSession, iExportTo, EFileWrite));
INFO_PRINTF1(_L("Exporting Contact....."));
// Existing database
TPtrC databaseFile(_L("C:contactDb.cdb"));
CContactDatabase* dBase = NULL;
CContactIdArray* idArray = NULL;
// Open the existing database
dBase = CContactDatabase::OpenL(databaseFile);
CleanupStack::PushL(dBase);
// Create Utility class object, to export the contact from database
CTestStep* self = static_cast<CTestStep*>(this);
iExportObj = new(ELeave) CContactsPBAPExportUtilityClass(self);
SetFilterL();
CCntFilter* exportFilter = CCntFilter::NewL();
CleanupStack::PushL(exportFilter);
// Get all the contacts from the database to export
exportFilter->SetContactFilterTypeCard(ETrue);
dBase->FilterDatabaseL(*exportFilter);
idArray = exportFilter->iIds;
CleanupStack::PushL(idArray);
if(iDamageDb)
{
#ifdef _DEBUG
#ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__
TRAPD(err1,dBase->DamageDatabaseL(0x666));
if(err1 == KErrNone)
{
TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter));
INFO_PRINTF2(_L("Err:%d"),err);
if(err == KErrNotReady)
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
if(dBase->IsDamaged())
{
dBase->RecoverL();
}
}
else
{
INFO_PRINTF2(_L("Could not damage database Err:"),err1);
}
#else
SetTestStepResult(EPass);
#endif
#endif
}
else
{
if(iInvalidFileSystem)
{
#ifdef _DEBUG
fsSession.SetErrorCondition(KErrNotReady);
TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter));
if(err == KErrNotReady)
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
fsSession.SetErrorCondition(KErrNone);
#endif
}
else
{
if(!iSetOOM)
{
if(idArray->Count() > 0)
//.........这里部分代码省略.........