1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32std.h> |
|
17 |
|
18 //The file is used only to compile and include in the executable server image only a single |
|
19 //copy of the trace strings. |
|
20 #define __SQLTRACE_STRINGS__ |
|
21 #include "UTraceSql.h" |
|
22 |
|
23 #ifdef SYMBIAN_TRACE_SQL_EVENTS |
|
24 |
|
25 /** |
|
26 Get the corresponding string to the IPC function from the TSqlSrvFunction enum |
|
27 |
|
28 @param aFunction Function code |
|
29 |
|
30 @return A pointer to the string literal associated with the TSqlSrvFunction enum identifiers |
|
31 |
|
32 @internalComponent |
|
33 */ |
|
34 const TPtrC8 GetIPCFuncStr(TInt aFunction) |
|
35 { |
|
36 TInt function = aFunction & 0xFF; |
|
37 |
|
38 //Array of Sql Server's IPC functions.This should map to TSqlSrvFunction |
|
39 const TText8* const KSrvFunctionStr[] = |
|
40 { |
|
41 //Test functions |
|
42 _S8("ESqlSrvTestBase"), //0x00 |
|
43 _S8("ESqlSrvResourceMark"), //0x01 |
|
44 _S8("ESqlSrvResourceCheck"), //0x02 |
|
45 _S8("ESqlSrvResourceCount"), //0x03 |
|
46 _S8("ESqlSrvSetDbHeapFailure"), //0x04 |
|
47 _S8("ESqlSrvSetHeapFailure"), //0x05 |
|
48 |
|
49 //Profiling functions |
|
50 _S8("ESqlSrvProfilerStart"), //0x06 |
|
51 _S8("ESqlSrvProfilerStop"), //0x07 |
|
52 _S8("ESqlSrvProfilerReset"), //0x08 |
|
53 _S8("ESqlSrvProfilerSetRange"), //0x09 |
|
54 _S8("ESqlSrvProfilerQuery"), //0x0A |
|
55 |
|
56 //Not Used |
|
57 _S8(""), //0x0B |
|
58 _S8(""), //0x0C |
|
59 _S8(""), //0x0D |
|
60 _S8(""), //0x0E |
|
61 _S8(""), //0x0F |
|
62 |
|
63 //Database functions |
|
64 _S8("ESqlSrvDbBase"), //0x10 |
|
65 _S8("ESqlSrvDbCreate"), //0x11 |
|
66 _S8("ESqlSrvDbCreateSecure"), //0x12 |
|
67 _S8("ESqlSrvDbOpen"), //0x13 |
|
68 _S8("ESqlSrvDbOpenFromHandle"), //0x14 |
|
69 _S8("ESqlSrvDbClose"), //0x15 |
|
70 _S8("ESqlSrvDbCopy"), //0x16 |
|
71 _S8("ESqlSrvDbDelete"), //0x17 |
|
72 |
|
73 //All operations with opcode > ESqlSrvDbDelete require valid database object (on the server side) |
|
74 _S8("ESqlSrvLastErrorMsg"), //0x18 |
|
75 _S8("ESqlSrvDbExec8"), //0x19 |
|
76 _S8("ESqlSrvDbExec16"), //0x1A |
|
77 _S8("ESqlSrvDbRowIdExec16"), //0x1B |
|
78 _S8("ESqlSrvDbSetIsolationLevel"), //0x1C |
|
79 _S8("ESqlSrvDbGetSecurityPolicy"), //0x1D |
|
80 _S8("ESqlSrvDbAttach"), //0x1E |
|
81 _S8("ESqlSrvDbAttachFromHandle"), //0x1F |
|
82 _S8("ESqlSrvDbDetach"), //0x20 |
|
83 _S8("ESqlSrvDbScalarFullSelect8"), //0x21 |
|
84 _S8("ESqlSrvDbScalarFullSelect16"), //0x22 |
|
85 _S8("ESqlSrvDbInTransaction"), //0x23 |
|
86 _S8("ESqlSrvDbSize"), //0x24 |
|
87 _S8("ESqlSrvDbSize2"), //0x25 |
|
88 _S8("ESqlSrvDbBlobSource"), //0x26 |
|
89 _S8("ESqlSrvDbLastInsertedRowId"), //0x27 |
|
90 _S8("ESqlSrvDbCompact"), //0x28 |
|
91 |
|
92 //Database - reserved drive space management |
|
93 _S8("ESqlSrvDbReserveDriveSpace"), //0x29 |
|
94 _S8("ESqlSrvDbFreeReservedSpace"), //0x2A |
|
95 _S8("ESqlSrvDbGetReserveAccess"), //0x2B |
|
96 _S8("ESqlSrvDbReleaseReserveAccess"), //0x2C |
|
97 |
|
98 //Not Used |
|
99 _S8(""), //0x2D |
|
100 _S8(""), //0x2E |
|
101 _S8(""), //0x2F |
|
102 _S8(""), //0x30 |
|
103 _S8(""), //0x31 |
|
104 _S8(""), //0x32 |
|
105 _S8(""), //0x33 |
|
106 _S8(""), //0x34 |
|
107 _S8(""), //0x35 |
|
108 _S8(""), //0x36 |
|
109 _S8(""), //0x37 |
|
110 _S8(""), //0x38 |
|
111 _S8(""), //0x39 |
|
112 _S8(""), //0x3A |
|
113 _S8(""), //0x3B |
|
114 _S8(""), //0x3C |
|
115 _S8(""), //0x3D |
|
116 _S8(""), //0x3E |
|
117 _S8(""), //0x3F |
|
118 _S8(""), //0x40 |
|
119 _S8(""), //0x41 |
|
120 _S8(""), //0x42 |
|
121 _S8(""), //0x43 |
|
122 _S8(""), //0x44 |
|
123 _S8(""), //0x45 |
|
124 _S8(""), //0x46 |
|
125 _S8(""), //0x47 |
|
126 _S8(""), //0x48 |
|
127 _S8(""), //0x49 |
|
128 _S8(""), //0x4A |
|
129 _S8(""), //0x4B |
|
130 _S8(""), //0x4C |
|
131 _S8(""), //0x4D |
|
132 _S8(""), //0x4E |
|
133 _S8(""), //0x4F |
|
134 |
|
135 //Statement functions |
|
136 _S8("ESqlSrvStmtBase"), //0x50 |
|
137 _S8("ESqlSrvStmtPrepare8"), //0x51 |
|
138 _S8("ESqlSrvStmtPrepare16"), //0x52 |
|
139 _S8("ESqlSrvStmtClose"), //0x53 |
|
140 _S8("ESqlSrvStmtReset"), //0x54 |
|
141 _S8("ESqlSrvStmtExec"), //0x55 |
|
142 _S8("ESqlSrvStmtAsyncExec"), //0x56 |
|
143 _S8("ESqlSrvStmtBindExec"), //0x57 |
|
144 _S8("ESqlSrvStmtBindExecRowId"), //0x58 |
|
145 _S8("ESqlSrvStmtAsyncBindExec"), //0x59 |
|
146 _S8("ESqlSrvStmtNext"), //0x5A |
|
147 _S8("ESqlSrvStmtBindNext"), //0x5B |
|
148 _S8("ESqlSrvStmtColumnNames"), //0x5C |
|
149 _S8("ESqlSrvStmtParamNames"), //0x5D |
|
150 _S8("ESqlSrvStmtColumnSource"), //0x5E |
|
151 _S8("ESqlSrvStmtBinParamSink"), //0x5F |
|
152 _S8("ESqlSrvStmtTxtParamSink8"), //0x60 |
|
153 _S8("ESqlSrvStmtTxtParamSink16"), //0x61 |
|
154 _S8("ESqlSrvStmtBufFlat"), //0x62 |
|
155 _S8("ESqlSrvStmtColumnValue"), //0x63 |
|
156 _S8("ESqlSrvStmtDeclColumnTypes"), //0x64 |
|
157 _S8("ESqlSrvStmtEvaluateAll"), //0x65 |
|
158 _S8("ESqlSrvStmtGoto"), //0x66 |
|
159 |
|
160 //Not Used |
|
161 _S8(""), //0x67 |
|
162 _S8(""), //0x68 |
|
163 _S8(""), //0x69 |
|
164 _S8(""), //0x6A |
|
165 _S8(""), //0x6B |
|
166 _S8(""), //0x6C |
|
167 _S8(""), //0x6D |
|
168 _S8(""), //0x6E |
|
169 _S8(""), //0x6F |
|
170 |
|
171 //Stream functions |
|
172 _S8("ESqlSrvStreamBase"), //0x70 |
|
173 _S8("ESqlSrvStreamRead"), //0x71 |
|
174 _S8("ESqlSrvStreamWrite"), //0x72 |
|
175 _S8("ESqlSrvStreamSize"), //0x73 |
|
176 _S8("ESqlSrvStreamSynch"), //0x74 |
|
177 _S8("ESqlSrvStreamClose") //0x75 |
|
178 }; |
|
179 |
|
180 const TInt KMaxSrvFunctions = sizeof(KSrvFunctionStr) / sizeof(KSrvFunctionStr[0]); |
|
181 |
|
182 if (function <= KMaxSrvFunctions) |
|
183 return KSrvFunctionStr[function]; |
|
184 else |
|
185 return _S8("Unknown"); |
|
186 } |
|
187 #endif //SYMBIAN_TRACE_SQL_EVENTS |
|
188 |
|
189 #ifdef SYMBIAN_TRACE_SQL_FUNC |
|
190 |
|
191 /** |
|
192 Create the TSqlUTraceProfiler object which inserts a UTF trace, used to signal a function entry |
|
193 |
|
194 @param aFunctionStr A "const char" pointer describing the function to be profiled. |
|
195 Currently this is the type signature of the function returned by |
|
196 the __PRETTY_FUNCTION__ macro. |
|
197 @param aObj A object pointer used to provide context for the function. |
|
198 |
|
199 @internalComponent |
|
200 */ |
|
201 TSqlUTraceProfiler::TSqlUTraceProfiler(const TAny* aObj, const char* aFunctionStr): |
|
202 iObj(aObj), iFunctionStr(reinterpret_cast<const TUint8*>(aFunctionStr)) |
|
203 { |
|
204 UTF::Printf(UTF::TTraceContext(UTF::ESystemCharacteristicMetrics), KProfilerBegin, &iFunctionStr, iObj); |
|
205 } |
|
206 |
|
207 /** |
|
208 Destroys TSqlUTraceProfiler object which inserts a UTF trace, used to signal a function exit |
|
209 |
|
210 @internalComponent |
|
211 */ |
|
212 TSqlUTraceProfiler::~TSqlUTraceProfiler() |
|
213 { |
|
214 UTF::Printf(UTF::TTraceContext(UTF::ESystemCharacteristicMetrics), KProfilerEnd, &iFunctionStr, iObj); |
|
215 } |
|
216 |
|
217 #endif //SYMBIAN_TRACE_SQL_FUNC |
|