persistentstorage/sql/SRC/Server/SqlSrvUtil.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
--- a/persistentstorage/sql/SRC/Server/SqlSrvUtil.cpp	Tue Aug 31 16:57:14 2010 +0300
+++ b/persistentstorage/sql/SRC/Server/SqlSrvUtil.cpp	Wed Sep 01 12:39:58 2010 +0100
@@ -14,15 +14,10 @@
 //
 
 #include <stdlib.h>				//wchar_t
-#include "SqlAssert.h"
+#include "SqlPanic.h"
 #include "SqlSrvUtil.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "SqlSrvUtilTraces.h"
-#endif
-#include "SqlTraceDef.h"
 
-#ifdef _SQL_AUTHORIZER_TRACE_ENABLED
+#ifdef _NOTIFY
 
 //Used in PrintAuthorizerArguments()
 _LIT8(KCreateIndex,			"Create index");			//SQLITE_CREATE_INDEX
@@ -71,9 +66,9 @@
 	KCreateVTable(), KDropVTable(), KFunctionCall()
 	};
 
-#ifdef _DEBUG
 const TInt KMaxOpCodes = sizeof(KDbOpNames) / sizeof(KDbOpNames[0]);
-#endif
+
+_LIT(KFormatStr, "!!Authorize: %20.20S, %40.40S, %10.10S, %10.10S, %10.10S\r\n"); 
 
 /**
 This function has a defined implementaion only in _DEBUG mode and is used to print the authorizer arguments.
@@ -83,7 +78,7 @@
 void PrintAuthorizerArguments(TInt aDbOpType, const char* aDbObjName1, const char* aDbObjName2, 
 							  const char* aDbName, const char* aTrgOrViewName)
 	{
-	__ASSERT_DEBUG(aDbOpType > 0 && aDbOpType <= KMaxOpCodes, __SQLPANIC2(ESqlPanicInternalError));
+	__SQLASSERT(aDbOpType > 0 && aDbOpType <= KMaxOpCodes, ESqlPanicInternalError);
 	
 	//TPtrC8 objects cannot be used for the function arguments, because the arguments may not be 16-bit aligned!!!	
 
@@ -131,9 +126,9 @@
 			}
 		}
 		
-	SQL_TRACE_AUTHORIZER(OstTraceExt5(TRACE_INTERNALS, SQLAUTHORIZER, "0;PrintAuthorizerArguments;%20.20S;%40.40S;%10.10S;%10.10S;%10.10S", __SQLPRNSTR(opName), __SQLPRNSTR(dbObjName1), __SQLPRNSTR(dbObjName2), __SQLPRNSTR(dbName), __SQLPRNSTR(trgOrViewName)));
+	RDebug::Print(KFormatStr, &opName, &dbObjName1, &dbObjName2, &dbName, &trgOrViewName);
 	}
-#endif//_SQL_AUTHORIZER_TRACE_ENABLED
+#endif//_NOTIFY
 
 /**
 Converts a UTF16 encoded descriptor to a UTF8 encoded descriptor.
@@ -150,8 +145,8 @@
 */
 TBool UTF16ToUTF8(const TDesC& aIn, TDes8& aOut)
 	{
-    __ASSERT_DEBUG(aIn.Length() <= KMaxFileName, __SQLPANIC2(ESqlPanicBadArgument));
-    __ASSERT_DEBUG(aOut.MaxLength() >= KMaxFileName, __SQLPANIC2(ESqlPanicBadArgument));
+	__SQLASSERT(aIn.Length() <= KMaxFileName, ESqlPanicBadArgument);
+	__SQLASSERT(aOut.MaxLength() >= KMaxFileName, ESqlPanicBadArgument);
 	TBuf16<KMaxFileName + 1> des;
 	des.Copy(aIn);
 	des.Append(TChar(0));
@@ -180,9 +175,9 @@
 */
 TBool UTF16ZToUTF8Z(const TDesC& aFileName, TDes8& aFileNameDestBuf)
 	{
-	__ASSERT_DEBUG(aFileName.Length() <= (KMaxFileName + 1), __SQLPANIC2(ESqlPanicBadArgument));
-	__ASSERT_DEBUG(aFileName[aFileName.Length() - 1] == 0, __SQLPANIC2(ESqlPanicBadArgument));
-	__ASSERT_DEBUG(aFileNameDestBuf.MaxLength() >= (KMaxFileName + 1), __SQLPANIC2(ESqlPanicBadArgument));
+	__SQLASSERT(aFileName.Length() <= (KMaxFileName + 1), ESqlPanicBadArgument);
+	__SQLASSERT(aFileName[aFileName.Length() - 1] == 0, ESqlPanicBadArgument);
+	__SQLASSERT(aFileNameDestBuf.MaxLength() >= (KMaxFileName + 1), ESqlPanicBadArgument);
 	const wchar_t* src = reinterpret_cast <const wchar_t*> (aFileName.Ptr());
 	TInt len = wcstombs((char*)aFileNameDestBuf.Ptr(), src, KMaxFileName);
 	//Check the file name length. If it is longer than KMaxFileName characters, then the file name is not valid.
@@ -209,8 +204,8 @@
 */
 TBool UTF16ToUTF8Z(const TDesC& aFileName, TDes8& aFileNameDestBuf)
 	{
-	__ASSERT_DEBUG(aFileName.Length() <= KMaxFileName, __SQLPANIC2(ESqlPanicBadArgument));
-	__ASSERT_DEBUG(aFileNameDestBuf.MaxLength() >= (KMaxFileName + 1), __SQLPANIC2(ESqlPanicBadArgument));
+	__SQLASSERT(aFileName.Length() <= KMaxFileName, ESqlPanicBadArgument);
+	__SQLASSERT(aFileNameDestBuf.MaxLength() >= (KMaxFileName + 1), ESqlPanicBadArgument);
 	TBool rc = ::UTF16ToUTF8(aFileName, aFileNameDestBuf);
 	if(rc)
 		{
@@ -228,6 +223,6 @@
 		{//Non-existing file
 		return EFalse;	
 		}
-	__SQLLEAVE_IF_ERROR2(err);
+	__SQLLEAVE_IF_ERROR(err);
 	return entry.IsReadOnly();
 	}