56 * @return None. |
56 * @return None. |
57 * Destructor |
57 * Destructor |
58 */ |
58 */ |
59 CMSvSearchSortCacheManager::~CMSvSearchSortCacheManager() |
59 CMSvSearchSortCacheManager::~CMSvSearchSortCacheManager() |
60 { |
60 { |
|
61 iOutstandingSOSOperations = 0; |
61 iMsvIdWithSortFieldArray.Close(); |
62 iMsvIdWithSortFieldArray.Close(); |
62 iToFindResultAsIdArray.Close(); |
63 iToFindResultAsIdArray.Close(); |
63 iFinalResultAsIdArray.Close(); |
64 iFinalResultAsIdArray.Close(); |
64 iUpdateIdsToCacheArray.Close(); |
65 iUpdateIdsToCacheArray.Close(); |
65 iDeltaCacheIdArray.Close(); |
66 iDeltaCacheIdArray.Close(); |
142 void CMSvSearchSortCacheManager::ConstructL() |
143 void CMSvSearchSortCacheManager::ConstructL() |
143 { |
144 { |
144 iProgress = KMsvSearchSortOpNone; |
145 iProgress = KMsvSearchSortOpNone; |
145 iCancelFlag = EFalse; |
146 iCancelFlag = EFalse; |
146 iExplicitSortOnDateTime = EFalse; |
147 iExplicitSortOnDateTime = EFalse; |
|
148 |
|
149 //For Simultaneously query |
|
150 iOutstandingSOSOperations = 0; |
|
151 |
147 if(CMsvEntryFreePool::Instance()->iMsvMaximumCacheSize != NULL && CMsvEntryFreePool::Instance()->iMsvSearchSortCache) |
152 if(CMsvEntryFreePool::Instance()->iMsvMaximumCacheSize != NULL && CMsvEntryFreePool::Instance()->iMsvSearchSortCache) |
148 { |
153 { |
149 iMsvMaximumSearchSortCacheSize = ((CMsvEntryFreePool::Instance()->iMsvMaximumCacheSize * CMsvEntryFreePool::Instance()->iMsvSearchSortCache)/100)*1024 ; |
154 iMsvMaximumSearchSortCacheSize = ((CMsvEntryFreePool::Instance()->iMsvMaximumCacheSize * CMsvEntryFreePool::Instance()->iMsvSearchSortCache)/100)*1024 ; |
150 } |
155 } |
151 else |
156 else |
910 if(EIndexQuery == IsTypeOfQuery(aEntry)) |
915 if(EIndexQuery == IsTypeOfQuery(aEntry)) |
911 { |
916 { |
912 FinalResultAsIdL(aEntry); |
917 FinalResultAsIdL(aEntry); |
913 iReturnResultType = KFinalResult; |
918 iReturnResultType = KFinalResult; |
914 iProgress = KMsvSearchSortOpCompleted; |
919 iProgress = KMsvSearchSortOpCompleted; |
|
920 if(iOutstandingSOSOperations>0) |
|
921 { |
|
922 iOutstandingSOSOperations--; |
|
923 } |
915 } |
924 } |
916 else |
925 else |
917 { |
926 { |
918 FindResultAsIdL(aEntry); |
927 FindResultAsIdL(aEntry); |
919 iReturnResultType = KNewQuery; |
928 iReturnResultType = KNewQuery; |
935 #else |
944 #else |
936 if(EIndexQuery == IsTypeOfQuery(aEntry)) |
945 if(EIndexQuery == IsTypeOfQuery(aEntry)) |
937 { |
946 { |
938 FirstResultForInteraratorNewQueryL(aEntry); |
947 FirstResultForInteraratorNewQueryL(aEntry); |
939 iReturnResultType = KFinalResult; |
948 iReturnResultType = KFinalResult; |
|
949 if(iOutstandingSOSOperations>0) |
|
950 { |
|
951 iOutstandingSOSOperations--; |
|
952 } |
940 } |
953 } |
941 #endif |
954 #endif |
942 else |
955 else |
943 { |
956 { |
944 return KErrNotSupported; |
957 return KErrNotSupported; |
984 #endif |
997 #endif |
985 { |
998 { |
986 OnDemandUpdateCacheEntryL(aIndex); |
999 OnDemandUpdateCacheEntryL(aIndex); |
987 iReturnResultType = KFinalResult; |
1000 iReturnResultType = KFinalResult; |
988 iProgress = KMsvSearchSortOpCompleted; |
1001 iProgress = KMsvSearchSortOpCompleted; |
|
1002 if(iOutstandingSOSOperations>0) |
|
1003 { |
|
1004 iOutstandingSOSOperations--; |
|
1005 } |
989 } |
1006 } |
990 else |
1007 else |
991 { |
1008 { |
992 OnDemandUpdateCacheEntryL(aIndex); |
1009 OnDemandUpdateCacheEntryL(aIndex); |
993 if(!iSearchSortDeltaCache->iDeltaCacheDirtyFlag) |
1010 if(!iSearchSortDeltaCache->iDeltaCacheDirtyFlag) |
994 { |
1011 { |
995 iReturnResultType = KFinalResult; |
1012 iReturnResultType = KFinalResult; |
996 iProgress = KMsvSearchSortOpCompleted; |
1013 iProgress = KMsvSearchSortOpCompleted; |
|
1014 if(iOutstandingSOSOperations>0) |
|
1015 { |
|
1016 iOutstandingSOSOperations--; |
|
1017 } |
997 } |
1018 } |
998 else |
1019 else |
999 { |
1020 { |
1000 for(TInt ii =0; ii<iSearchSortDeltaCache->iNewEntry.Count(); ii++ ) |
1021 for(TInt ii =0; ii<iSearchSortDeltaCache->iNewEntry.Count(); ii++ ) |
1001 { |
1022 { |
1342 |
1367 |
1343 iMsvSearchSortCacheManager->iFinalResultAsIdArray.Reset(); |
1368 iMsvSearchSortCacheManager->iFinalResultAsIdArray.Reset(); |
1344 iSearchDbAdapter->GetSortedTMsvIdsfromTableL((*iManagerEntry)[aIndex-1]->iQueryID,iMsvSearchSortCacheManager->iFinalResultAsIdArray, (*iManagerEntry)[aIndex-1]->IsAscendingSort()/*Default = EFalse*/,(*iManagerEntry)[aIndex-1]->iMsgExplicitSortPart); |
1369 iSearchDbAdapter->GetSortedTMsvIdsfromTableL((*iManagerEntry)[aIndex-1]->iQueryID,iMsvSearchSortCacheManager->iFinalResultAsIdArray, (*iManagerEntry)[aIndex-1]->IsAscendingSort()/*Default = EFalse*/,(*iManagerEntry)[aIndex-1]->iMsgExplicitSortPart); |
1345 iReturnResultType = KFinalResult; |
1370 iReturnResultType = KFinalResult; |
1346 iProgress = KMsvSearchSortOpCompleted; |
1371 iProgress = KMsvSearchSortOpCompleted; |
|
1372 if(iOutstandingSOSOperations>0) |
|
1373 { |
|
1374 iOutstandingSOSOperations--; |
|
1375 } |
1347 aToUpdateDb.Reset(); |
1376 aToUpdateDb.Reset(); |
1348 } |
1377 } |
1349 |
1378 |
1350 |
1379 |
1351 /** |
1380 /** |
1363 iSearchDbAdapter->GetSortedTMsvIdsfromTableL((*iManagerEntry)[aIndex-1]->iQueryID,iMsvSearchSortCacheManager->iFinalResultAsIdArray, (*iManagerEntry)[aIndex-1]->IsAscendingSort(),(*iManagerEntry)[aIndex-1]->iMsgExplicitSortPart); |
1392 iSearchDbAdapter->GetSortedTMsvIdsfromTableL((*iManagerEntry)[aIndex-1]->iQueryID,iMsvSearchSortCacheManager->iFinalResultAsIdArray, (*iManagerEntry)[aIndex-1]->IsAscendingSort(),(*iManagerEntry)[aIndex-1]->iMsgExplicitSortPart); |
1364 iReturnResultType = KFinalResult; |
1393 iReturnResultType = KFinalResult; |
1365 iProgress = KMsvSearchSortOpCompleted; |
1394 iProgress = KMsvSearchSortOpCompleted; |
1366 } |
1395 } |
1367 iMsvSearchSortCacheManager->iMsvIdWithSortFieldArray.Reset(); |
1396 iMsvSearchSortCacheManager->iMsvIdWithSortFieldArray.Reset(); |
|
1397 if(iOutstandingSOSOperations>0) |
|
1398 { |
|
1399 iOutstandingSOSOperations--; |
|
1400 } |
1368 return iReturnResultType; |
1401 return iReturnResultType; |
1369 } |
1402 } |
1370 |
1403 |
1371 |
1404 |
1372 /** |
1405 /** |
1401 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry, aEntry.iSortOnHeader, IsTypeOfQuery(aEntry), iReturnResultType); |
1434 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry, aEntry.iSortOnHeader, IsTypeOfQuery(aEntry), iReturnResultType); |
1402 #else |
1435 #else |
1403 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry); |
1436 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry); |
1404 #endif |
1437 #endif |
1405 iProgress = KMsvSearchSortOpCompleted; |
1438 iProgress = KMsvSearchSortOpCompleted; |
|
1439 if(iOutstandingSOSOperations>0) |
|
1440 { |
|
1441 iOutstandingSOSOperations--; |
|
1442 } |
1406 } |
1443 } |
1407 else |
1444 else |
1408 { |
1445 { |
1409 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
1446 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
1410 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry, aEntry.iSortOnHeader, IsTypeOfQuery(aEntry), iReturnResultType); |
1447 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry, aEntry.iSortOnHeader, IsTypeOfQuery(aEntry), iReturnResultType); |
1411 #else |
1448 #else |
1412 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry); |
1449 iSearchDbAdapter->GetIdsInIteratorNewQueryL(aEntry); |
1413 #endif |
1450 #endif |
1414 iProgress = KMsvSearchSortOpCompleted; |
1451 iProgress = KMsvSearchSortOpCompleted; |
|
1452 if(iOutstandingSOSOperations>0) |
|
1453 { |
|
1454 iOutstandingSOSOperations--; |
|
1455 } |
1415 } |
1456 } |
1416 } |
1457 } |
1417 |
1458 |
1418 |
1459 |
1419 /** |
1460 /** |
1431 if((*iManagerEntry)[index]->iResultType == EMsvResultAsTMsvId) |
1472 if((*iManagerEntry)[index]->iResultType == EMsvResultAsTMsvId) |
1432 { |
1473 { |
1433 //iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID); |
1474 //iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID); |
1434 iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID, (*iManagerEntry)[index]->IsAscendingSort(), (*iManagerEntry)[index]->iMsgExplicitSortPart); |
1475 iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID, (*iManagerEntry)[index]->IsAscendingSort(), (*iManagerEntry)[index]->iMsgExplicitSortPart); |
1435 iProgress = KMsvSearchSortOpCompleted; |
1476 iProgress = KMsvSearchSortOpCompleted; |
1436 } |
1477 if(iOutstandingSOSOperations>0) |
|
1478 { |
|
1479 iOutstandingSOSOperations--; |
|
1480 } |
|
1481 } |
1437 else |
1482 else |
1438 { |
1483 { |
1439 //iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID); |
1484 //iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID); |
1440 iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID, (*iManagerEntry)[index]->IsAscendingSort(), (*iManagerEntry)[index]->iMsgExplicitSortPart); |
1485 iSearchDbAdapter->GetIdsInIteratorQueryIdL((*iManagerEntry)[index]->iQueryID, (*iManagerEntry)[index]->IsAscendingSort(), (*iManagerEntry)[index]->iMsgExplicitSortPart); |
1441 iProgress = KMsvSearchSortOpCompleted; |
1486 iProgress = KMsvSearchSortOpCompleted; |
|
1487 if(iOutstandingSOSOperations>0) |
|
1488 { |
|
1489 iOutstandingSOSOperations--; |
|
1490 } |
1442 } |
1491 } |
1443 } |
1492 } |
1444 |
1493 |
1445 /** |
1494 /** |
1446 * GetNextForInteraratorL() : |
1495 * GetNextForInteraratorL() : |
1457 if((*iManagerEntry)[aIndex]->iResultType == EMsvResultAsTMsvId) |
1506 if((*iManagerEntry)[aIndex]->iResultType == EMsvResultAsTMsvId) |
1458 { |
1507 { |
1459 //iSearchDbAdapter->GetNextIdL( (*iManagerEntry)[aIndex]->iQueryID , iIteratorId,iIteratorRemainingResultCount); |
1508 //iSearchDbAdapter->GetNextIdL( (*iManagerEntry)[aIndex]->iQueryID , iIteratorId,iIteratorRemainingResultCount); |
1460 iSearchDbAdapter->GetNextIdL(iIteratorId,iIteratorRemainingResultCount); |
1509 iSearchDbAdapter->GetNextIdL(iIteratorId,iIteratorRemainingResultCount); |
1461 iProgress = KMsvSearchSortOpCompleted; |
1510 iProgress = KMsvSearchSortOpCompleted; |
|
1511 if(iIteratorRemainingResultCount == 0) |
|
1512 { |
|
1513 if(iOutstandingSOSOperations>0) |
|
1514 { |
|
1515 iOutstandingSOSOperations--; |
|
1516 } |
|
1517 } |
1462 } |
1518 } |
1463 else |
1519 else |
1464 { |
1520 { |
1465 //iIteratorEntry |
1521 //iIteratorEntry |
1466 //iSearchDbAdapter->GetNextIdL((*iManagerEntry)[aIndex]->iQueryID , iIteratorId,iIteratorRemainingResultCount); |
1522 //iSearchDbAdapter->GetNextIdL((*iManagerEntry)[aIndex]->iQueryID , iIteratorId,iIteratorRemainingResultCount); |
1467 iSearchDbAdapter->GetNextIdL(iIteratorId,iIteratorRemainingResultCount); |
1523 iSearchDbAdapter->GetNextIdL(iIteratorId,iIteratorRemainingResultCount); |
1468 TMsvEntry *entry; |
1524 TMsvEntry *entry; |
1469 iServer.IndexAdapter().GetEntry(iIteratorId,entry); |
1525 iServer.IndexAdapter().GetEntry(iIteratorId,entry); |
1470 iIteratorEntry = *entry; |
1526 iIteratorEntry = *entry; |
1471 iProgress = KMsvSearchSortOpCompleted; |
1527 iProgress = KMsvSearchSortOpCompleted; |
|
1528 if(iIteratorRemainingResultCount == 0) |
|
1529 { |
|
1530 if(iOutstandingSOSOperations>0) |
|
1531 { |
|
1532 iOutstandingSOSOperations--; |
|
1533 } |
|
1534 } |
1472 } |
1535 } |
1473 } |
1536 } |
1474 |
1537 |
1475 |
1538 |
1476 /** |
1539 /** |