emailservices/emailstore/message_store/server/src/MsgStoreSortResultRowSet.cpp
changeset 76 38bf5461e270
parent 51 d845db10c0d4
equal deleted inserted replaced
74:6c59112cfd31 76:38bf5461e270
   126 	    if ( !iDbView.PreviousL() )
   126 	    if ( !iDbView.PreviousL() )
   127 	        {
   127 	        {
   128 	        hasMorePrevious = EFalse;
   128 	        hasMorePrevious = EFalse;
   129 	        }
   129 	        }
   130 	    //move it back
   130 	    //move it back
       
   131 	    
       
   132 	    //no need to check here
       
   133 	    //coverity[check_return]
   131 	    iDbView.NextL();
   134 	    iDbView.NextL();
   132 	    }    
   135 	    }    
   133 	return hasMorePrevious;
   136 	return hasMorePrevious;
   134 	}
   137 	}
   135 
   138 
   155 // ==========================================================================
   158 // ==========================================================================
   156 // FUNCTION: NextL
   159 // FUNCTION: NextL
   157 // ==========================================================================
   160 // ==========================================================================
   158 TMsgStoreId CMsgStoreSortResultRowSet::NextL()
   161 TMsgStoreId CMsgStoreSortResultRowSet::NextL()
   159 	{
   162 	{
       
   163     //checked using AtEnd() below
       
   164     //coverity[check_return]
   160 	iDbView.NextL();
   165 	iDbView.NextL();
   161     if ( iDbView.AtEnd() )
   166     if ( iDbView.AtEnd() )
   162         {
   167         {
   163         User::Leave( KErrOverflow );
   168         User::Leave( KErrOverflow );
   164         }
   169         }
   202         TBuf<KQuerrySize> query;
   207         TBuf<KQuerrySize> query;
   203         query.Copy( KSortingTableMessageIdCol );
   208         query.Copy( KSortingTableMessageIdCol );
   204         query.Append( KEqual );
   209         query.Append( KEqual );
   205         query.AppendNum( aMessageId );
   210         query.AppendNum( aMessageId );
   206         
   211         
   207         iDbView.FirstL();
   212         if(iDbView.FirstL()){
   208         
   213         
   209         TInt rc = iDbView.FindL( RDbRowSet::EForwards, query );
   214             TInt rc = iDbView.FindL( RDbRowSet::EForwards, query );
   210         if ( rc < 0 )
   215             if ( rc < 0 )
   211             {
   216                 {
   212             User::Leave( rc );
   217                 User::Leave( rc );
   213             }
   218                 }
       
   219             }
       
   220 		else{
       
   221 			User::Leave(KErrNotFound);		
       
   222 			}
   214         }
   223         }
   215 	}
   224 	}
   216 
   225 
   217 // ==========================================================================
   226 // ==========================================================================
   218 // FUNCTION: GotoL
   227 // FUNCTION: GotoL
   421 	aIdArray.Reset();
   430 	aIdArray.Reset();
   422 	TInt count = iDbView.CountL();
   431 	TInt count = iDbView.CountL();
   423 	iDbView.BeginningL();
   432 	iDbView.BeginningL();
   424 	for ( TInt i = 0 ; i < count ; i++  )
   433 	for ( TInt i = 0 ; i < count ; i++  )
   425 		{
   434 		{
       
   435 	    //no need to check return here
       
   436 	    //coverity[check_return]
   426 		iDbView.NextL();
   437 		iDbView.NextL();
   427 		aIdArray.AppendL( GetRowL() );
   438 		aIdArray.AppendL( GetRowL() );
   428 		}
   439 		}
   429 	}
   440 	}
   430 
   441 
   431 // ==========================================================================
   442 // ==========================================================================
   432 // FUNCTION: IndexOfL
   443 // FUNCTION: IndexOfL
   433 // ==========================================================================
   444 // ==========================================================================
   434 TInt CMsgStoreSortResultRowSet::IndexOfL( TContainerId aMessageId )
   445 TInt CMsgStoreSortResultRowSet::IndexOfL( TContainerId aMessageId )
   435     {
   446     {
       
   447     TInt ret = -1;
   436     //have to search it from the begining
   448     //have to search it from the begining
   437     const TUint bufSize = 200;
   449     const TUint bufSize = 200;
   438     TBuf<bufSize> query;
   450     TBuf<bufSize> query;
   439     query.Copy( KSortingTableMessageIdCol );
   451     query.Copy( KSortingTableMessageIdCol );
   440     query.Append( KEqual );
   452     query.Append( KEqual );
   441     query.AppendNum( aMessageId );
   453     query.AppendNum( aMessageId );
   442     
   454     
   443     iDbView.FirstL();
   455     if(iDbView.FirstL()){
   444     
   456         ret = iDbView.FindL( RDbRowSet::EForwards, query );
   445     return iDbView.FindL( RDbRowSet::EForwards, query );
   457     }
       
   458     return ret;
   446     }
   459     }
   447 
   460 
   448 // ==========================================================================
   461 // ==========================================================================
   449 // FUNCTION: SortedIdsAndGroupCountL
   462 // FUNCTION: SortedIdsAndGroupCountL
   450 // ==========================================================================
   463 // ==========================================================================