persistentstorage/sql/SRC/Client/SqlStatement.cpp
changeset 31 ba1c4f4a893f
parent 0 08ec8eefde2f
child 45 cc28652e0254
--- a/persistentstorage/sql/SRC/Client/SqlStatement.cpp	Thu Jul 01 17:02:22 2010 +0100
+++ b/persistentstorage/sql/SRC/Client/SqlStatement.cpp	Tue Jul 06 11:54:49 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-2010 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"
@@ -14,6 +14,11 @@
 //
 
 #include "SqlStatementImpl.h"		//CSqlStatementImpl
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "SqlStatementTraces.h"
+#endif
+#include "SqlTraceDef.h"
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -79,10 +84,10 @@
 */	
 EXPORT_C TInt RSqlStatement::Prepare(RSqlDatabase& aDatabase, const TDesC& aSqlStmt)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam16, &aDatabase, &aSqlStmt));
-
-	return CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
+    SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE16_ENTRY, "Entry;0x%X;RSqlStatement::Prepare16;aDatabase=0x%X;aSqlStmt=%S", (TUint)this, (TUint)&aDatabase, __SQLPRNSTR(aSqlStmt)));
+	TInt err = CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
+    SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE16_EXIT, "Exit;0x%X;RSqlStatement::Prepare16;iImpl=0x%X;err=%d", (TUint)this, (TUint)iImpl, err));
+	return err;
 	}
 	
 /**
@@ -138,11 +143,11 @@
 */	
 EXPORT_C TInt RSqlStatement::Prepare(RSqlDatabase& aDatabase, const TDesC8& aSqlStmt)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam, 
-			&aDatabase, &aSqlStmt));
-	
-	return CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
+	__SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf);
+    SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE8_ENTRY, "Entry;0x%X;RSqlStatement::Prepare8;aDatabase=0x%X;aSqlStmt=%s", (TUint)this, (TUint)&aDatabase, __SQLPRNSTR8(aSqlStmt, des16prnbuf)));
+	TInt err = CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
+    SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE8_EXIT, "Exit;0x%X;RSqlStatement::Prepare8;iImpl=0x%X;err=%d", (TUint)this, (TUint)iImpl, err));
+	return err;
 	}
 
 /**
@@ -196,11 +201,9 @@
 */
 EXPORT_C void RSqlStatement::PrepareL(RSqlDatabase& aDatabase, const TDesC& aSqlStmt)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam16, 
-			&aDatabase, &aSqlStmt));
-	
+    SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE16L_ENTRY, "Entry;0x%X;RSqlStatement::Prepare16L;aDatabase=0x%X;aSqlStmt=%S", (TUint)this, (TUint)&aDatabase, __SQLPRNSTR(aSqlStmt)));
 	__SQLLEAVE_IF_ERROR(Prepare(aDatabase, aSqlStmt));
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_PREPARE16L_EXIT, "Exit;0x%X;RSqlStatement::Prepare16L;iImpl=0x%X", (TUint)this, (TUint)iImpl));
 	}
 	
 /**
@@ -255,11 +258,10 @@
 */
 EXPORT_C void RSqlStatement::PrepareL(RSqlDatabase& aDatabase, const TDesC8& aSqlStmt)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam, 
-			&aDatabase, &aSqlStmt));
-
+	__SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf);
+    SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE8L_ENTRY, "Entry;0x%X;RSqlStatement::Prepare8L;aDatabase=0x%X;aSqlStmt=%s", (TUint)this, (TUint)&aDatabase, __SQLPRNSTR8(aSqlStmt, des16prnbuf)));
 	__SQLLEAVE_IF_ERROR(Prepare(aDatabase, aSqlStmt));
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_PREPARE8L_EXIT, "Exit;0x%X;RSqlStatement::Prepare8L;iImpl=0x%X", (TUint)this, (TUint)iImpl));
 	}
 
 
@@ -274,8 +276,9 @@
 */	
 EXPORT_C void RSqlStatement::Close()
 	{
-	SQLUTRACE_PROFILER(this);
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_CLOSE_ENTRY, "Entry;0x%X;RSqlStatement::Close;iImpl=0x%X", (TUint)this, (TUint)iImpl));
 	delete iImpl;
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_CLOSE_EXIT, "Exit;0x%X;RSqlStatement::Close;iImpl=0x%X", (TUint)this, (TUint)iImpl));
 	iImpl = NULL;
 	}
 
