//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::HomePhoneL()
	{
	CContentType* contentType=CContentType::NewL();
	CleanupStack::PushL(contentType);
	contentType->AddFieldTypeL(KUidContactFieldPhoneNumber);
	contentType->AddFieldTypeL(KUidContactFieldVCardMapHOME);
	contentType->AddFieldTypeL(KUidContactFieldVCardMapVOICE);
	const TPtrC text=TextFieldL(*contentType);
	CleanupStack::PopAndDestroy(); // contentType.
	return text;
	}
/**
Create view contact object based on given sql statement.

@return CViewContact object or NULL the contact is not found.
*/
CViewContact* CCntPplViewSession::CreateViewItemL(RSqlStatement& aSqlStmt, const CCntSqlStatement& aCntSqlStmt, const TContactViewPreferences& aViewPrefs)
	{
	if (! iContactsFile.IsOpened())
		{
		User::Leave(KErrInUse);
		}
	
	CViewContact* viewContact = InitialiseViewItemL(aSqlStmt, aCntSqlStmt, aViewPrefs);
	if(!viewContact)
		{
		//Couldn't find the contact.
		return NULL;
		}
	
	CleanupStack::PushL(viewContact);
	if(viewContact->ContactType() == CViewContact::EContactItem)
		{
		FillViewItemL(*viewContact, aSqlStmt, aViewPrefs);
		}
	
	TUid typeUid = GetContactFieldMatchUid(*viewContact, aViewPrefs);	
	if(typeUid != KUidContactFieldNone)
		{
		RSqlStatement contactSqlStmt;
		CleanupClosePushL(contactSqlStmt);
		
		/* we have to reload the row from SQL database to cache in text header and text blob */ 	
		contactSqlStmt.PrepareL(iContactsFile.NamedDatabase(),  iSqlSmtSelectAllFieldsById.SqlStringL());
		User::LeaveIfError(contactSqlStmt.BindInt(KFirstIndex, viewContact->Id())); //Bind item id into the condition.	
		
		TInt err = contactSqlStmt.Next();
		if(err == KSqlAtEnd)
			{
			//Should never be here, we found it in InitialiseViewItemL 
			//but couldn't find the same contact in same database.
			CleanupStack::PopAndDestroy(viewContact);
			return NULL;
			}			
			
		User::LeaveIfError(err);
		
		/* set first field with possible content for group or unsorted contact */	
		CContactDatabase::TTextFieldMinimal buf;
		TextFieldL(contactSqlStmt, iSqlSmtSelectAllFieldsById, iContactProperties.SystemTemplateL(), typeUid, buf);
		viewContact->SetFirstFieldForBlankContactL(buf);
		CleanupStack::PopAndDestroy(&contactSqlStmt);
		} //if(typeUid != 0)
	
	CleanupStack::Pop(viewContact);
	return viewContact;
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::NotesL()
	{
	return TextFieldL(KUidContactFieldNote);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::CountryL()
	{
	return TextFieldL(KUidContactFieldCountry);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::PostCodeL()
	{
	return TextFieldL(KUidContactFieldPostcode);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::CountyL()
	{
	return TextFieldL(KUidContactFieldRegion);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::TownL()
	{
	return TextFieldL(KUidContactFieldLocality);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::StreetL()
	{
	return TextFieldL(KUidContactFieldAddress);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::InternetAddressL()
	{
	return TextFieldL(KUidContactFieldUrl);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::EmailAddressL()
	{
	return TextFieldL(KUidContactFieldEMail);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::FaxL()
	{
	return TextFieldL(KUidContactFieldFax);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::JobTitleL()
	{
	return TextFieldL(KUidContactFieldJobTitle);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::CompanyNameL()
	{
	return TextFieldL(KUidContactFieldCompanyName);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::LastNameL()
	{
	return TextFieldL(KUidContactFieldFamilyName);
	}
//------------------------------------------------------------------------------------------------------------	
const TPtrC CPerfTestContact::FirstNameL()
	{
	return TextFieldL(KUidContactFieldGivenName);
	}