persistentstorage/sql/SRC/Server/SqlSrvConfig.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
--- a/persistentstorage/sql/SRC/Server/SqlSrvConfig.cpp	Tue Aug 31 16:57:14 2010 +0300
+++ b/persistentstorage/sql/SRC/Server/SqlSrvConfig.cpp	Wed Sep 01 12:39:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -16,11 +16,6 @@
 #include <f32file64.h>
 #include "SqlSrvConfig.h"
 #include "SqlSrvUtil.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "SqlSrvConfigTraces.h"
-#endif
-#include "SqlTraceDef.h"
 
 /**
 Initializes TSqlSrvConfigParams data members with their default values.
@@ -51,15 +46,11 @@
 */
 void TSqlSrvConfig::InitL(RFs& aFs, const TDesC& aFileName)
 	{
-	SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLSRVCONFIGFILE_INITL_ENTRY, "Entry;0;TSqlSrvConfig::InitL;aFs.Handle()=0x%X;aFileName=%S", (TUint)aFs.Handle(), __SQLPRNSTR(aFileName)));
 	if(::FileExists(aFs, aFileName))
 		{
-        SQL_TRACE_INTERNALS(OstTrace0(TRACE_INTERNALS, TSQLSRVCONFIGFILE_INITL1, "0;TSqlSrvConfig::InitL;Config file found"));
 		TBuf8<KSqlSrvMaxConfigStrLen> configFileStr;
 		//Step 1: get the config string from the config file and store the string in configFileStr
 		TSqlSrvConfig::GetConfigStringFromFileL(aFs, aFileName, configFileStr);
-		__SQLTRACE_INTERNALSVAR(TBuf<100> des16prnbuf);
-        SQL_TRACE_INTERNALS(OstTraceExt1(TRACE_INTERNALS, TSQLSRVCONFIGFILE_INITL2, "0;TSqlSrvConfig::InitL;Config file string=%s", __SQLPRNSTR8(configFileStr, des16prnbuf)));
 		//Step 2: extract config file parameters from the string (configFileStr)  and store them in iConfigFileParams
 		TSqlSrvConfig::ExtractConfigParamsFromStringL(configFileStr, iConfigFileParams);
 		}
@@ -73,13 +64,6 @@
 		{
 		iConfigFileParams.iFreePageThresholdKb = KSqlCompactFreePageThresholdKb;
 		}