@@ -288,7 +291,6 @@
 */
 EXPORT_C TBool RSqlStatement::AtRow() const
 	{
-	SQLUTRACE_PROFILER(this);
 	return Impl().AtRow();
 	}
 	
@@ -352,8 +354,10 @@
 */	
 EXPORT_C TInt RSqlStatement::Reset()
 	{
-	SQLUTRACE_PROFILER(this);
-	return Impl().Reset();
+    SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_RESET_ENTRY, "Entry;0x%X;RSqlStatement::Reset", (TUint)this));
+	TInt err = Impl().Reset();
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_RESET_EXIT, "Exit;0x%X;RSqlStatement::Reset;err=%d", (TUint)this, err));
+	return err;
 	}
 	
 /**
@@ -412,8 +416,10 @@
 */	
 EXPORT_C TInt RSqlStatement::Exec()
 	{
-	SQLUTRACE_PROFILER(this);
-	return Impl().Exec();
+    SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_EXEC_ENTRY, "Entry;0x%X;RSqlStatement::Exec", (TUint)this));
+	TInt err = Impl().Exec();
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_EXEC_EXIT, "Exit;0x%X;RSqlStatement::Exec;err=%d", (TUint)this, err));
+	return err;
 	}
 
 /**
@@ -463,8 +469,9 @@
 */	
 EXPORT_C void RSqlStatement::Exec(TRequestStatus& aStatus)
 	{
-	SQLUTRACE_PROFILER(this);
+    SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_EXECASYNC_ENTRY, "Entry;0x%X;RSqlStatement::ExecAsync", (TUint)this));
 	Impl().Exec(aStatus);
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_EXECASYNC_EXIT, "Exit;0x%X;RSqlStatement::ExecAsync;aStatus.Int()=%d", (TUint)this, aStatus.Int()));
 	}
 	
 /**
@@ -513,8 +520,10 @@
 */	
 EXPORT_C TInt RSqlStatement::Next()
 	{
-	SQLUTRACE_PROFILER(this);
-	return Impl().Next();
+    SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_NEXT_ENTRY, "Entry;0x%X;RSqlStatement::Next", (TUint)this));
+	TInt err = Impl().Next();
+    SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_NEXT_EXIT, "Exit;0x%X;RSqlStatement::Next;err=%d", (TUint)this, err));
+	return err;
 	}
 
 /**
@@ -537,9 +546,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ParameterIndex(const TDesC& aParameterName) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aParameterName));
-
 	return Impl().ParamIndex(aParameterName);
 	}
 
@@ -555,7 +561,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnCount() const
 	{
-	SQLUTRACE_PROFILER(this);
 	return Impl().ColumnCount();
 	}
 	
@@ -576,9 +581,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnIndex(const TDesC& aColumnName) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aColumnName));
-
 	return Impl().ColumnIndex(aColumnName);
 	}
 	
@@ -609,9 +611,6 @@
 */	
 EXPORT_C TSqlColumnType RSqlStatement::ColumnType(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnType(aColumnIndex);
 	}
 
@@ -650,9 +649,6 @@
 */	
 EXPORT_C TInt RSqlStatement::DeclaredColumnType(TInt aColumnIndex, TSqlColumnType& aColumnType) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().DeclaredColumnType(aColumnIndex, aColumnType);
 	}
 	
@@ -700,9 +696,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnSize(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnSize(aColumnIndex);
 	}
 
@@ -733,9 +726,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindNull(TInt aParamIndex)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
-	
 	return Impl().BindNull(aParamIndex);
 	}
 	
@@ -764,9 +754,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindInt(TInt aParamIndex, TInt aParamValue)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
-	
 	return Impl().BindInt(aParamIndex, aParamValue);
 	}
 	
@@ -795,9 +782,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindInt64(TInt aParamIndex, TInt64 aParamValue)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
-	
 	return Impl().BindInt64(aParamIndex, aParamValue);
 	}
 	
