phonebookengines/contactsmodel/cntplsql/src/cplcollectioniterator.cpp
branchRCL_3
changeset 6 e8e3147d53eb
parent 0 e686773b3f54
child 8 5586b4d2ec3e
equal deleted inserted replaced
5:81f8547efd4f 6:e8e3147d53eb
    61 	EFindFirstNamePronunciation,
    61 	EFindFirstNamePronunciation,
    62 	EFindLastNamePronunciation,
    62 	EFindLastNamePronunciation,
    63 	EFindCompanyNamePronunciation
    63 	EFindCompanyNamePronunciation
    64 	};
    64 	};
    65 
    65 
    66 // Collation level that ignore accents (i.e. 'a' == 'ä').
    66 // Collation level that ignore accents (i.e. 'a' == '?).
    67 const TInt KCollationLevel= 0;
    67 const TInt KCollationLevel= 0;
    68 
    68 
    69 //
    69 //
    70 // The TKeyCmpTextLength class is duplicated in ccontactprivate.cpp.  It should
    70 // The TKeyCmpTextLength class is duplicated in ccontactprivate.cpp.  It should
    71 // be refactored into shared code/library if possible.
    71 // be refactored into shared code/library if possible.
   417 
   417 
   418 @param aContactsFile Contacts file object from the Persistence Layer.
   418 @param aContactsFile Contacts file object from the Persistence Layer.
   419 */
   419 */
   420 CPlCollection::CPlCollection(CPplContactsFile& aContactsFile)
   420 CPlCollection::CPlCollection(CPplContactsFile& aContactsFile)
   421 	: 
   421 	: 
   422 	iContactsFile(aContactsFile)
   422 	iContactsFile( aContactsFile ), iRSqlstatementsWorking( EFalse )
   423 	{
   423 	{
   424 	}
   424 	}
   425 	
   425 	
   426 /**
   426 /**
   427 CPlCollection ConstructL
   427 CPlCollection ConstructL
  1247 method followed by one or more calls to the FindAsyncL() method.  The class
  1247 method followed by one or more calls to the FindAsyncL() method.  The class
  1248 needs to be reset to a known state when a find is completed.
  1248 needs to be reset to a known state when a find is completed.
  1249 */
  1249 */
  1250 void CPlCollection::Reset()
  1250 void CPlCollection::Reset()
  1251 	{
  1251 	{
       
  1252 	if ( !iRSqlstatementsWorking )
       
  1253         {
       
  1254         //If RSqlstatements was reseted, don't reset it again.
       
  1255         return;
       
  1256         }
  1252 	// Could introduce methods specific to the find operation such that this
  1257 	// Could introduce methods specific to the find operation such that this
  1253 	// method is called only if an asynchronous find has taken place. 
  1258 	// method is called only if an asynchronous find has taken place. 
  1254 	delete iFieldDef;
  1259 	delete iFieldDef;
  1255 	iFieldDef = NULL;
  1260 	iFieldDef = NULL;
  1256 	delete iTextDef;
  1261 	delete iTextDef;
  1270 	selectBlobStatement.Close();
  1275 	selectBlobStatement.Close();
  1271 	selectIdentityStatement.Close();
  1276 	selectIdentityStatement.Close();
  1272 	selectEmailStatement.Close();
  1277 	selectEmailStatement.Close();
  1273 	selectSIPStatement.Close();
  1278 	selectSIPStatement.Close();
  1274 	selectIdFromIdentityStatement.Close();
  1279 	selectIdFromIdentityStatement.Close();
       
  1280 	iRSqlstatementsWorking = EFalse;
  1275 	}
  1281 	}
  1276 
  1282 
  1277 
  1283 
  1278 /**
  1284 /**
  1279 Initialise the Persistence Layer collection class ready for iterative calls to
  1285 Initialise the Persistence Layer collection class ready for iterative calls to
  1289 	{
  1295 	{
  1290 	_LIT(KWhereEmailSIPClause, "(%S = %d) AND (%S LIKE '%S')");
  1296 	_LIT(KWhereEmailSIPClause, "(%S = %d) AND (%S LIKE '%S')");
  1291 	// Persistence Layer CPlCollection is not deleted but Reset()'s the member
  1297 	// Persistence Layer CPlCollection is not deleted but Reset()'s the member
  1292 	// variables for iterative FindAsyncL() calls.
  1298 	// variables for iterative FindAsyncL() calls.
  1293 	Reset();
  1299 	Reset();
       
  1300 	iRSqlstatementsWorking = ETrue;
  1294 	iText = CreateFindTextL(aText);
  1301 	iText = CreateFindTextL(aText);
  1295 	iFieldDef = aFieldDef;
  1302 	iFieldDef = aFieldDef;
  1296 	iOriginalText = aText.AllocL();
  1303 	iOriginalText = aText.AllocL();
  1297 	ConstructBitwiseFindFlags(iFindFlags,iNoIdentitySearchColumns,iFieldDef);
  1304 	ConstructBitwiseFindFlags(iFindFlags,iNoIdentitySearchColumns,iFieldDef);
  1298 	// Construct RSqlStatements used for search
  1305 	// Construct RSqlStatements used for search
  1428 void CPlCollection::FindAsyncTextDefInitL(const CDesCArray& aWords,CContactTextDef* aTextDef)
  1435 void CPlCollection::FindAsyncTextDefInitL(const CDesCArray& aWords,CContactTextDef* aTextDef)
  1429 	{
  1436 	{
  1430 	// Persistence Layer CPlCollection is not deleted but Reset()'s the member
  1437 	// Persistence Layer CPlCollection is not deleted but Reset()'s the member
  1431 	// variables for iterative FindAsyncL() calls.
  1438 	// variables for iterative FindAsyncL() calls.
  1432 	Reset();
  1439 	Reset();
  1433 
  1440     iRSqlstatementsWorking = ETrue;
  1434 	iFindWords = new(ELeave) CDesCArrayFlat(5);
  1441 	iFindWords = new(ELeave) CDesCArrayFlat(5);
  1435 	iFindWords2 = new(ELeave) CDesCArrayFlat(5);
  1442 	iFindWords2 = new(ELeave) CDesCArrayFlat(5);
  1436 	for(TInt loop = 0;loop < aWords.MdcaCount();++loop)
  1443 	for(TInt loop = 0;loop < aWords.MdcaCount();++loop)
  1437 		{
  1444 		{
  1438 		// Construct iFindWords2 which contains all the strings in the search
  1445 		// Construct iFindWords2 which contains all the strings in the search