persistentstorage/sql/SRC/Client/SqlStatement.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2009 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".
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include "SqlStatementImpl.h"		//CSqlStatementImpl
    16 #include "SqlStatementImpl.h"		//CSqlStatementImpl
    17 #include "OstTraceDefinitions.h"
       
    18 #ifdef OST_TRACE_COMPILER_IN_USE
       
    19 #include "SqlStatementTraces.h"
       
    20 #endif
       
    21 #include "SqlTraceDef.h"
       
    22 
    17 
    23 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    18 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    24 
    19 
    25 /**
    20 /**
    26 Initialises the pointer to the implementation object to NULL.
    21 Initialises the pointer to the implementation object to NULL.
    82 @see RSqlBlobWriteStream
    77 @see RSqlBlobWriteStream
    83 @see TSqlBlob
    78 @see TSqlBlob
    84 */	
    79 */	
    85 EXPORT_C TInt RSqlStatement::Prepare(RSqlDatabase& aDatabase, const TDesC& aSqlStmt)
    80 EXPORT_C TInt RSqlStatement::Prepare(RSqlDatabase& aDatabase, const TDesC& aSqlStmt)
    86 	{
    81 	{
    87     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)));
    82 	SQLUTRACE_PROFILER(this);
    88 	TInt err = CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
    83 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam16, &aDatabase, &aSqlStmt));
    89     SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE16_EXIT, "Exit;0x%X;RSqlStatement::Prepare16;iImpl=0x%X;err=%d", (TUint)this, (TUint)iImpl, err));
    84 
    90 	return err;
    85 	return CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
    91 	}
    86 	}
    92 	
    87 	
    93 /**
    88 /**
    94 Prepares the supplied 8-bit SQL statement for execution.
    89 Prepares the supplied 8-bit SQL statement for execution.
    95 
    90 
   141 @see RSqlBlobWriteStream
   136 @see RSqlBlobWriteStream
   142 @see TSqlBlob
   137 @see TSqlBlob
   143 */	
   138 */	
   144 EXPORT_C TInt RSqlStatement::Prepare(RSqlDatabase& aDatabase, const TDesC8& aSqlStmt)
   139 EXPORT_C TInt RSqlStatement::Prepare(RSqlDatabase& aDatabase, const TDesC8& aSqlStmt)
   145 	{
   140 	{
   146 	__SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf);
   141 	SQLUTRACE_PROFILER(this);
   147     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)));
   142 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam, 
   148 	TInt err = CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
   143 			&aDatabase, &aSqlStmt));
   149     SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, RSQLSTATEMENT_PREPARE8_EXIT, "Exit;0x%X;RSqlStatement::Prepare8;iImpl=0x%X;err=%d", (TUint)this, (TUint)iImpl, err));
   144 	
   150 	return err;
   145 	return CSqlStatementImpl::New(iImpl, aDatabase.Impl(), aSqlStmt);
   151 	}
   146 	}
   152 
   147 
   153 /**
   148 /**
   154 Prepares the supplied 16-bit SQL statement for execution.
   149 Prepares the supplied 16-bit SQL statement for execution.
   155 
   150 
   199 @see RSqlBlobWriteStream
   194 @see RSqlBlobWriteStream
   200 @see TSqlBlob
   195 @see TSqlBlob
   201 */
   196 */
   202 EXPORT_C void RSqlStatement::PrepareL(RSqlDatabase& aDatabase, const TDesC& aSqlStmt)
   197 EXPORT_C void RSqlStatement::PrepareL(RSqlDatabase& aDatabase, const TDesC& aSqlStmt)
   203 	{
   198 	{
   204     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)));
   199 	SQLUTRACE_PROFILER(this);
       
   200 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam16, 
       
   201 			&aDatabase, &aSqlStmt));
       
   202 	
   205 	__SQLLEAVE_IF_ERROR(Prepare(aDatabase, aSqlStmt));
   203 	__SQLLEAVE_IF_ERROR(Prepare(aDatabase, aSqlStmt));
   206     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_PREPARE16L_EXIT, "Exit;0x%X;RSqlStatement::Prepare16L;iImpl=0x%X", (TUint)this, (TUint)iImpl));
       
   207 	}
   204 	}
   208 	
   205 	
   209 /**
   206 /**
   210 Prepares the supplied 8-bit SQL statement for execution.
   207 Prepares the supplied 8-bit SQL statement for execution.
   211 
   208 
   256 @see RSqlBlobWriteStream
   253 @see RSqlBlobWriteStream
   257 @see TSqlBlob
   254 @see TSqlBlob
   258 */
   255 */
   259 EXPORT_C void RSqlStatement::PrepareL(RSqlDatabase& aDatabase, const TDesC8& aSqlStmt)
   256 EXPORT_C void RSqlStatement::PrepareL(RSqlDatabase& aDatabase, const TDesC8& aSqlStmt)
   260 	{
   257 	{
   261 	__SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf);
   258 	SQLUTRACE_PROFILER(this);
   262     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)));
   259 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KHexStrParam, 
       
   260 			&aDatabase, &aSqlStmt));
       
   261 
   263 	__SQLLEAVE_IF_ERROR(Prepare(aDatabase, aSqlStmt));
   262 	__SQLLEAVE_IF_ERROR(Prepare(aDatabase, aSqlStmt));
   264     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_PREPARE8L_EXIT, "Exit;0x%X;RSqlStatement::Prepare8L;iImpl=0x%X", (TUint)this, (TUint)iImpl));
       
   265 	}
   263 	}
   266 
   264 
   267 
   265 
   268 /**
   266 /**
   269 Closes this SQL statement object.
   267 Closes this SQL statement object.
   274 
   272 
   275 @capability None
   273 @capability None
   276 */	
   274 */	
   277 EXPORT_C void RSqlStatement::Close()
   275 EXPORT_C void RSqlStatement::Close()
   278 	{
   276 	{
   279     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_CLOSE_ENTRY, "Entry;0x%X;RSqlStatement::Close;iImpl=0x%X", (TUint)this, (TUint)iImpl));
   277 	SQLUTRACE_PROFILER(this);
   280 	delete iImpl;
   278 	delete iImpl;
   281     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_CLOSE_EXIT, "Exit;0x%X;RSqlStatement::Close;iImpl=0x%X", (TUint)this, (TUint)iImpl));
       
   282 	iImpl = NULL;
   279 	iImpl = NULL;
   283 	}
   280 	}
   284 
   281 
   285 /**
   282 /**
   286 Tests whether the SQL statement points to a valid record.
   283 Tests whether the SQL statement points to a valid record.
   289 
   286 
   290 @capability None
   287 @capability None
   291 */
   288 */
   292 EXPORT_C TBool RSqlStatement::AtRow() const
   289 EXPORT_C TBool RSqlStatement::AtRow() const
   293 	{
   290 	{
       
   291 	SQLUTRACE_PROFILER(this);
   294 	return Impl().AtRow();
   292 	return Impl().AtRow();
   295 	}
   293 	}
   296 	
   294 	
   297 /**
   295 /**
   298 Resets the prepared SQL statement to its initial state and makes it ready to be
   296 Resets the prepared SQL statement to its initial state and makes it ready to be
   352 
   350 
   353 @capability None
   351 @capability None
   354 */	
   352 */	
   355 EXPORT_C TInt RSqlStatement::Reset()
   353 EXPORT_C TInt RSqlStatement::Reset()
   356 	{
   354 	{
   357     SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_RESET_ENTRY, "Entry;0x%X;RSqlStatement::Reset", (TUint)this));
   355 	SQLUTRACE_PROFILER(this);
   358 	TInt err = Impl().Reset();
   356 	return Impl().Reset();
   359     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_RESET_EXIT, "Exit;0x%X;RSqlStatement::Reset;err=%d", (TUint)this, err));
       
   360 	return err;
       
   361 	}
   357 	}
   362 	
   358 	
   363 /**
   359 /**
   364 Executes the prepared DDL/DML SQL statement. 
   360 Executes the prepared DDL/DML SQL statement. 
   365 
   361 
   414 
   410 
   415 @capability None
   411 @capability None
   416 */	
   412 */	
   417 EXPORT_C TInt RSqlStatement::Exec()
   413 EXPORT_C TInt RSqlStatement::Exec()
   418 	{
   414 	{
   419     SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_EXEC_ENTRY, "Entry;0x%X;RSqlStatement::Exec", (TUint)this));
   415 	SQLUTRACE_PROFILER(this);
   420 	TInt err = Impl().Exec();
   416 	return Impl().Exec();
   421     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_EXEC_EXIT, "Exit;0x%X;RSqlStatement::Exec;err=%d", (TUint)this, err));
       
   422 	return err;
       
   423 	}
   417 	}
   424 
   418 
   425 /**
   419 /**
   426 Executes the prepared DDL/DML SQL statement asynchronously to allow client to avoid being blocked 
   420 Executes the prepared DDL/DML SQL statement asynchronously to allow client to avoid being blocked 
   427 by server activity.
   421 by server activity.
   467 
   461 
   468 @capability None
   462 @capability None
   469 */	
   463 */	
   470 EXPORT_C void RSqlStatement::Exec(TRequestStatus& aStatus)
   464 EXPORT_C void RSqlStatement::Exec(TRequestStatus& aStatus)
   471 	{
   465 	{
   472     SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_EXECASYNC_ENTRY, "Entry;0x%X;RSqlStatement::ExecAsync", (TUint)this));
   466 	SQLUTRACE_PROFILER(this);
   473 	Impl().Exec(aStatus);
   467 	Impl().Exec(aStatus);
   474     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_EXECASYNC_EXIT, "Exit;0x%X;RSqlStatement::ExecAsync;aStatus.Int()=%d", (TUint)this, aStatus.Int()));
       
   475 	}
   468 	}
   476 	
   469 	
   477 /**
   470 /**
   478 Retrieves a record.
   471 Retrieves a record.
   479 
   472 
   518 
   511 
   519 @capability None
   512 @capability None
   520 */	
   513 */	
   521 EXPORT_C TInt RSqlStatement::Next()
   514 EXPORT_C TInt RSqlStatement::Next()
   522 	{
   515 	{
   523     SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, RSQLSTATEMENT_NEXT_ENTRY, "Entry;0x%X;RSqlStatement::Next", (TUint)this));
   516 	SQLUTRACE_PROFILER(this);
   524 	TInt err = Impl().Next();
   517 	return Impl().Next();
   525     SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, RSQLSTATEMENT_NEXT_EXIT, "Exit;0x%X;RSqlStatement::Next;err=%d", (TUint)this, err));
       
   526 	return err;
       
   527 	}
   518 	}
   528 
   519 
   529 /**
   520 /**
   530 Gets the index (starting from 0) of the parameter with the given name.
   521 Gets the index (starting from 0) of the parameter with the given name.
   531 
   522 
   544 
   535 
   545 @capability None
   536 @capability None
   546 */	
   537 */	
   547 EXPORT_C TInt RSqlStatement::ParameterIndex(const TDesC& aParameterName) const
   538 EXPORT_C TInt RSqlStatement::ParameterIndex(const TDesC& aParameterName) const
   548 	{
   539 	{
       
   540 	SQLUTRACE_PROFILER(this);
       
   541 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aParameterName));
       
   542 
   549 	return Impl().ParamIndex(aParameterName);
   543 	return Impl().ParamIndex(aParameterName);
   550 	}
   544 	}
   551 
   545 
   552 /**
   546 /**
   553 Gets the number of columns that are to be returned by this SQL statement.
   547 Gets the number of columns that are to be returned by this SQL statement.
   559 
   553 
   560 @capability None
   554 @capability None
   561 */	
   555 */	
   562 EXPORT_C TInt RSqlStatement::ColumnCount() const
   556 EXPORT_C TInt RSqlStatement::ColumnCount() const
   563 	{
   557 	{
       
   558 	SQLUTRACE_PROFILER(this);
   564 	return Impl().ColumnCount();
   559 	return Impl().ColumnCount();
   565 	}
   560 	}
   566 	
   561 	
   567 /**
   562 /**
   568 Gets the index (starting from 0) of the column with the given name.
   563 Gets the index (starting from 0) of the column with the given name.
   579 
   574 
   580 @capability None
   575 @capability None
   581 */	
   576 */	
   582 EXPORT_C TInt RSqlStatement::ColumnIndex(const TDesC& aColumnName) const
   577 EXPORT_C TInt RSqlStatement::ColumnIndex(const TDesC& aColumnName) const
   583 	{
   578 	{
       
   579 	SQLUTRACE_PROFILER(this);
       
   580 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aColumnName));
       
   581 
   584 	return Impl().ColumnIndex(aColumnName);
   582 	return Impl().ColumnIndex(aColumnName);
   585 	}
   583 	}
   586 	
   584 	
   587 /**
   585 /**
   588 Gets the runtime type of the column identified by the specified column index.
   586 Gets the runtime type of the column identified by the specified column index.
   609 
   607 
   610 @capability None
   608 @capability None
   611 */	
   609 */	
   612 EXPORT_C TSqlColumnType RSqlStatement::ColumnType(TInt aColumnIndex) const
   610 EXPORT_C TSqlColumnType RSqlStatement::ColumnType(TInt aColumnIndex) const
   613 	{
   611 	{
       
   612 	SQLUTRACE_PROFILER(this);
       
   613 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
   614 
   614 	return Impl().ColumnType(aColumnIndex);
   615 	return Impl().ColumnType(aColumnIndex);
   615 	}
   616 	}
   616 
   617 
   617 /**
   618 /**
   618 Gets the declared type of the column identified by the specified column index.
   619 Gets the declared type of the column identified by the specified column index.
   647 
   648 
   648 @capability None
   649 @capability None
   649 */	
   650 */	
   650 EXPORT_C TInt RSqlStatement::DeclaredColumnType(TInt aColumnIndex, TSqlColumnType& aColumnType) const
   651 EXPORT_C TInt RSqlStatement::DeclaredColumnType(TInt aColumnIndex, TSqlColumnType& aColumnType) const
   651 	{
   652 	{
       
   653 	SQLUTRACE_PROFILER(this);
       
   654 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
   655 
   652 	return Impl().DeclaredColumnType(aColumnIndex, aColumnType);
   656 	return Impl().DeclaredColumnType(aColumnIndex, aColumnType);
   653 	}
   657 	}
   654 	
   658 	
   655 	
   659 	
   656 	
   660 	
   694 
   698 
   695 @capability None
   699 @capability None
   696 */	
   700 */	
   697 EXPORT_C TInt RSqlStatement::ColumnSize(TInt aColumnIndex) const
   701 EXPORT_C TInt RSqlStatement::ColumnSize(TInt aColumnIndex) const
   698 	{
   702 	{
       
   703 	SQLUTRACE_PROFILER(this);
       
   704 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
   705 
   699 	return Impl().ColumnSize(aColumnIndex);
   706 	return Impl().ColumnSize(aColumnIndex);
   700 	}
   707 	}
   701 
   708 
   702 ////////////////////////////////////////////////////////////////////////////////////////////////////////
   709 ////////////////////////////////////////////////////////////////////////////////////////////////////////
   703 ///////////////////////////          Bind<Type>() implemenations           /////////////////////////////
   710 ///////////////////////////          Bind<Type>() implemenations           /////////////////////////////
   724 
   731 
   725 @capability None
   732 @capability None
   726 */	
   733 */	
   727 EXPORT_C TInt RSqlStatement::BindNull(TInt aParamIndex)
   734 EXPORT_C TInt RSqlStatement::BindNull(TInt aParamIndex)
   728 	{
   735 	{
       
   736 	SQLUTRACE_PROFILER(this);
       
   737 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
       
   738 	
   729 	return Impl().BindNull(aParamIndex);
   739 	return Impl().BindNull(aParamIndex);
   730 	}
   740 	}
   731 	
   741 	
   732 /**
   742 /**
   733 Sets the parameter to the specified 32-bit integer value.
   743 Sets the parameter to the specified 32-bit integer value.
   752 
   762 
   753 @capability None
   763 @capability None
   754 */	
   764 */	
   755 EXPORT_C TInt RSqlStatement::BindInt(TInt aParamIndex, TInt aParamValue)
   765 EXPORT_C TInt RSqlStatement::BindInt(TInt aParamIndex, TInt aParamValue)
   756 	{
   766 	{
       
   767 	SQLUTRACE_PROFILER(this);
       
   768 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
       
   769 	
   757 	return Impl().BindInt(aParamIndex, aParamValue);
   770 	return Impl().BindInt(aParamIndex, aParamValue);
   758 	}
   771 	}
   759 	
   772 	
   760 /**
   773 /**
   761 Sets the parameter to the specified 64-bit integer value.
   774 Sets the parameter to the specified 64-bit integer value.
   780 
   793 
   781 @capability None
   794 @capability None
   782 */	
   795 */	
   783 EXPORT_C TInt RSqlStatement::BindInt64(TInt aParamIndex, TInt64 aParamValue)
   796 EXPORT_C TInt RSqlStatement::BindInt64(TInt aParamIndex, TInt64 aParamValue)
   784 	{
   797 	{
       
   798 	SQLUTRACE_PROFILER(this);
       
   799 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
       
   800 	
   785 	return Impl().BindInt64(aParamIndex, aParamValue);
   801 	return Impl().BindInt64(aParamIndex, aParamValue);
   786 	}
   802 	}
   787 	
   803 	
   788 /**
   804 /**
   789 Sets the parameter to the specified 64-bit floating point value.
   805 Sets the parameter to the specified 64-bit floating point value.
   808 
   824 
   809 @capability None
   825 @capability None
   810 */	
   826 */	
   811 EXPORT_C TInt RSqlStatement::BindReal(TInt aParamIndex, TReal aParamValue)
   827 EXPORT_C TInt RSqlStatement::BindReal(TInt aParamIndex, TReal aParamValue)
   812 	{
   828 	{
       
   829 	SQLUTRACE_PROFILER(this);
       
   830 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParamIndex));
       
   831 
   813 	return Impl().BindReal(aParamIndex, aParamValue);
   832 	return Impl().BindReal(aParamIndex, aParamValue);
   814 	}
   833 	}
   815 	
   834 	
   816 /**
   835 /**
   817 Sets the parameter to the specified 16-bit descriptor.
   836 Sets the parameter to the specified 16-bit descriptor.
   851 
   870 
   852 @capability None
   871 @capability None
   853 */	
   872 */	
   854 EXPORT_C TInt RSqlStatement::BindText(TInt aParamIndex, const TDesC& aParamText)
   873 EXPORT_C TInt RSqlStatement::BindText(TInt aParamIndex, const TDesC& aParamText)
   855 	{
   874 	{
       
   875 	SQLUTRACE_PROFILER(this);
       
   876 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntSizeParam, 
       
   877 			aParamIndex, aParamText.Length()));
       
   878 	
   856 	return Impl().BindText(aParamIndex, aParamText);
   879 	return Impl().BindText(aParamIndex, aParamText);
   857 	}
   880 	}
   858 	
   881 	
   859 /**
   882 /**
   860 Sets the parameter to the specified 8-bit descriptor.
   883 Sets the parameter to the specified 8-bit descriptor.
   892 
   915 
   893 @capability None
   916 @capability None
   894 */	
   917 */	
   895 EXPORT_C TInt RSqlStatement::BindBinary(TInt aParamIndex, const TDesC8& aParamData)
   918 EXPORT_C TInt RSqlStatement::BindBinary(TInt aParamIndex, const TDesC8& aParamData)
   896 	{
   919 	{
       
   920 	SQLUTRACE_PROFILER(this);
       
   921 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntSizeParam, 
       
   922 			aParamIndex, aParamData.Length()));
       
   923 	
   897 	return Impl().BindBinary(aParamIndex, aParamData);
   924 	return Impl().BindBinary(aParamIndex, aParamData);
   898 	}
   925 	}
   899 	
   926 	
   900 /**
   927 /**
   901 Binds a blob of length aBlobSize bytes that is filled with zeroes.
   928 Binds a blob of length aBlobSize bytes that is filled with zeroes.
   940 
   967 
   941 @capability None
   968 @capability None
   942 */	
   969 */	
   943 EXPORT_C TInt RSqlStatement::BindZeroBlob(TInt aParamIndex, TInt aBlobSize)
   970 EXPORT_C TInt RSqlStatement::BindZeroBlob(TInt aParamIndex, TInt aBlobSize)
   944 	{
   971 	{
       
   972 	SQLUTRACE_PROFILER(this);
       
   973 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntSizeParam, 
       
   974 			aParamIndex, aBlobSize));
       
   975 	
   945 	return Impl().BindZeroBlob(aParamIndex, aBlobSize);
   976 	return Impl().BindZeroBlob(aParamIndex, aBlobSize);
   946 	}
   977 	}
   947 
   978 
   948 
   979 
   949 ////////////////////////////////////////////////////////////////////////////////////////////////////////
   980 ////////////////////////////////////////////////////////////////////////////////////////////////////////
   972 
  1003 
   973 @capability None
  1004 @capability None
   974 */	
  1005 */	
   975 EXPORT_C TBool RSqlStatement::IsNull(TInt aColumnIndex) const
  1006 EXPORT_C TBool RSqlStatement::IsNull(TInt aColumnIndex) const
   976 	{
  1007 	{
       
  1008 	SQLUTRACE_PROFILER(this);
       
  1009 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1010 
   977 	return Impl().ColumnType(aColumnIndex) == ESqlNull;
  1011 	return Impl().ColumnType(aColumnIndex) == ESqlNull;
   978 	}
  1012 	}
   979 
  1013 
   980 /**
  1014 /**
   981 Gets the value of the column as a 32-bit integer.
  1015 Gets the value of the column as a 32-bit integer.
   999 
  1033 
  1000 @capability None
  1034 @capability None
  1001 */	
  1035 */	
  1002 EXPORT_C TInt RSqlStatement::ColumnInt(TInt aColumnIndex) const
  1036 EXPORT_C TInt RSqlStatement::ColumnInt(TInt aColumnIndex) const
  1003 	{
  1037 	{
       
  1038 	SQLUTRACE_PROFILER(this);
       
  1039 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1040 
  1004 	return Impl().ColumnInt(aColumnIndex);
  1041 	return Impl().ColumnInt(aColumnIndex);
  1005 	}
  1042 	}
  1006 	
  1043 	
  1007 /**
  1044 /**
  1008 Gets the value of the column as a 64-bit integer.
  1045 Gets the value of the column as a 64-bit integer.
  1026 
  1063 
  1027 @capability None
  1064 @capability None
  1028 */	
  1065 */	
  1029 EXPORT_C TInt64 RSqlStatement::ColumnInt64(TInt aColumnIndex) const
  1066 EXPORT_C TInt64 RSqlStatement::ColumnInt64(TInt aColumnIndex) const
  1030 	{
  1067 	{
       
  1068 	SQLUTRACE_PROFILER(this);
       
  1069 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1070 
  1031 	return Impl().ColumnInt64(aColumnIndex);
  1071 	return Impl().ColumnInt64(aColumnIndex);
  1032 	}
  1072 	}
  1033 	
  1073 	
  1034 /**
  1074 /**
  1035 Gets the value of the column as a 64-bit floating point value.
  1075 Gets the value of the column as a 64-bit floating point value.
  1053 
  1093 
  1054 @capability None
  1094 @capability None
  1055 */	
  1095 */	
  1056 EXPORT_C TReal RSqlStatement::ColumnReal(TInt aColumnIndex) const
  1096 EXPORT_C TReal RSqlStatement::ColumnReal(TInt aColumnIndex) const
  1057 	{
  1097 	{
       
  1098 	SQLUTRACE_PROFILER(this);
       
  1099 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1100 
  1058 	return Impl().ColumnReal(aColumnIndex);
  1101 	return Impl().ColumnReal(aColumnIndex);
  1059 	}
  1102 	}
  1060 
  1103 
  1061 ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1104 ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1062 ///////////////////////////          ColumnText ()           ///////////////////////////////////////////
  1105 ///////////////////////////          ColumnText ()           ///////////////////////////////////////////
  1095 
  1138 
  1096 @capability None
  1139 @capability None
  1097 */
  1140 */
  1098 EXPORT_C TPtrC RSqlStatement::ColumnTextL(TInt aColumnIndex) const
  1141 EXPORT_C TPtrC RSqlStatement::ColumnTextL(TInt aColumnIndex) const
  1099 	{
  1142 	{
       
  1143 	SQLUTRACE_PROFILER(this);
       
  1144 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1145 
  1100 	TPtrC res;
  1146 	TPtrC res;
  1101 	__SQLLEAVE_IF_ERROR(Impl().ColumnText(aColumnIndex, res));
  1147 	__SQLLEAVE_IF_ERROR(Impl().ColumnText(aColumnIndex, res));
  1102 	return res;
  1148 	return res;
  1103 	}
  1149 	}
  1104 
  1150 
  1136 
  1182 
  1137 @capability None
  1183 @capability None
  1138 */	
  1184 */	
  1139 EXPORT_C TInt RSqlStatement::ColumnText(TInt aColumnIndex, TPtrC& aPtr) const
  1185 EXPORT_C TInt RSqlStatement::ColumnText(TInt aColumnIndex, TPtrC& aPtr) const
  1140 	{
  1186 	{
       
  1187 	SQLUTRACE_PROFILER(this);
       
  1188 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1189 
  1141 	return Impl().ColumnText(aColumnIndex, aPtr);
  1190 	return Impl().ColumnText(aColumnIndex, aPtr);
  1142 	}
  1191 	}
  1143 	
  1192 	
  1144 /**
  1193 /**
  1145 Interprets the value of the column as a 16-bit descriptor, and copies the data
  1194 Interprets the value of the column as a 16-bit descriptor, and copies the data
  1177 
  1226 
  1178 @capability None
  1227 @capability None
  1179 */	
  1228 */	
  1180 EXPORT_C TInt RSqlStatement::ColumnText(TInt aColumnIndex, TDes& aDest) const
  1229 EXPORT_C TInt RSqlStatement::ColumnText(TInt aColumnIndex, TDes& aDest) const
  1181 	{
  1230 	{
       
  1231 	SQLUTRACE_PROFILER(this);
       
  1232 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1233 
  1182 	return Impl().ColumnText(aColumnIndex, aDest);
  1234 	return Impl().ColumnText(aColumnIndex, aDest);
  1183 	}
  1235 	}
  1184 
  1236 
  1185 ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1237 ////////////////////////////////////////////////////////////////////////////////////////////////////////
  1186 ///////////////////////////          ColumnBinary ()           /////////////////////////////////////////
  1238 ///////////////////////////          ColumnBinary ()           /////////////////////////////////////////
  1219 
  1271 
  1220 @capability None
  1272 @capability None
  1221 */
  1273 */
  1222 EXPORT_C TPtrC8 RSqlStatement::ColumnBinaryL(TInt aColumnIndex) const
  1274 EXPORT_C TPtrC8 RSqlStatement::ColumnBinaryL(TInt aColumnIndex) const
  1223 	{
  1275 	{
       
  1276 	SQLUTRACE_PROFILER(this);
       
  1277 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1278 
  1224 	TPtrC8 res;
  1279 	TPtrC8 res;
  1225 	__SQLLEAVE_IF_ERROR(Impl().ColumnBinary(aColumnIndex, res));
  1280 	__SQLLEAVE_IF_ERROR(Impl().ColumnBinary(aColumnIndex, res));
  1226 	return res;
  1281 	return res;
  1227 	}
  1282 	}
  1228 
  1283 
  1260 
  1315 
  1261 @capability None
  1316 @capability None
  1262 */	
  1317 */	
  1263 EXPORT_C TInt RSqlStatement::ColumnBinary(TInt aColumnIndex, TPtrC8& aPtr) const
  1318 EXPORT_C TInt RSqlStatement::ColumnBinary(TInt aColumnIndex, TPtrC8& aPtr) const
  1264 	{
  1319 	{
       
  1320 	SQLUTRACE_PROFILER(this);
       
  1321 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1322 
  1265    	return Impl().ColumnBinary(aColumnIndex, aPtr);
  1323    	return Impl().ColumnBinary(aColumnIndex, aPtr);
  1266 	}
  1324 	}
  1267 	
  1325 	
  1268 /**
  1326 /**
  1269 Interprets the value of the column as an 8-bit descriptor, and copies the data
  1327 Interprets the value of the column as an 8-bit descriptor, and copies the data
  1301 
  1359 
  1302 @capability None
  1360 @capability None
  1303 */	
  1361 */	
  1304 EXPORT_C TInt RSqlStatement::ColumnBinary(TInt aColumnIndex, TDes8& aDest) const
  1362 EXPORT_C TInt RSqlStatement::ColumnBinary(TInt aColumnIndex, TDes8& aDest) const
  1305 	{
  1363 	{
       
  1364 	SQLUTRACE_PROFILER(this);
       
  1365 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1366 	
  1306    	return Impl().ColumnBinary(aColumnIndex, aDest);
  1367    	return Impl().ColumnBinary(aColumnIndex, aDest);
  1307 	}
  1368 	}
  1308 
  1369 
  1309 /**
  1370 /**
  1310 Obtain the name of a column after preparing a query.
  1371 Obtain the name of a column after preparing a query.
  1314 @return KErrNone if successfull or one of the system-wide error codes on error
  1375 @return KErrNone if successfull or one of the system-wide error codes on error
  1315 @capability None
  1376 @capability None
  1316 */
  1377 */
  1317 EXPORT_C TInt RSqlStatement::ColumnName(TInt aColumnIndex, TPtrC& aNameDest)
  1378 EXPORT_C TInt RSqlStatement::ColumnName(TInt aColumnIndex, TPtrC& aNameDest)
  1318 	{
  1379 	{
       
  1380 	SQLUTRACE_PROFILER(this);
       
  1381 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aColumnIndex));
       
  1382 	
  1319 	return Impl().ColumnName(aColumnIndex, aNameDest);
  1383 	return Impl().ColumnName(aColumnIndex, aNameDest);
  1320 	}
  1384 	}
  1321 
  1385 
  1322 /**
  1386 /**
  1323 Obtain the name of a parameter after preparing a DML query.
  1387 Obtain the name of a parameter after preparing a DML query.
  1332 @return KErrNone if successfull or one of the system-wide error codes on error
  1396 @return KErrNone if successfull or one of the system-wide error codes on error
  1333 @capability None
  1397 @capability None
  1334 */
  1398 */
  1335 EXPORT_C TInt RSqlStatement::ParameterName(TInt aParameterIndex, TPtrC& aNameDest)
  1399 EXPORT_C TInt RSqlStatement::ParameterName(TInt aParameterIndex, TPtrC& aNameDest)
  1336 	{
  1400 	{
       
  1401 	SQLUTRACE_PROFILER(this);
       
  1402 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KIntParam, 1, aParameterIndex));
       
  1403 	
  1337 	return Impl().ParameterName(aParameterIndex, aNameDest);
  1404 	return Impl().ParameterName(aParameterIndex, aNameDest);
  1338 	}
  1405 	}
  1339 
  1406 
  1340 /**
  1407 /**
  1341 Obtain the name of a parameter after preparing a DML query.
  1408 Obtain the name of a parameter after preparing a DML query.
  1371 
  1438 
  1372 @internalComponent
  1439 @internalComponent
  1373 */
  1440 */
  1374 CSqlStatementImpl& RSqlStatement::Impl() const
  1441 CSqlStatementImpl& RSqlStatement::Impl() const
  1375 	{
  1442 	{
  1376 	__ASSERT_ALWAYS(iImpl != NULL, __SQLPANIC(ESqlPanicInvalidObj));
  1443 	__SQLASSERT_ALWAYS(iImpl != NULL, ESqlPanicInvalidObj);
  1377 	return *iImpl;	
  1444 	return *iImpl;	
  1378 	}
  1445 	}