emailservices/emailstore/message_store/server/src/ContainerStore.cpp
changeset 59 16ed8d08d0b1
parent 0 8466d47a6819
child 68 83cc6bae1de8
equal deleted inserted replaced
54:997a02608b3a 59:16ed8d08d0b1
  1733 // ==========================================================================
  1733 // ==========================================================================
  1734 // FUNCTION: FirstChildL
  1734 // FUNCTION: FirstChildL
  1735 // ==========================================================================
  1735 // ==========================================================================
  1736 void CContainerStore::FirstChildL( TContainerId aId, TContainerId& aFirstChildId, TDbBookmark& aBookmark )
  1736 void CContainerStore::FirstChildL( TContainerId aId, TContainerId& aFirstChildId, TDbBookmark& aBookmark )
  1737     {
  1737     {
  1738     aFirstChildId = FirstChildL( aId );
  1738     //Used to by the deletehandler to traverse the table for the lowest level child
  1739     
  1739     aFirstChildId = iContainersTable->FirstChildForDeleteL( aId, aBookmark );       
  1740     if( aFirstChildId != KContainerInvalidId )
  1740     } 
  1741         {
  1741 
  1742         aBookmark = iContainersTable->Bookmark();
       
  1743         } // end if
       
  1744         
       
  1745      } // end FirstChildL
       
  1746 		
       
  1747 // ==========================================================================
  1742 // ==========================================================================
  1748 // FUNCTION: SearchL
  1743 // FUNCTION: SearchL
  1749 // ==========================================================================
  1744 // ==========================================================================
  1750 CContainerStoreSearchHandler* CContainerStore::SearchL( TContainerId                 aType,  
  1745 CContainerStoreSearchHandler* CContainerStore::SearchL( TContainerId                 aType,  
  1751                                                         TMsgStoreSearchCmdParams&    aCmdParam,
  1746                                                         TMsgStoreSearchCmdParams&    aCmdParam,
  1771     
  1766     
  1772     } // end SearchL
  1767     } // end SearchL
  1773 
  1768 
  1774 // ==========================================================================
  1769 // ==========================================================================
  1775 // FUNCTION: StartSortingL
  1770 // FUNCTION: StartSortingL
       
  1771 // Will leave with KErrNotFound if the container is marked for deletion.
  1776 // ==========================================================================
  1772 // ==========================================================================
  1777 TContainerId CContainerStore::StartSortingL( TMsgStoreSortCriteria& aSortCriteria, 
  1773 TContainerId CContainerStore::StartSortingL( TMsgStoreSortCriteria& aSortCriteria, 
  1778                                              RPointerArray<HBufC8>& aPropertyNames,
  1774                                              RPointerArray<HBufC8>& aPropertyNames,
  1779                                              TBool                  aInMemorySort )
  1775                                              TBool                  aInMemorySort )
  1780     {
  1776     {
  1781     __LOG_ENTER_SUPPRESS( "StartSortingL" )
  1777     __LOG_ENTER_SUPPRESS( "StartSortingL" )
  1782     __LOG_WRITE_FORMAT4_INFO( "folder=%x sortField=%d order=%d, aInMemorySort=%d", aSortCriteria.iFolderId, aSortCriteria.iSortBy, aSortCriteria.iSortOrder, aInMemorySort )
  1778     __LOG_WRITE_FORMAT4_INFO( "folder=%x sortField=%d order=%d, aInMemorySort=%d", aSortCriteria.iFolderId, aSortCriteria.iSortBy, aSortCriteria.iSortOrder, aInMemorySort )
  1783 
  1779 
       
  1780     //Seek to make sure the container is not markd for deletion, if the container is marked for deletion
       
  1781     //this will leave with KerrNotFound
       
  1782     TRAPD(err, iContainersTable->SeekL( aSortCriteria.iFolderId, iHierarchy )); 
       
  1783     if (err != KErrNone)
       
  1784         {
       
  1785         User::LeaveIfError(KErrNotFound);
       
  1786         }
  1784     CMsgStoreSortResultRowSet* resultRowSet = iSortingTable->SortL( aSortCriteria, aInMemorySort );
  1787     CMsgStoreSortResultRowSet* resultRowSet = iSortingTable->SortL( aSortCriteria, aInMemorySort );
  1785     CleanupStack::PushL( resultRowSet );
  1788     CleanupStack::PushL( resultRowSet );
  1786     
  1789     
  1787     //the property names will be used by GetSortedRows, and only the properties specified in aPropertyNames
  1790     //the property names will be used by GetSortedRows, and only the properties specified in aPropertyNames
  1788     //will be returned to the client
  1791     //will be returned to the client
  1795     TSortSession session;
  1798     TSortSession session;
  1796     
  1799     
  1797     session.iSessionId = iNextSortSessionId++;
  1800     session.iSessionId = iNextSortSessionId++;
  1798     session.iResultRowSet = resultRowSet ;
  1801     session.iResultRowSet = resultRowSet ;
  1799     
  1802     
  1800     iSortSessions.Append( session );
  1803     iSortSessions.AppendL( session );
  1801     
  1804     
  1802     CleanupStack::Pop( resultRowSet );
  1805     CleanupStack::Pop( resultRowSet );
  1803     
  1806     
  1804     return session.iSessionId;
  1807     return session.iSessionId;
  1805     }
  1808     }
  2486 void CContainerStore::CommitDatabaseTransactionL()
  2489 void CContainerStore::CommitDatabaseTransactionL()
  2487     {
  2490     {
  2488     iUtils->CommitDatabaseTransactionL();
  2491     iUtils->CommitDatabaseTransactionL();
  2489     }
  2492     }
  2490 
  2493 
       
  2494 /*
       
  2495  * Check to see there are mailboxes/folder IDs marked for deletion.
       
  2496  */
       
  2497 TBool CContainerStore::DeleteFromSortingTable()
       
  2498     {
       
  2499     TBool moreToDelete = EFalse;
       
  2500     TRAP_IGNORE(moreToDelete = iSortingTable->DeleteNextContainerMarkedForDeletionL());
       
  2501     return moreToDelete;   
       
  2502     }
  2491 /**
  2503 /**
  2492  * 
  2504  * 
  2493  */
  2505  */
  2494 /*public*/ const TDesC& CContainerStore::PrivatePath()
  2506 /*public*/ const TDesC& CContainerStore::PrivatePath()
  2495     {
  2507     {