-
-#ifdef _SQL_RDEBUG_PRINT
-    SQL_TRACE_INTERNALS(OstTraceExt4(TRACE_INTERNALS, TSQLSRVCONFIGFILE_INITL_EXIT1, "Exit;0;TSqlSrvConfig::InitL;iCacheSize=%d;iPageSize=%d;iDbEncoding=%d;iSoftHeapLimit=%d", iConfigFileParams.iCacheSize, iConfigFileParams.iPageSize, iConfigFileParams.iDbEncoding, iConfigFileParams.iSoftHeapLimitKb));
-#else	
-    SQL_TRACE_INTERNALS(OstTraceExt4(TRACE_INTERNALS, TSQLSRVCONFIGFILE_INITL_EXIT2, "Exit;0;TSqlSrvConfig::InitL;iCacheSize=%d;iPageSize=%d;iDbEncoding=%{TSqlSrvConfig_TDbEncoding};iSoftHeapLimit=%d", iConfigFileParams.iCacheSize, iConfigFileParams.iPageSize, iConfigFileParams.iDbEncoding, iConfigFileParams.iSoftHeapLimitKb));
-#endif    
-    SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLSRVCONFIGFILE_INITL_EXIT3, "Exit;0;TSqlSrvConfig::InitL;iCompactionMode=%d;iFreePageThresholdKb=%d", iConfigFileParams.iCompactionMode, iConfigFileParams.iFreePageThresholdKb));
 	}
 
 /**
@@ -98,8 +82,6 @@
 */
 void TSqlSrvConfig::GetConfigParamsL(const TDesC8& aConfigStr, TSqlSrvConfigParams& aConfigParams) const
 	{
-	__SQLTRACE_INTERNALSVAR(TBuf<100> des16prnbuf);
-    SQL_TRACE_INTERNALS(OstTraceExt1(TRACE_INTERNALS, TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_ENTRY, "Entry;0;TSqlSrvConfig::GetConfigParamsL;aConfigStr=%s", __SQLPRNSTR8(aConfigStr, des16prnbuf)));
 	TSqlSrvConfigParams tmpConfigParams;
 	//Step 1: extract configuration parameters from aConfigStr, store them in tmpConfigParams.
 	TSqlSrvConfig::ExtractConfigParamsFromStringL(aConfigStr, tmpConfigParams);
@@ -129,24 +111,18 @@
 	//Step 5: set the free page threshold.
 	aConfigParams.iFreePageThresholdKb = iConfigFileParams.iFreePageThresholdKb;
 	//Step 6: assert the parameter values.
-	__ASSERT_DEBUG(aConfigParams.iPageSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iPageSize >= 0, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iCacheSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iCacheSize >= 0, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncNotSet || 
+	__SQLASSERT(aConfigParams.iPageSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iPageSize >= 0, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iCacheSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iCacheSize >= 0, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncNotSet || 
 				aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncUtf8 || 
-				aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncUtf16, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iSoftHeapLimitKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
+				aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncUtf16, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iSoftHeapLimitKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
 	            (aConfigParams.iSoftHeapLimitKb >= TSqlSrvConfigParams::KMinSoftHeapLimitKb &&
-	             aConfigParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb), __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iCompactionMode == ESqlCompactionNotSet || aConfigParams.iCompactionMode == ESqlCompactionManual || 
-				aConfigParams.iCompactionMode == ESqlCompactionBackground || aConfigParams.iCompactionMode == ESqlCompactionAuto, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iFreePageThresholdKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
-				aConfigParams.iFreePageThresholdKb >= 0, __SQLPANIC(ESqlPanicInternalError));
-#ifdef _SQL_RDEBUG_PRINT
-    SQL_TRACE_INTERNALS(OstTraceExt4(TRACE_INTERNALS, TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT1, "Exit;0;TSqlSrvConfig::GetConfigParamsL;cacheSize=%d;pageSize=%d;dbEncoding=%d;softHeapLimit=%d", aConfigParams.iCacheSize, aConfigParams.iPageSize, aConfigParams.iDbEncoding, aConfigParams.iSoftHeapLimitKb));
-#else   
-    SQL_TRACE_INTERNALS(OstTraceExt4(TRACE_INTERNALS, TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT2, "Exit;0;TSqlSrvConfig::GetConfigParamsL;cacheSize=%d;pageSize=%d;dbEncoding=%{TSqlSrvConfig_TDbEncoding};softHeapLimit=%d", aConfigParams.iCacheSize, aConfigParams.iPageSize, aConfigParams.iDbEncoding, aConfigParams.iSoftHeapLimitKb));
-#endif    
-    SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, TSQLSRVCONFIGFILE_GETCONFIGPARAMSL_EXIT3, "Exit;0;TSqlSrvConfig::GetConfigParamsL;compactionMode=%d;freePageThresholdKb=%d", aConfigParams.iCompactionMode, aConfigParams.iFreePageThresholdKb));
+	             aConfigParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb), ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iCompactionMode == ESqlCompactionNotSet || aConfigParams.iCompactionMode == ESqlCompactionManual || 
+				aConfigParams.iCompactionMode == ESqlCompactionBackground || aConfigParams.iCompactionMode == ESqlCompactionAuto, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iFreePageThresholdKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
+				aConfigParams.iFreePageThresholdKb >= 0, ESqlPanicInternalError);
 	}
 
 //The function opeans the aFileName config file and reads the config string, storring it in aConfigStr argument.
@@ -157,10 +133,10 @@
 //The function may leave if some of the file I/O operations (open file, read file) fails.
 void TSqlSrvConfig::GetConfigStringFromFileL(RFs& aFs, const TDesC& aFileName, TDes8& aConfigStr)
 	{
-	__ASSERT_DEBUG(aConfigStr.MaxLength() >= KSqlSrvMaxConfigStrLen, __SQLPANIC2(ESqlPanicBadArgument));
+	__SQLASSERT(aConfigStr.MaxLength() >= KSqlSrvMaxConfigStrLen, ESqlPanicBadArgument);
 	RFile64 cfgFile;
 	CleanupClosePushL(cfgFile);
-	__SQLLEAVE_IF_ERROR2(cfgFile.Open(aFs, aFileName, EFileRead));
+	__SQLLEAVE_IF_ERROR(cfgFile.Open(aFs, aFileName, EFileRead));
 	TFileText cfgFileReader;
 	cfgFileReader.Set(cfgFile);
 	TBuf<KSqlSrvMaxConfigStrLen> buf;
@@ -180,13 +156,13 @@
 	CleanupStack::PopAndDestroy(&cfgFile);
 	if(err != KErrEof)
 		{//The "read configuration file" operation has failed with "err" (if err != KErrNone)
-		__SQLLEAVE_IF_ERROR2(err);	
+		__SQLLEAVE_IF_ERROR(err);	
 		}
 	if(!cfgLineFound)
 		{//End of config file reached - no valid configuration line found.
-		__SQLLEAVE2(KErrEof);	
+		__SQLLEAVE(KErrEof);	
 		}
-	__ASSERT_DEBUG(err == KErrNone || err == KErrEof, __SQLPANIC2(ESqlPanicInternalError));
+	__SQLASSERT(err == KErrNone || err == KErrEof, ESqlPanicInternalError);
 	aConfigStr.Copy(buf);
 	}
 
@@ -208,18 +184,18 @@
 			}
 		}
 	//Assert the extracted parameter values.
