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