persistentstorage/sql/SRC/Server/Compact/SqlCompact.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 6 5ffdb8f2067f
child 23 26645d81f48d
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     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".
    22 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    22 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    23 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    23 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    24 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    24 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    25 
    25 
    26 /**
    26 /**
    27 Initializes the background compaction stettings with their default values.
    27 Initializes the background compaction settings with their default values.
    28 */
    28 */
    29 TSqlCompactSettings::TSqlCompactSettings() :
    29 TSqlCompactSettings::TSqlCompactSettings() :
    30 	iStepLength(KSqlCompactStepLengthMs),
    30 	iStepLength(KSqlCompactStepLengthMs),
    31 	iFreePageThresholdKb(KSqlCompactFreePageThresholdKb)
    31 	iFreePageThresholdKb(KSqlCompactFreePageThresholdKb)
    32 	{
    32 	{
    57 
    57 
    58 /**
    58 /**
    59 Creates a new CSqlCompactor instance.
    59 Creates a new CSqlCompactor instance.
    60 
    60 
    61 @param aConnFactoryL MSqlCompactConn factory function.
    61 @param aConnFactoryL MSqlCompactConn factory function.
    62 @param aCompactStepInterval The time intrerval (ms) between the background compaction steps.
    62 @param aCompactStepInterval The time interval (ms) between the background compaction steps.
    63 
    63 
    64 @return A pointer to the created CSqlCompactor instance
    64 @return A pointer to the created CSqlCompactor instance
    65 
    65 
    66 @leave KErrNoMemory, an out of memory condition has occurred;
    66 @leave KErrNoMemory, an out of memory condition has occurred;
    67                      Note that the function may also leave with some other database specific 
    67                      Note that the function may also leave with some other database specific 
   117 	}
   117 	}
   118 
   118 
   119 /**
   119 /**
   120 If an entry referring to a database with name aFullName does not exist in the container, a new entry will be created,
   120 If an entry referring to a database with name aFullName does not exist in the container, a new entry will be created,
   121 a connection with the database established.
   121 a connection with the database established.
   122 If an entry with the specidfied name already exists, no new entry wil be created, the reference counter of the existing one 
   122 If an entry with the specified name already exists, no new entry wil be created, the reference counter of the existing one 
   123 will be incremented.
   123 will be incremented.
   124 
   124 
   125 @param aFullName The full database name, including the path.
   125 @param aFullName The full database name, including the path.
   126 @param aSettings Per-database background compaction settings
   126 @param aSettings Per-database background compaction settings
   127 
   127 
   128 @leave KErrNoMemory, an out of memory condition has occurred;
   128 @leave KErrNoMemory, an out of memory condition has occurred;
   129                      Note that the function may also leave with some other database specific 
   129                      Note that the function may also leave with some other database specific 
   130                      errors categorised as ESqlDbError, and other system-wide error codes.
   130                      errors categorised as ESqlDbError, and other system-wide error codes.
   131 
   131 
   132 @panic SqlDb 4 In _DEBUG mode. Too short or too long database name (aFullName parameter)
   132 @panic SqlDb 4 In _DEBUG mode. Too short or too long database name (aFullName parameter)
   133 @panic SqlDb 7 In _DEBUG mode. An entry with the specidfied name has been found but the entry is NULL.
   133 @panic SqlDb 7 In _DEBUG mode. An entry with the specified name has been found but the entry is NULL.
   134 */
   134 */
   135 void CSqlCompactor::AddEntryL(const TDesC& aFullName, const TSqlCompactSettings& aSettings)
   135 void CSqlCompactor::AddEntryL(const TDesC& aFullName, const TSqlCompactSettings& aSettings)
   136 	{
   136 	{
   137 	__SQLASSERT(aFullName.Length() > 0 && aFullName.Length() <= KMaxFileName, ESqlPanicBadArgument);
   137 	__SQLASSERT(aFullName.Length() > 0 && aFullName.Length() <= KMaxFileName, ESqlPanicBadArgument);
   138 	SQLCOMPACTOR_INVARIANT();
   138 	SQLCOMPACTOR_INVARIANT();
   154 	SQLCOMPACTOR_INVARIANT();
   154 	SQLCOMPACTOR_INVARIANT();
   155 	}
   155 	}
   156 
   156 
   157 /**
   157 /**
   158 Decrements the reference counter of the specified entry.
   158 Decrements the reference counter of the specified entry.
   159 If the counter reaches zero, the entry will be destroyed and removed form the container, the database connection - closed.
   159 If the counter reaches zero, the entry will be destroyed and removed from the container, 
       
   160 the database connection - closed.
   160 
   161 
   161 @param aFullName The full database name, including the path.
   162 @param aFullName The full database name, including the path.
   162 */
   163 */
   163 void CSqlCompactor::ReleaseEntry(const TDesC& aFullName)
   164 void CSqlCompactor::ReleaseEntry(const TDesC& aFullName)
   164 	{
   165 	{