persistentstorage/sql/SRC/Server/Compact/SqlCompactEntry.cpp
branchRCL_3
changeset 10 31a8f755b7fe
parent 0 08ec8eefde2f
child 18 3da531bb4329
equal deleted inserted replaced
9:667e88a979d7 10:31a8f755b7fe
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    30 @param aFullName The full database name, including the path.
    30 @param aFullName The full database name, including the path.
    31 @param aConnFactoryL MSqlCompactConn factory function.
    31 @param aConnFactoryL MSqlCompactConn factory function.
    32 @param aSettings Background compaction settings/thresholds
    32 @param aSettings Background compaction settings/thresholds
    33 @param aTimer The background compaction timer object
    33 @param aTimer The background compaction timer object
    34 
    34 
    35 When the free pages threshold reach certain the threshold, the background compaction 
    35 When the free pages threshold is reached, the background compaction 
    36 for this entry will be kicked-off.
    36 for this entry will be kicked-off.
    37 
    37 
    38 @return A pointer to the created CSqlCompactEntry instance
    38 @return A pointer to the created CSqlCompactEntry instance
    39 
    39 
    40 @leave KErrNoMemory, an out of memory condition has occurred;
    40 @leave KErrNoMemory, an out of memory condition has occurred;
   208 	TInt err = Connection().Compact(iPageCount, processedPageCount, iSettings.iStepLength);
   208 	TInt err = Connection().Compact(iPageCount, processedPageCount, iSettings.iStepLength);
   209 	iFreePageCallbackDisabled = EFalse;
   209 	iFreePageCallbackDisabled = EFalse;
   210 	__SQLASSERT(processedPageCount >= 0, ESqlPanicInternalError);
   210 	__SQLASSERT(processedPageCount >= 0, ESqlPanicInternalError);
   211 	if(err == KErrNone)
   211 	if(err == KErrNone)
   212 		{
   212 		{
   213 		if(processedPageCount > 0)
   213 		iPageCount -= processedPageCount;
   214 			{
       
   215 			iPageCount -= processedPageCount;
       
   216 			}
       
   217 		else
       
   218 			{
       
   219 			iPageCount = 0;
       
   220 			}
       
   221 		__SQLASSERT(iPageCount >= 0, ESqlPanicInternalError);
   214 		__SQLASSERT(iPageCount >= 0, ESqlPanicInternalError);
   222 		}
   215 		}
   223 	if(iPageCount <= 0)
   216 	if(iPageCount <= 0)
   224 		{//No more pages to compact. Stop the compacting, move to EInactive state, remove from the timer queue.
   217 		{//No more pages to compact. Stop the compacting, move to EInactive state, remove from the timer queue.
   225 		ResetState();
   218 		ResetState();