sl@0
|
1 |
// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
// NTT DOCOMO, INC - Fix for Bug 3170 "SQL library test T_SQLPERFORMANCE4 fails with USER 84 panic"
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// Description:
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
#include <e32test.h>
|
sl@0
|
18 |
#include <bautils.h>
|
sl@0
|
19 |
#include <sqldb.h>
|
sl@0
|
20 |
#include <hal.h>
|
sl@0
|
21 |
#include "t_sqlcmdlineutil.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
24 |
|
sl@0
|
25 |
RTest TheTest(_L("t_sqlperformance4 test"));
|
sl@0
|
26 |
RSqlDatabase TheDbC;
|
sl@0
|
27 |
RFs TheFs;
|
sl@0
|
28 |
|
sl@0
|
29 |
_LIT(KCDriveDatabase, "c:[a000017f]t_sqlperformance4.db");
|
sl@0
|
30 |
|
sl@0
|
31 |
TFileName TheDbFileName;
|
sl@0
|
32 |
TBuf<200> TheTestTitle;
|
sl@0
|
33 |
TCmdLineParams TheCmdLineParams;
|
sl@0
|
34 |
TBuf8<200> TheSqlConfigString;
|
sl@0
|
35 |
|
sl@0
|
36 |
_LIT(KUtf8, "UTF8 ");
|
sl@0
|
37 |
_LIT(KUtf16, "UTF16");
|
sl@0
|
38 |
|
sl@0
|
39 |
_LIT(KMusicCreateTable, "CREATE TABLE Music("
|
sl@0
|
40 |
L"UniqueId INTEGER PRIMARY KEY,"
|
sl@0
|
41 |
L"DbFlag INTEGER,"
|
sl@0
|
42 |
L"VolumeId INTEGER,"
|
sl@0
|
43 |
L"Title TEXT COLLATE NOCASE,"
|
sl@0
|
44 |
L"Artist INTEGER,"
|
sl@0
|
45 |
L"Art TEXT,"
|
sl@0
|
46 |
L"Deleted INTEGER DEFAULT 0,"
|
sl@0
|
47 |
L"Location TEXT,"
|
sl@0
|
48 |
L"AlbumTrack INTEGER,"
|
sl@0
|
49 |
L"PlayCount INTEGER DEFAULT 0,"
|
sl@0
|
50 |
L"TimeAdded TEXT,"
|
sl@0
|
51 |
L"TimePlayed TEXT DEFAULT '',"
|
sl@0
|
52 |
L"Duration INTEGER,"
|
sl@0
|
53 |
L"Sync INTEGER DEFAULT 0,"
|
sl@0
|
54 |
L"Modified INTEGER DEFAULT 0,"
|
sl@0
|
55 |
L"Album INTEGER,"
|
sl@0
|
56 |
L"Genre INTEGER,"
|
sl@0
|
57 |
L"Composer INTEGER,"
|
sl@0
|
58 |
L"ReleaseDate TEXT DEFAULT '',"
|
sl@0
|
59 |
L"Rating INTEGER,"
|
sl@0
|
60 |
L"Comment TEXT,"
|
sl@0
|
61 |
L"Copyright TEXT,"
|
sl@0
|
62 |
L"Url TEXT,"
|
sl@0
|
63 |
L"DRM INTEGER,"
|
sl@0
|
64 |
L"LastPlayPosition INTEGER DEFAULT 0,"
|
sl@0
|
65 |
L"SampleRate INTEGER,"
|
sl@0
|
66 |
L"BitRate INTEGER,"
|
sl@0
|
67 |
L"NumChannels INTEGER,"
|
sl@0
|
68 |
L"Codec INTEGER,"
|
sl@0
|
69 |
L"MimeType TEXT,"
|
sl@0
|
70 |
L"MTPDrmStatus INTEGER)");
|
sl@0
|
71 |
|
sl@0
|
72 |
_LIT(KAuxiliaryCreateTable, "CREATE TABLE Auxiliary("
|
sl@0
|
73 |
L"Id INTEGER,"
|
sl@0
|
74 |
L"Version TEXT,"
|
sl@0
|
75 |
L"TimeRefreshed TEXT,"
|
sl@0
|
76 |
L"TimeSynced TEXT,"
|
sl@0
|
77 |
L"Corrupt INTEGER DEFAULT 0,"
|
sl@0
|
78 |
L"SaveDeletedRecordCount INTEGER DEFAULT 0)");
|
sl@0
|
79 |
|
sl@0
|
80 |
_LIT(KAlbumCreateTable,"CREATE TABLE Album("
|
sl@0
|
81 |
L"UniqueId INTEGER PRIMARY KEY,"
|
sl@0
|
82 |
L"Name TEXT COLLATE NOCASE,"
|
sl@0
|
83 |
L"SongCount INTEGER,"
|
sl@0
|
84 |
L"Artist INTEGER,"
|
sl@0
|
85 |
L"Art TEXT)");
|
sl@0
|
86 |
|
sl@0
|
87 |
_LIT(KArtistCreateTable,"CREATE TABLE Artist("
|
sl@0
|
88 |
L"UniqueId INTEGER PRIMARY KEY,"
|
sl@0
|
89 |
L"Name TEXT COLLATE NOCASE,"
|
sl@0
|
90 |
L"SongCount INTEGER)");
|
sl@0
|
91 |
|
sl@0
|
92 |
_LIT(KComposerCreateTable,"CREATE TABLE Composer("
|
sl@0
|
93 |
L"UniqueId INTEGER PRIMARY KEY,"
|
sl@0
|
94 |
L"Name TEXT COLLATE NOCASE,"
|
sl@0
|
95 |
L"SongCount INTEGER)");
|
sl@0
|
96 |
|
sl@0
|
97 |
_LIT(KGenreCreateTable,"CREATE TABLE Genre("
|
sl@0
|
98 |
L"UniqueId INTEGER PRIMARY KEY,"
|
sl@0
|
99 |
L"Name TEXT COLLATE NOCASE,"
|
sl@0
|
100 |
L"SongCount INTEGER)");
|
sl@0
|
101 |
|
sl@0
|
102 |
_LIT(KPlaylistCreateTable, "CREATE TABLE Playlist("
|
sl@0
|
103 |
L"UniqueId INTEGER PRIMARY KEY,"
|
sl@0
|
104 |
L"VolumeId INTEGER,"
|
sl@0
|
105 |
L"DbFlag INTEGER,"
|
sl@0
|
106 |
L"Sync INTEGER,"
|
sl@0
|
107 |
L"Name TEXT COLLATE NOCASE,"
|
sl@0
|
108 |
L"Uri TEXT,"
|
sl@0
|
109 |
L"Time TEXT)");
|
sl@0
|
110 |
|
sl@0
|
111 |
_LIT(KPlaylistSongsCreateTable, "CREATE TABLE PlaylistSongs("
|
sl@0
|
112 |
L"UniqueId INTEGER PRIMARY KEY AUTOINCREMENT,"
|
sl@0
|
113 |
L"SongId INTEGER,"
|
sl@0
|
114 |
L"PlaylistId INTEGER,"
|
sl@0
|
115 |
L"Ordinal INTEGER)");
|
sl@0
|
116 |
|
sl@0
|
117 |
_LIT(KPlaylistSongInfoCreateTable, "CREATE TABLE PlaylistSongInfo("
|
sl@0
|
118 |
L"SongId INTEGER PRIMARY KEY,"
|
sl@0
|
119 |
L"VolumeId INTEGER,"
|
sl@0
|
120 |
L"DbFlag INTEGER,"
|
sl@0
|
121 |
L"Uri TEXT,"
|
sl@0
|
122 |
L"Title TEXT COLLATE NOCASE)");
|
sl@0
|
123 |
|
sl@0
|
124 |
|
sl@0
|
125 |
_LIT(KBeginTransaction, "BEGIN TRANSACTION");
|
sl@0
|
126 |
_LIT(KCommitTransaction, "COMMIT TRANSACTION");
|
sl@0
|
127 |
|
sl@0
|
128 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
129 |
|
sl@0
|
130 |
void TestEnvDestroy()
|
sl@0
|
131 |
{
|
sl@0
|
132 |
TheDbC.Close();
|
sl@0
|
133 |
(void)RSqlDatabase::Delete(TheDbFileName);
|
sl@0
|
134 |
TheFs.Close();
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
138 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
139 |
//Test macros and functions
|
sl@0
|
140 |
void Check1(TInt aValue, TInt aLine)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
if(!aValue)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
TestEnvDestroy();
|
sl@0
|
145 |
TheTest.Printf(_L("*** Line %d\r\n"), aLine);
|
sl@0
|
146 |
TheTest(EFalse, aLine);
|
sl@0
|
147 |
}
|
sl@0
|
148 |
}
|
sl@0
|
149 |
void Check2(TInt aValue, TInt aExpected, TInt aLine)
|
sl@0
|
150 |
{
|
sl@0
|
151 |
if(aValue != aExpected)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
TestEnvDestroy();
|
sl@0
|
154 |
TheTest.Printf(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
|
sl@0
|
155 |
TheTest(EFalse, aLine);
|
sl@0
|
156 |
}
|
sl@0
|
157 |
}
|
sl@0
|
158 |
#define TEST(arg) ::Check1((arg), __LINE__)
|
sl@0
|
159 |
#define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
|
sl@0
|
160 |
|
sl@0
|
161 |
|
sl@0
|
162 |
TInt GetDuration(TUint32 aStartTicks, TUint32 aEndTicks)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
static TInt freq = 0;
|
sl@0
|
165 |
if(freq == 0)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
HAL::Get(HAL::EFastCounterFrequency, freq);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
|
sl@0
|
170 |
if(diffTicks < 0)
|
sl@0
|
171 |
{
|
sl@0
|
172 |
diffTicks = KMaxTUint32 + diffTicks + 1;
|
sl@0
|
173 |
}
|
sl@0
|
174 |
const TInt KMicroSecIn1Sec = 1000000;
|
sl@0
|
175 |
|
sl@0
|
176 |
return ((diffTicks * KMicroSecIn1Sec) / freq);
|
sl@0
|
177 |
}
|
sl@0
|
178 |
|
sl@0
|
179 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
180 |
|
sl@0
|
181 |
void CreateDatabaseL(const TDesC& aDbName)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
// create the database now
|
sl@0
|
184 |
RSqlSecurityPolicy securityPolicy;
|
sl@0
|
185 |
CleanupClosePushL(securityPolicy);
|
sl@0
|
186 |
|
sl@0
|
187 |
TSecurityPolicy policy(TSecurityPolicy::EAlwaysPass);
|
sl@0
|
188 |
securityPolicy.Create(policy);
|
sl@0
|
189 |
|
sl@0
|
190 |
TSecurityPolicy schemaPolicy(TSecurityPolicy::EAlwaysPass);
|
sl@0
|
191 |
TSecurityPolicy readPolicy(TSecurityPolicy::EAlwaysPass);
|
sl@0
|
192 |
TSecurityPolicy writePolicy(TSecurityPolicy::EAlwaysPass);
|
sl@0
|
193 |
|
sl@0
|
194 |
User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::ESchemaPolicy, schemaPolicy));
|
sl@0
|
195 |
User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, readPolicy));
|
sl@0
|
196 |
User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EWritePolicy, writePolicy));
|
sl@0
|
197 |
|
sl@0
|
198 |
TheTest.Printf(_L("Creating Database %S\n"), &aDbName);
|
sl@0
|
199 |
|
sl@0
|
200 |
TInt err = TheDbC.Create(aDbName, securityPolicy, &TheSqlConfigString);
|
sl@0
|
201 |
|
sl@0
|
202 |
if (KErrAlreadyExists == err)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
|
sl@0
|
205 |
// the file already exists
|
sl@0
|
206 |
// make sure we delete the file
|
sl@0
|
207 |
User::LeaveIfError(TheDbC.Delete(aDbName));
|
sl@0
|
208 |
|
sl@0
|
209 |
// try again
|
sl@0
|
210 |
err = TheDbC.Create(aDbName, securityPolicy, &TheSqlConfigString);
|
sl@0
|
211 |
|
sl@0
|
212 |
}
|
sl@0
|
213 |
|
sl@0
|
214 |
User::LeaveIfError(err);
|
sl@0
|
215 |
|
sl@0
|
216 |
//Create tables
|
sl@0
|
217 |
User::LeaveIfError(TheDbC.Exec(KMusicCreateTable));
|
sl@0
|
218 |
User::LeaveIfError(TheDbC.Exec(KAuxiliaryCreateTable));
|
sl@0
|
219 |
User::LeaveIfError(TheDbC.Exec(KAlbumCreateTable));
|
sl@0
|
220 |
User::LeaveIfError(TheDbC.Exec(KArtistCreateTable));
|
sl@0
|
221 |
User::LeaveIfError(TheDbC.Exec(KComposerCreateTable));
|
sl@0
|
222 |
User::LeaveIfError(TheDbC.Exec(KGenreCreateTable));
|
sl@0
|
223 |
User::LeaveIfError(TheDbC.Exec(KPlaylistCreateTable));
|
sl@0
|
224 |
User::LeaveIfError(TheDbC.Exec(KPlaylistSongInfoCreateTable));
|
sl@0
|
225 |
User::LeaveIfError(TheDbC.Exec(KPlaylistSongsCreateTable));
|
sl@0
|
226 |
|
sl@0
|
227 |
TheDbC.Close();
|
sl@0
|
228 |
|
sl@0
|
229 |
CleanupStack::PopAndDestroy(&securityPolicy);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
|
sl@0
|
232 |
void TestEnvInit()
|
sl@0
|
233 |
{
|
sl@0
|
234 |
|
sl@0
|
235 |
TInt err = TheFs.Connect();
|
sl@0
|
236 |
TEST2(err, KErrNone);
|
sl@0
|
237 |
|
sl@0
|
238 |
//Create database files
|
sl@0
|
239 |
TRAP(err,CreateDatabaseL(TheDbFileName));
|
sl@0
|
240 |
TEST2(err, KErrNone);
|
sl@0
|
241 |
|
sl@0
|
242 |
}
|
sl@0
|
243 |
|
sl@0
|
244 |
|
sl@0
|
245 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
246 |
/**
|
sl@0
|
247 |
@SYMTestCaseID PDS-SQL-UT-4151
|
sl@0
|
248 |
@SYMTestCaseDesc Measures the performance of inserting multiple records
|
sl@0
|
249 |
into the Music Player MPX database. This test is based on
|
sl@0
|
250 |
a real Music Player Harvesting use case
|
sl@0
|
251 |
@SYMTestPriority Medium
|
sl@0
|
252 |
@SYMTestActions Reads SQL transactions from a file and executes them.
|
sl@0
|
253 |
Records the time for executing each statement
|
sl@0
|
254 |
@SYMTestExpectedResults All statements should be executed without error and
|
sl@0
|
255 |
performance measurements logged
|
sl@0
|
256 |
@SYMDEF DEF142306
|
sl@0
|
257 |
*/
|
sl@0
|
258 |
void RunTest()
|
sl@0
|
259 |
{
|
sl@0
|
260 |
//Open the file with the sql statements
|
sl@0
|
261 |
_LIT(KSqlFileName,"z:\\test\\t_sqlperformance4.sql");
|
sl@0
|
262 |
RFile sqlFile;
|
sl@0
|
263 |
TInt err = sqlFile.Open(TheFs, KSqlFileName, EFileRead);
|
sl@0
|
264 |
TEST2(err, KErrNone);
|
sl@0
|
265 |
|
sl@0
|
266 |
TInt fileLen = 0;
|
sl@0
|
267 |
err = sqlFile.Size(fileLen);
|
sl@0
|
268 |
TEST2(err, KErrNone);
|
sl@0
|
269 |
|
sl@0
|
270 |
HBufC8* sqlBuf = HBufC8::New(fileLen);
|
sl@0
|
271 |
TEST(sqlBuf != NULL);
|
sl@0
|
272 |
TPtr8 sql = sqlBuf->Des();
|
sl@0
|
273 |
err = sqlFile.Read(sql);
|
sl@0
|
274 |
|
sl@0
|
275 |
sqlFile.Close();
|
sl@0
|
276 |
TEST2(err, KErrNone);
|
sl@0
|
277 |
TEST2(sql.Length(), fileLen);
|
sl@0
|
278 |
|
sl@0
|
279 |
//Open main database
|
sl@0
|
280 |
err = TheDbC.Open(TheDbFileName, &TheSqlConfigString);
|
sl@0
|
281 |
TEST2(err, KErrNone);
|
sl@0
|
282 |
|
sl@0
|
283 |
TheTest.Printf(_L("Beginning INSERTS...\n"));
|
sl@0
|
284 |
|
sl@0
|
285 |
const TInt KRecordCount = 6544;
|
sl@0
|
286 |
TInt recordCount = 0;
|
sl@0
|
287 |
TInt insertCnt = 0;
|
sl@0
|
288 |
TInt updateCnt = 0;
|
sl@0
|
289 |
TInt selectCnt = 0;
|
sl@0
|
290 |
TInt trnCnt = 0;
|
sl@0
|
291 |
TInt totalTime = 0;
|
sl@0
|
292 |
|
sl@0
|
293 |
TInt insertTrnCnt = 0;
|
sl@0
|
294 |
TInt updateTrnCnt = 0;
|
sl@0
|
295 |
TInt selectTrnCnt = 0;
|
sl@0
|
296 |
|
sl@0
|
297 |
for(;sql.Length()>0;)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
TInt eolPos = sql.Locate(TChar('\n'));
|
sl@0
|
300 |
if(eolPos < 0)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
break;//No more SQL statements
|
sl@0
|
303 |
}
|
sl@0
|
304 |
TInt stmtLength = eolPos;
|
sl@0
|
305 |
while (stmtLength > 0 && (sql[stmtLength-1] == '\r'))
|
sl@0
|
306 |
{
|
sl@0
|
307 |
--stmtLength; //Reduce length to remove carriage return characters from the end of the statement string
|
sl@0
|
308 |
}
|
sl@0
|
309 |
TPtrC8 sqlStmt8(sql.Ptr(), stmtLength);
|
sl@0
|
310 |
TPtrC8 ptr = sql.Mid(eolPos + 1);//"eolPos + 1" - first character after '\n'
|
sl@0
|
311 |
sql.Set(const_cast <TUint8*> (ptr.Ptr()), ptr.Length(), ptr.Length());
|
sl@0
|
312 |
++recordCount;
|
sl@0
|
313 |
|
sl@0
|
314 |
//Convert to 16 bit query string
|
sl@0
|
315 |
TBuf<1024> query;
|
sl@0
|
316 |
query.Copy(sqlStmt8);
|
sl@0
|
317 |
|
sl@0
|
318 |
//Execute the statement
|
sl@0
|
319 |
TInt start = User::FastCounter();
|
sl@0
|
320 |
err = TheDbC.Exec(query);
|
sl@0
|
321 |
TInt end = User::FastCounter();
|
sl@0
|
322 |
|
sl@0
|
323 |
TEST(err >= 0);
|
sl@0
|
324 |
|
sl@0
|
325 |
//Get the execution time for that statement
|
sl@0
|
326 |
TInt duration = GetDuration(start, end);
|
sl@0
|
327 |
totalTime += duration;
|
sl@0
|
328 |
|
sl@0
|
329 |
if(query == KBeginTransaction)
|
sl@0
|
330 |
{
|
sl@0
|
331 |
TheTest.Printf(_L("Execute Statement - BEGIN: %d us\n"), duration);
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
else if(query == KCommitTransaction)
|
sl@0
|
335 |
{
|
sl@0
|
336 |
++trnCnt;
|
sl@0
|
337 |
TheTest.Printf(_L("Execute Statement - COMMIT: %d us, Trn#%d, \"INSERT\" count: %d, \"UPDATE\" count: %d, \"SELECT\" count: %d\n"),
|
sl@0
|
338 |
duration, trnCnt, insertTrnCnt, updateTrnCnt, selectTrnCnt);
|
sl@0
|
339 |
insertTrnCnt = updateTrnCnt = selectTrnCnt = 0;
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
else
|
sl@0
|
343 |
{
|
sl@0
|
344 |
TPtrC queryType(query.Ptr(), 6);
|
sl@0
|
345 |
TheTest.Printf(_L("Execute Statement - %S: %d us\n"),&queryType, duration);
|
sl@0
|
346 |
if(queryType.FindF(_L("INSERT")) >= 0)
|
sl@0
|
347 |
{
|
sl@0
|
348 |
++insertCnt;
|
sl@0
|
349 |
++insertTrnCnt;
|
sl@0
|
350 |
}
|
sl@0
|
351 |
else if(queryType.FindF(_L("UPDATE")) >= 0)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
++updateCnt;
|
sl@0
|
354 |
++updateTrnCnt;
|
sl@0
|
355 |
}
|
sl@0
|
356 |
else if(queryType.FindF(_L("SELECT")) >= 0)
|
sl@0
|
357 |
{
|
sl@0
|
358 |
++selectCnt;
|
sl@0
|
359 |
++selectTrnCnt;
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
}
|
sl@0
|
363 |
delete sqlBuf;
|
sl@0
|
364 |
|
sl@0
|
365 |
TheDbC.Close();
|
sl@0
|
366 |
|
sl@0
|
367 |
TheTest.Printf(_L("Total time to process Songs: %d us\n"), totalTime);
|
sl@0
|
368 |
TheTest.Printf(_L("Transactions count: %d, \"INSERT\" count: %d, \"UPDATE\" count: %d, \"SELECT\" count: %d\n"),
|
sl@0
|
369 |
trnCnt, insertCnt, updateCnt, selectCnt);
|
sl@0
|
370 |
TEST2(recordCount, KRecordCount);
|
sl@0
|
371 |
}
|
sl@0
|
372 |
///////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
373 |
///////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
374 |
|
sl@0
|
375 |
void DoTests()
|
sl@0
|
376 |
{
|
sl@0
|
377 |
TheTestTitle.Format(_L("@SYMTestCaseID:PDS-SQL-UT-4151; SQL Music Player Db Performance Test, encoding: \"%S\", page size: %d\r\n"),
|
sl@0
|
378 |
TheCmdLineParams.iDbEncoding == TCmdLineParams::EDbUtf16 ? &KUtf16 : &KUtf8, TheCmdLineParams.iPageSize);
|
sl@0
|
379 |
TheTest.Start(TheTestTitle);
|
sl@0
|
380 |
|
sl@0
|
381 |
RunTest();
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
TInt E32Main()
|
sl@0
|
385 |
{
|
sl@0
|
386 |
TheTest.Title();
|
sl@0
|
387 |
|
sl@0
|
388 |
CTrapCleanup* tc = CTrapCleanup::New();
|
sl@0
|
389 |
TheTest(tc != NULL);
|
sl@0
|
390 |
|
sl@0
|
391 |
__UHEAP_MARK;
|
sl@0
|
392 |
|
sl@0
|
393 |
GetCmdLineParamsAndSqlConfigString(TheTest, _L("t_sqlperformance4"), TheCmdLineParams, TheSqlConfigString);
|
sl@0
|
394 |
PrepareDbName(KCDriveDatabase, TheCmdLineParams.iDriveName, TheDbFileName);
|
sl@0
|
395 |
|
sl@0
|
396 |
TheTest.Printf(_L("==Databases: %S\r\n"), &TheDbFileName);
|
sl@0
|
397 |
|
sl@0
|
398 |
TestEnvInit();
|
sl@0
|
399 |
|
sl@0
|
400 |
DoTests();
|
sl@0
|
401 |
|
sl@0
|
402 |
TestEnvDestroy();
|
sl@0
|
403 |
|
sl@0
|
404 |
__UHEAP_MARKEND;
|
sl@0
|
405 |
|
sl@0
|
406 |
TheTest.End();
|
sl@0
|
407 |
TheTest.Close();
|
sl@0
|
408 |
|
sl@0
|
409 |
delete tc;
|
sl@0
|
410 |
|
sl@0
|
411 |
User::Heap().Check();
|
sl@0
|
412 |
return KErrNone;
|
sl@0
|
413 |
}
|