@@ -826,9 +810,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindReal(TInt aParamIndex, TReal aParamValue)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
-
 	return Impl().BindReal(aParamIndex, aParamValue);
 	}
 	
@@ -872,10 +853,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindText(TInt aParamIndex, const TDesC& aParamText)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntSizeParam, 
-			aParamIndex, aParamText.Length()));
-	
 	return Impl().BindText(aParamIndex, aParamText);
 	}
 	
@@ -917,10 +894,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindBinary(TInt aParamIndex, const TDesC8& aParamData)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntSizeParam, 
-			aParamIndex, aParamData.Length()));
-	
 	return Impl().BindBinary(aParamIndex, aParamData);
 	}
 	
@@ -969,10 +942,6 @@
 */	
 EXPORT_C TInt RSqlStatement::BindZeroBlob(TInt aParamIndex, TInt aBlobSize)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntSizeParam, 
-			aParamIndex, aBlobSize));
-	
 	return Impl().BindZeroBlob(aParamIndex, aBlobSize);
 	}
 
@@ -1005,9 +974,6 @@
 */	
 EXPORT_C TBool RSqlStatement::IsNull(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnType(aColumnIndex) == ESqlNull;
 	}
 
@@ -1035,9 +1001,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnInt(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnInt(aColumnIndex);
 	}
 	
@@ -1065,9 +1028,6 @@
 */	
 EXPORT_C TInt64 RSqlStatement::ColumnInt64(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnInt64(aColumnIndex);
 	}
 	
@@ -1095,9 +1055,6 @@
 */	
 EXPORT_C TReal RSqlStatement::ColumnReal(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnReal(aColumnIndex);
 	}
 
@@ -1140,9 +1097,6 @@
 */
 EXPORT_C TPtrC RSqlStatement::ColumnTextL(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	TPtrC res;
 	__SQLLEAVE_IF_ERROR(Impl().ColumnText(aColumnIndex, res));
 	return res;
@@ -1184,9 +1138,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnText(TInt aColumnIndex, TPtrC& aPtr) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnText(aColumnIndex, aPtr);
 	}
 	
@@ -1228,9 +1179,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnText(TInt aColumnIndex, TDes& aDest) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	return Impl().ColumnText(aColumnIndex, aDest);
 	}
 
@@ -1273,9 +1221,6 @@
 */
 EXPORT_C TPtrC8 RSqlStatement::ColumnBinaryL(TInt aColumnIndex) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
 	TPtrC8 res;
 	__SQLLEAVE_IF_ERROR(Impl().ColumnBinary(aColumnIndex, res));
 	return res;
@@ -1317,9 +1262,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnBinary(TInt aColumnIndex, TPtrC8& aPtr) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-
    	return Impl().ColumnBinary(aColumnIndex, aPtr);
 	}
 	
@@ -1361,9 +1303,6 @@
 */	
 EXPORT_C TInt RSqlStatement::ColumnBinary(TInt aColumnIndex, TDes8& aDest) const
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-	
    	return Impl().ColumnBinary(aColumnIndex, aDest);
 	}
 
@@ -1377,9 +1316,6 @@
 */
 EXPORT_C TInt RSqlStatement::ColumnName(TInt aColumnIndex, TPtrC& aNameDest)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
-	
 	return Impl().ColumnName(aColumnIndex, aNameDest);
 	}
 
@@ -1398,9 +1334,6 @@
 */
 EXPORT_C TInt RSqlStatement::ParameterName(TInt aParameterIndex, TPtrC& aNameDest)
 	{
-	SQLUTRACE_PROFILER(this);
-	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParameterIndex));
-	
 	return Impl().ParameterName(aParameterIndex, aNameDest);
 	}
 
@@ -1440,6 +1373,6 @@
 */
 CSqlStatementImpl& RSqlStatement::Impl() const
 	{
-	__SQLASSERT_ALWAYS(iImpl != NULL, ESqlPanicInvalidObj);
+	__ASSERT_ALWAYS(iImpl != NULL, __SQLPANIC(ESqlPanicInvalidObj));
 	return *iImpl;	
 	}