-	__ASSERT_DEBUG(aConfigParams.iPageSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iPageSize >= 0, __SQLPANIC2(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iCacheSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iCacheSize >= 0, __SQLPANIC2(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncNotSet || 
+	__SQLASSERT(aConfigParams.iPageSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iPageSize >= 0, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iCacheSize == TSqlSrvConfigParams::KConfigPrmValueNotSet || aConfigParams.iCacheSize >= 0, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncNotSet || 
 				aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncUtf8 || 
-				aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncUtf16, __SQLPANIC2(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iSoftHeapLimitKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
+				aConfigParams.iDbEncoding == TSqlSrvConfigParams::EEncUtf16, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iSoftHeapLimitKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
 	            (aConfigParams.iSoftHeapLimitKb >= TSqlSrvConfigParams::KMinSoftHeapLimitKb &&
-	             aConfigParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb), __SQLPANIC2(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iCompactionMode == ESqlCompactionNotSet || aConfigParams.iCompactionMode == ESqlCompactionManual || 
-				aConfigParams.iCompactionMode == ESqlCompactionBackground || aConfigParams.iCompactionMode == ESqlCompactionAuto, __SQLPANIC2(ESqlPanicInternalError));
-	__ASSERT_DEBUG(aConfigParams.iFreePageThresholdKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
-			    aConfigParams.iFreePageThresholdKb >= 0, __SQLPANIC2(ESqlPanicInternalError));
+	             aConfigParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb), ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iCompactionMode == ESqlCompactionNotSet || aConfigParams.iCompactionMode == ESqlCompactionManual || 
+				aConfigParams.iCompactionMode == ESqlCompactionBackground || aConfigParams.iCompactionMode == ESqlCompactionAuto, ESqlPanicInternalError);
+	__SQLASSERT(aConfigParams.iFreePageThresholdKb == TSqlSrvConfigParams::KConfigPrmValueNotSet || 
+			    aConfigParams.iFreePageThresholdKb >= 0, ESqlPanicInternalError);
 	}
 
 //The function searches aConfigStr arguments for "PARAM=VALUE;" pair. If such pair is found, then 
@@ -261,7 +237,7 @@
 	pos = prmText.Locate(KAssignment);
 	if(pos < 0 || pos >= (prmText.Length() - 1))
 		{
-		__SQLLEAVE2(KErrArgument);
+		__SQLLEAVE(KErrArgument);
 		}
 	//we've got now prmText pointing to a " PARAM = VALUE " string.
 	aParamName.Set(TSqlSrvConfig::TrimAndConstructPtr(prmText.Ptr(), pos));
@@ -313,7 +289,7 @@
 	TInt err = lex.Val(cacheSize);
 	if(err != KErrNone || cacheSize < 0) 	//The correct check is for "<=0", but it has to be backward 
 		{									//compatible with the previous implementation
-		__SQLLEAVE2(KErrArgument);
+		__SQLLEAVE(KErrArgument);
 		}
 	return cacheSize;
 	}
@@ -327,7 +303,7 @@
 	TInt err = lex.Val(pageSize);
 	if(err != KErrNone || pageSize < 0) 	//The correct check is for "<0", "power of 2", "between 512 and 32768",
 		{									//but it has to be backward compatible with the previous implementation
-		__SQLLEAVE2(KErrArgument);
+		__SQLLEAVE(KErrArgument);
 		}
 	return pageSize;
 	}
@@ -360,7 +336,7 @@
 	if(err != KErrNone || softHeapLimitKb < 0 || 
 	   (softHeapLimitKb < TSqlSrvConfigParams::KMinSoftHeapLimitKb || softHeapLimitKb > TSqlSrvConfigParams::KMaxSoftHeapLimitKb))
 		{					
-		__SQLLEAVE2(KErrArgument);
+		__SQLLEAVE(KErrArgument);
 		}
 	return softHeapLimitKb;
 	}
@@ -396,7 +372,7 @@
 	TInt err = lex.Val(freePageThreshold);
 	if(err != KErrNone || freePageThreshold < 0)
 		{					
-		__SQLLEAVE2(KErrArgument);
+		__SQLLEAVE(KErrArgument);
 		}
 	return freePageThreshold;
 	}
@@ -407,8 +383,8 @@
 //aStr content without leading and trailing whitespace characters.
 TPtrC8 TSqlSrvConfig::TrimAndConstructPtr(const TUint8* aStr, TInt aLength)
 	{
-	__ASSERT_DEBUG(aStr != NULL, __SQLPANIC2(ESqlPanicBadArgument));
-	__ASSERT_DEBUG(aLength >= 0, __SQLPANIC2(ESqlPanicBadArgument));
+	__SQLASSERT(aStr != NULL, ESqlPanicBadArgument);
+	__SQLASSERT(aLength >= 0, ESqlPanicBadArgument);
 	//Trim left
 	for(;aLength>0;--aLength,++aStr)
 		{