1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-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". |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #include "SqlPanic.h" //ESqlPanicInvalidObj, ESqlPanicObjExists |
16 #include "SqlAssert.h" //ESqlPanicInvalidObj, ESqlPanicObjExists |
17 #include "SqlDatabaseImpl.h" //CSqlDatabaseImpl |
17 #include "SqlDatabaseImpl.h" //CSqlDatabaseImpl |
|
18 #include "OstTraceDefinitions.h" |
|
19 #ifdef OST_TRACE_COMPILER_IN_USE |
|
20 #include "SqlScalarFullSelectTraces.h" |
|
21 #endif |
|
22 #include "SqlTraceDef.h" |
18 |
23 |
19 /** |
24 /** |
20 Returns a reference to the implementation object of RSqlDatabase - CSqlDatabaseImpl. |
25 Returns a reference to the implementation object of RSqlDatabase - CSqlDatabaseImpl. |
21 |
26 |
22 @panic SqlDb 2 Create() or Open() has not previously been called on this RSqlDatabase object. |
27 @panic SqlDb 2 Create() or Open() has not previously been called on this RSqlDatabase object. |
23 |
28 |
24 @internalComponent |
29 @internalComponent |
25 */ |
30 */ |
26 inline CSqlDatabaseImpl& TSqlScalarFullSelectQuery::Impl() const |
31 inline CSqlDatabaseImpl& TSqlScalarFullSelectQuery::Impl() const |
27 { |
32 { |
28 __SQLASSERT_ALWAYS(iDatabaseImpl != NULL, ESqlPanicInvalidObj); |
33 __ASSERT_ALWAYS(iDatabaseImpl != NULL, __SQLPANIC(ESqlPanicInvalidObj)); |
29 return *iDatabaseImpl; |
34 return *iDatabaseImpl; |
30 } |
35 } |
31 |
36 |
32 /** |
37 /** |
33 Initializes TSqlScalarFullSelectQuery data members with default values. |
38 Initializes TSqlScalarFullSelectQuery data members with default values. |
44 the database on which scalar fullselect queries will be executed. |
49 the database on which scalar fullselect queries will be executed. |
45 */ |
50 */ |
46 EXPORT_C TSqlScalarFullSelectQuery::TSqlScalarFullSelectQuery(RSqlDatabase& aDatabase) : |
51 EXPORT_C TSqlScalarFullSelectQuery::TSqlScalarFullSelectQuery(RSqlDatabase& aDatabase) : |
47 iDatabaseImpl(&aDatabase.Impl()) |
52 iDatabaseImpl(&aDatabase.Impl()) |
48 { |
53 { |
|
54 SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_TSQLSCALARFULLSELECTQUERY, "0x%X;TSqlScalarFullSelectQuery::TSqlScalarFullSelectQuery;aDatabase=0x%X;iDatabaseImpl=0x%X", (TUint)this, (TUint)&aDatabase, (TUint)iDatabaseImpl)); |
49 } |
55 } |
50 |
56 |
51 /** |
57 /** |
52 Initializes/reinitializes TSqlScalarFullSelectQuery object. |
58 Initializes/reinitializes TSqlScalarFullSelectQuery object. |
53 |
59 |
54 @param aDatabase A reference to the RSqlDatabase object that represents |
60 @param aDatabase A reference to the RSqlDatabase object that represents |
55 the database on which scalar fullselect queries will be executed. |
61 the database on which scalar fullselect queries will be executed. |
56 */ |
62 */ |
57 EXPORT_C void TSqlScalarFullSelectQuery::SetDatabase(RSqlDatabase& aDatabase) |
63 EXPORT_C void TSqlScalarFullSelectQuery::SetDatabase(RSqlDatabase& aDatabase) |
58 { |
64 { |
59 SQLUTRACE_PROFILER(this); |
|
60 iDatabaseImpl = &aDatabase.Impl(); |
65 iDatabaseImpl = &aDatabase.Impl(); |
|
66 SQL_TRACE_BORDER(OstTraceExt3(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SETDATABASE, "0x%X;TSqlScalarFullSelectQuery::SetDatabase;aDatabase=0x%X;iDatabaseImpl=0x%X", (TUint)this, (TUint)&aDatabase, (TUint)iDatabaseImpl)); |
61 } |
67 } |
62 |
68 |
63 /** |
69 /** |
64 Executes a SELECT query which is expected to return a single row consisting of |
70 Executes a SELECT query which is expected to return a single row consisting of |
65 a single 32-bit integer value and returns that value. |
71 a single 32-bit integer value and returns that value. |
72 The function may leave with database specific errors categorised as ESqlDbError and |
78 The function may leave with database specific errors categorised as ESqlDbError and |
73 other system-wide error codes. |
79 other system-wide error codes. |
74 */ |
80 */ |
75 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectIntL(const TDesC& aSqlStmt) |
81 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectIntL(const TDesC& aSqlStmt) |
76 { |
82 { |
77 SQLUTRACE_PROFILER(this); |
83 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINTL_ENTRY16, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectIntL-16;aSqlStmt=%S", (TUint)this, __SQLPRNSTR(aSqlStmt))); |
78 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aSqlStmt)); |
|
79 |
|
80 TInt res; |
84 TInt res; |
81 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
85 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
82 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt, ptr); |
86 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt, ptr); |
|
87 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINTL_EXIT16, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectIntL-16;res=%d", (TUint)this, res)); |
83 return res; |
88 return res; |
84 } |
89 } |
85 |
90 |
86 /** |
91 /** |
87 Executes a SELECT query which is expected to return a single row consisting of |
92 Executes a SELECT query which is expected to return a single row consisting of |
95 The function may leave with database specific errors categorised as ESqlDbError and |
100 The function may leave with database specific errors categorised as ESqlDbError and |
96 other system-wide error codes. |
101 other system-wide error codes. |
97 */ |
102 */ |
98 EXPORT_C TInt64 TSqlScalarFullSelectQuery::SelectInt64L(const TDesC& aSqlStmt) |
103 EXPORT_C TInt64 TSqlScalarFullSelectQuery::SelectInt64L(const TDesC& aSqlStmt) |
99 { |
104 { |
100 SQLUTRACE_PROFILER(this); |
105 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINT64L_ENTRY16, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectInt64L-16;aSqlStmt=%S", (TUint)this, __SQLPRNSTR(aSqlStmt))); |
101 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aSqlStmt)); |
|
102 |
|
103 TInt64 res; |
106 TInt64 res; |
104 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
107 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
105 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt64, ptr); |
108 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt64, ptr); |
|
109 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINT64L_EXIT16, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectInt64L-16;res=%lld", (TUint)this, res)); |
106 return res; |
110 return res; |
107 } |
111 } |
108 |
112 |
109 /** |
113 /** |
110 Executes a SELECT query which is expected to return a single row consisting of |
114 Executes a SELECT query which is expected to return a single row consisting of |
118 The function may leave with database specific errors categorised as ESqlDbError and |
122 The function may leave with database specific errors categorised as ESqlDbError and |
119 other system-wide error codes. |
123 other system-wide error codes. |
120 */ |
124 */ |
121 EXPORT_C TReal TSqlScalarFullSelectQuery::SelectRealL(const TDesC& aSqlStmt) |
125 EXPORT_C TReal TSqlScalarFullSelectQuery::SelectRealL(const TDesC& aSqlStmt) |
122 { |
126 { |
123 SQLUTRACE_PROFILER(this); |
127 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTREALL_ENTRY16, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectRealL-16;aSqlStmt=%S", (TUint)this, __SQLPRNSTR(aSqlStmt))); |
124 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aSqlStmt)); |
|
125 |
|
126 TReal res; |
128 TReal res; |
127 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
129 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
128 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlReal, ptr); |
130 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlReal, ptr); |
|
131 SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTREALL_EXIT16, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectRealL-16", (TUint)this)); |
129 return res; |
132 return res; |
130 } |
133 } |
131 |
134 |
132 /** |
135 /** |
133 Executes a SELECT query which is expected to return a single row consisting of |
136 Executes a SELECT query which is expected to return a single row consisting of |
147 The function may leave with database specific errors categorised as ESqlDbError and |
150 The function may leave with database specific errors categorised as ESqlDbError and |
148 other system-wide error codes. |
151 other system-wide error codes. |
149 */ |
152 */ |
150 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectTextL(const TDesC& aSqlStmt, TDes& aDest) |
153 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectTextL(const TDesC& aSqlStmt, TDes& aDest) |
151 { |
154 { |
152 SQLUTRACE_PROFILER(this); |
155 SQL_TRACE_BORDER(OstTraceExt5(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTTEXTL_ENTRY16, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectTextL-16;aSqlStmt=%S;aDest.Ptr()=0x%X;aDest.Size()=%d;aDest.MaxSize()=%d", (TUint)this, __SQLPRNSTR(aSqlStmt), (TUint)aDest.Ptr(), aDest.Size(), aDest.MaxSize())); |
153 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aSqlStmt)); |
|
154 |
|
155 TPtr8 ptr(reinterpret_cast <TUint8*> (const_cast <TUint16*> (aDest.Ptr())), aDest.MaxLength() * sizeof(TUint16)); |
156 TPtr8 ptr(reinterpret_cast <TUint8*> (const_cast <TUint16*> (aDest.Ptr())), aDest.MaxLength() * sizeof(TUint16)); |
156 TInt err = Impl().ExecScalarFullSelectL(aSqlStmt, ESqlText, ptr); |
157 TInt rc = Impl().ExecScalarFullSelectL(aSqlStmt, ESqlText, ptr); |
157 aDest.SetLength(ptr.Length() / sizeof(TUint16)); |
158 aDest.SetLength(ptr.Length() / sizeof(TUint16)); |
158 return err; |
159 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTTEXTL_EXIT16, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectTextL-16;rc=%d", (TUint)this, rc)); |
|
160 return rc; |
159 } |
161 } |
160 |
162 |
161 /** |
163 /** |
162 Executes a SELECT query which is expected to return a single row consisting of |
164 Executes a SELECT query which is expected to return a single row consisting of |
163 a single binary value and copies that value to the place refered by aDest parameter. |
165 a single binary value and copies that value to the place refered by aDest parameter. |
176 The function may leave with database specific errors categorised as ESqlDbError and |
178 The function may leave with database specific errors categorised as ESqlDbError and |
177 other system-wide error codes. |
179 other system-wide error codes. |
178 */ |
180 */ |
179 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectBinaryL(const TDesC& aSqlStmt, TDes8& aDest) |
181 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectBinaryL(const TDesC& aSqlStmt, TDes8& aDest) |
180 { |
182 { |
181 SQLUTRACE_PROFILER(this); |
183 SQL_TRACE_BORDER(OstTraceExt5(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTBINARYL_ENTRY16, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectBinaryL-16;aSqlStmt=%S;aDest.Ptr()=0x%X;aDest.Size()=%d;aDest.MaxSize()=%d", (TUint)this, __SQLPRNSTR(aSqlStmt), (TUint)aDest.Ptr(), aDest.Size(), aDest.MaxSize())); |
182 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam16, 1, &aSqlStmt)); |
184 TInt rc = Impl().ExecScalarFullSelectL(aSqlStmt, ESqlBinary, aDest); |
183 |
185 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTBINARYL_EXIT16, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectBinaryL-16;rc=%d", (TUint)this, rc)); |
184 return Impl().ExecScalarFullSelectL(aSqlStmt, ESqlBinary, aDest); |
186 return rc; |
185 } |
187 } |
186 |
188 |
187 /** |
189 /** |
188 Executes a SELECT query which is expected to return a single row consisting of |
190 Executes a SELECT query which is expected to return a single row consisting of |
189 a single 32-bit integer value and returns that value. |
191 a single 32-bit integer value and returns that value. |
196 The function may leave with database specific errors categorised as ESqlDbError and |
198 The function may leave with database specific errors categorised as ESqlDbError and |
197 other system-wide error codes. |
199 other system-wide error codes. |
198 */ |
200 */ |
199 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectIntL(const TDesC8& aSqlStmt) |
201 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectIntL(const TDesC8& aSqlStmt) |
200 { |
202 { |
201 SQLUTRACE_PROFILER(this); |
203 __SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf); |
202 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam, 1, &aSqlStmt)); |
204 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINTL_ENTRY8, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectIntL-8;aSqlStmt=%s", (TUint)this, __SQLPRNSTR8(aSqlStmt, des16prnbuf))); |
203 |
|
204 TInt res; |
205 TInt res; |
205 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
206 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
206 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt, ptr); |
207 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt, ptr); |
|
208 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINTL_EXIT8, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectIntL-8;res=%d", (TUint)this, res)); |
207 return res; |
209 return res; |
208 } |
210 } |
209 |
211 |
210 /** |
212 /** |
211 Executes a SELECT query which is expected to return a single row consisting of |
213 Executes a SELECT query which is expected to return a single row consisting of |
219 The function may leave with database specific errors categorised as ESqlDbError and |
221 The function may leave with database specific errors categorised as ESqlDbError and |
220 other system-wide error codes. |
222 other system-wide error codes. |
221 */ |
223 */ |
222 EXPORT_C TInt64 TSqlScalarFullSelectQuery::SelectInt64L(const TDesC8& aSqlStmt) |
224 EXPORT_C TInt64 TSqlScalarFullSelectQuery::SelectInt64L(const TDesC8& aSqlStmt) |
223 { |
225 { |
224 SQLUTRACE_PROFILER(this); |
226 __SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf); |
225 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam, 1, &aSqlStmt)); |
227 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINT64L_ENTRY8, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectInt64L-8;aSqlStmt=%s", (TUint)this, __SQLPRNSTR8(aSqlStmt, des16prnbuf))); |
226 |
|
227 TInt64 res; |
228 TInt64 res; |
228 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
229 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
229 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt64, ptr); |
230 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlInt64, ptr); |
|
231 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTINT64L_EXIT8, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectInt64L-8;res=%lld", (TUint)this, res)); |
230 return res; |
232 return res; |
231 } |
233 } |
232 |
234 |
233 /** |
235 /** |
234 Executes a SELECT query which is expected to return a single row consisting of |
236 Executes a SELECT query which is expected to return a single row consisting of |
242 The function may leave with database specific errors categorised as ESqlDbError and |
244 The function may leave with database specific errors categorised as ESqlDbError and |
243 other system-wide error codes. |
245 other system-wide error codes. |
244 */ |
246 */ |
245 EXPORT_C TReal TSqlScalarFullSelectQuery::SelectRealL(const TDesC8& aSqlStmt) |
247 EXPORT_C TReal TSqlScalarFullSelectQuery::SelectRealL(const TDesC8& aSqlStmt) |
246 { |
248 { |
247 SQLUTRACE_PROFILER(this); |
249 __SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf); |
248 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam, 1, &aSqlStmt)); |
250 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTREALL_ENTRY8, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectRealL-8;aSqlStmt=%s", (TUint)this, __SQLPRNSTR8(aSqlStmt, des16prnbuf))); |
249 |
|
250 TReal res; |
251 TReal res; |
251 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
252 TPtr8 ptr(reinterpret_cast <TUint8*> (&res), sizeof(res)); |
252 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlReal, ptr); |
253 (void)Impl().ExecScalarFullSelectL(aSqlStmt, ESqlReal, ptr); |
|
254 SQL_TRACE_BORDER(OstTrace1(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTREALL_EXIT8, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectRealL-8", (TUint)this)); |
253 return res; |
255 return res; |
254 } |
256 } |
255 |
257 |
256 /** |
258 /** |
257 Executes a SELECT query which is expected to return a single row consisting of |
259 Executes a SELECT query which is expected to return a single row consisting of |
271 The function may leave with database specific errors categorised as ESqlDbError and |
273 The function may leave with database specific errors categorised as ESqlDbError and |
272 other system-wide error codes. |
274 other system-wide error codes. |
273 */ |
275 */ |
274 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectTextL(const TDesC8& aSqlStmt, TDes& aDest) |
276 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectTextL(const TDesC8& aSqlStmt, TDes& aDest) |
275 { |
277 { |
276 SQLUTRACE_PROFILER(this); |
278 __SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf); |
277 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam, 1, &aSqlStmt)); |
279 SQL_TRACE_BORDER(OstTraceExt5(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTTEXTL_ENTRY8, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectTextL-8;aSqlStmt=%s;aDest.Ptr()=0x%X;aDest.Size()=%d;aDest.MaxSize()=%d", (TUint)this, __SQLPRNSTR8(aSqlStmt, des16prnbuf), (TUint)aDest.Ptr(), aDest.Size(), aDest.MaxSize())); |
278 |
|
279 TPtr8 ptr(reinterpret_cast <TUint8*> (const_cast <TUint16*> (aDest.Ptr())), aDest.MaxLength() * sizeof(TUint16)); |
280 TPtr8 ptr(reinterpret_cast <TUint8*> (const_cast <TUint16*> (aDest.Ptr())), aDest.MaxLength() * sizeof(TUint16)); |
280 TInt err = Impl().ExecScalarFullSelectL(aSqlStmt, ESqlText, ptr); |
281 TInt rc = Impl().ExecScalarFullSelectL(aSqlStmt, ESqlText, ptr); |
281 aDest.SetLength(ptr.Length() / sizeof(TUint16)); |
282 aDest.SetLength(ptr.Length() / sizeof(TUint16)); |
282 return err; |
283 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTTEXTL_EXIT8, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectTextL-8;rc=%d", (TUint)this, rc)); |
|
284 return rc; |
283 } |
285 } |
284 |
286 |
285 /** |
287 /** |
286 Executes a SELECT query which is expected to return a single row consisting of |
288 Executes a SELECT query which is expected to return a single row consisting of |
287 a single binary value and copies that value to the place refered by aDest parameter. |
289 a single binary value and copies that value to the place refered by aDest parameter. |
300 The function may leave with database specific errors categorised as ESqlDbError and |
302 The function may leave with database specific errors categorised as ESqlDbError and |
301 other system-wide error codes. |
303 other system-wide error codes. |
302 */ |
304 */ |
303 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectBinaryL(const TDesC8& aSqlStmt, TDes8& aDest) |
305 EXPORT_C TInt TSqlScalarFullSelectQuery::SelectBinaryL(const TDesC8& aSqlStmt, TDes8& aDest) |
304 { |
306 { |
305 SQLUTRACE_PROFILER(this); |
307 __SQLTRACE_BORDERVAR(TBuf<100> des16prnbuf); |
306 SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KStrParam, 1, &aSqlStmt)); |
308 SQL_TRACE_BORDER(OstTraceExt5(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTBINARYL_ENTRY8, "Entry;0x%X;TSqlScalarFullSelectQuery::SelectBinaryL-8;aSqlStmt=%s;aDest.Ptr()=0x%X;aDest.Size()=%d;aDest.MaxSize()=%d", (TUint)this, __SQLPRNSTR8(aSqlStmt, des16prnbuf), (TUint)aDest.Ptr(), aDest.Size(), aDest.MaxSize())); |
307 |
309 TInt rc = Impl().ExecScalarFullSelectL(aSqlStmt, ESqlBinary, aDest); |
308 return Impl().ExecScalarFullSelectL(aSqlStmt, ESqlBinary, aDest); |
310 SQL_TRACE_BORDER(OstTraceExt2(TRACE_BORDER, TSQLSCALARFULLSELECTQUERY_SELECTBINARYL_EXIT8, "Exit;0x%X;TSqlScalarFullSelectQuery::SelectBinaryL-8;rc=%d", (TUint)this, rc)); |
309 } |
311 return rc; |
|
312 } |