|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <stdio.h> |
|
21 #include <stdlib.h> |
|
22 #include <string.h> |
|
23 #include <wchar.h> |
|
24 #include <errno.h> |
|
25 #include <sys/stat.h> |
|
26 #include <unistd.h> |
|
27 #include <sqlite3.h> |
|
28 #include "t_sqliteperf.h" |
|
29 |
|
30 static sqlite3* TheDb2 = 0; |
|
31 |
|
32 static char TheSqlBuf2[2000]; |
|
33 |
|
34 #define UNUSED_VAR(a) (a) = (a) |
|
35 |
|
36 /* ///////////////////////////////////////////////////////////////////////////////////// */ |
|
37 |
|
38 static void TestCleanup() |
|
39 { |
|
40 if(TheDb2) |
|
41 { |
|
42 sqlite3_close(TheDb2); |
|
43 TheDb2 = 0; |
|
44 } |
|
45 (void)remove(TestDbName()); |
|
46 } |
|
47 |
|
48 /* ///////////////////////////////////////////////////////////////////////////////////// */ |
|
49 /* Test macros and functions */ |
|
50 |
|
51 static void Check1(int aValue, int aLine) |
|
52 { |
|
53 if(!aValue) |
|
54 { |
|
55 if(TheDb2) |
|
56 { |
|
57 const char* errmsg = sqlite3_errmsg(TheDb2); |
|
58 PrintS("*** SQLITE error message: %s\r\n", errmsg); |
|
59 } |
|
60 TestCleanup(); |
|
61 PrintI("*** Test check failed! Line=%d\r\n", aLine); |
|
62 TestAbort(aLine); |
|
63 } |
|
64 } |
|
65 static void Check2(int aValue, int aExpected, int aLine) |
|
66 { |
|
67 if(aValue != aExpected) |
|
68 { |
|
69 if(TheDb2) |
|
70 { |
|
71 const char* errmsg = sqlite3_errmsg(TheDb2); |
|
72 PrintS("*** SQLITE error message: %s\r\n", errmsg); |
|
73 } |
|
74 TestCleanup(); |
|
75 PrintIII("*** Test check failed! Line=%d. Expected error: %d, got: %d\r\n", aLine, aExpected, aValue); |
|
76 TestAbort(aLine); |
|
77 } |
|
78 } |
|
79 #define TEST(arg) Check1((arg), __LINE__) |
|
80 #define TEST2(aValue, aExpected) Check2(aValue, aExpected, __LINE__) |
|
81 |
|
82 /* ///////////////////////////////////////////////////////////////////////////////////// */ |
|
83 |
|
84 //"PRAGMA cache_size=1024" and "PRAGMA locking_mode=EXCLUSIVE" statements executed only if |
|
85 //aPerfTestMode is EPerfTestSqliteMode (to match the Symbian SQL build time settings of SQLite) |
|
86 static void ExecSqliteConfig(TPerfTestMode aPerfTestMode) |
|
87 { |
|
88 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
89 if(aPerfTestMode == EPerfTestSqliteSqlMode) |
|
90 { |
|
91 int err; |
|
92 err = sqlite3_exec(TheDb2, "PRAGMA cache_size=1024", 0, 0, 0); |
|
93 TEST2(err, SQLITE_OK); |
|
94 err = sqlite3_exec(TheDb2, "PRAGMA locking_mode=EXCLUSIVE", 0, 0, 0); |
|
95 TEST2(err, SQLITE_OK); |
|
96 err = sqlite3_exec(TheDb2, "PRAGMA auto_vacuum=incremental", 0, 0, 0); |
|
97 TEST2(err, SQLITE_OK); |
|
98 err = sqlite3_exec(TheDb2, "PRAGMA journal_mode=PERSIST", 0, 0, 0); |
|
99 TEST2(err, SQLITE_OK); |
|
100 err = sqlite3_exec(TheDb2, "PRAGMA journal_size_limit=2048000", 0, 0, 0); |
|
101 TEST2(err, SQLITE_OK); |
|
102 } |
|
103 } |
|
104 |
|
105 /* ///////////////////////////////////////////////////////////////////////////////////// */ |
|
106 |
|
107 /** |
|
108 @SYMTestCaseID SYSLIB-SQLITE3-UT-4018 |
|
109 @SYMTestCaseDesc SQLite library multi-insert performance test. |
|
110 The test inserts 1000 records in a single transaction and stores |
|
111 the execution time for later use (comparison and printing). |
|
112 The results of this test case will be compared against the results of |
|
113 the SYSLIB-SQLITE3-UT-4010 test case - "SQL server multi-insert performance test". |
|
114 @SYMTestPriority High |
|
115 @SYMTestActions SQLite library multi-insert performance test. |
|
116 @SYMTestExpectedResults Test must not fail |
|
117 @SYMREQ REQ8782 |
|
118 */ |
|
119 void SqliteMultiInsertTest(TPerfTestMode aPerfTestMode, const char aInsertSql[], int aInsertRecCnt) |
|
120 { |
|
121 int err; |
|
122 int i; |
|
123 const char* tail = 0; |
|
124 sqlite3_stmt* stmt = 0; |
|
125 unsigned int fc; |
|
126 |
|
127 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
128 TEST(!TheDb2); |
|
129 err = sqlite3_open(TestDbName(), &TheDb2); |
|
130 TEST2(err, SQLITE_OK); |
|
131 ExecSqliteConfig(aPerfTestMode); |
|
132 |
|
133 err = sqlite3_prepare(TheDb2, aInsertSql, -1, &stmt, &tail); |
|
134 TEST2(err, SQLITE_OK); |
|
135 |
|
136 fc = FastCounterValue(); |
|
137 err = sqlite3_exec(TheDb2, "BEGIN", 0, 0, 0); |
|
138 TEST2(err, SQLITE_OK); |
|
139 |
|
140 for(i=0;i<aInsertRecCnt;++i) |
|
141 { |
|
142 err = sqlite3_bind_int(stmt, 1, i + 1); |
|
143 TEST2(err, SQLITE_OK); |
|
144 |
|
145 err = sqlite3_step(stmt); |
|
146 TEST2(err, SQLITE_DONE); |
|
147 |
|
148 err = sqlite3_reset(stmt); |
|
149 TEST2(err, SQLITE_OK); |
|
150 } |
|
151 |
|
152 err = sqlite3_exec(TheDb2, "COMMIT", 0, 0, 0); |
|
153 TEST2(err, SQLITE_OK); |
|
154 StorePerfTestResult(aPerfTestMode, EPerfTestMultiInsert, FastCounterValue() - fc); |
|
155 |
|
156 sqlite3_finalize(stmt); |
|
157 sqlite3_close(TheDb2); |
|
158 TheDb2 = 0; |
|
159 } |
|
160 |
|
161 static void FormatSqlStmt(char* aSqlBuf, const char aSql[], int aRecIds[], int aRecCnt) |
|
162 { |
|
163 int i; |
|
164 strcpy(aSqlBuf, aSql); |
|
165 strcat(aSqlBuf, "("); |
|
166 for(i=0;i<aRecCnt;++i) |
|
167 { |
|
168 char tmp[10]; |
|
169 sprintf(tmp, "%d", aRecIds[i]); |
|
170 strcat(aSqlBuf, tmp); |
|
171 strcat(aSqlBuf, ","); |
|
172 } |
|
173 aSqlBuf[strlen(aSqlBuf) - 1] = ')'; |
|
174 } |
|
175 |
|
176 /** |
|
177 @SYMTestCaseID SYSLIB-SQLITE3-UT-4019 |
|
178 @SYMTestCaseDesc SQLite library multi-update performance test. |
|
179 The test updates 100 records and stores |
|
180 the execution time for later use (comparison and printing). |
|
181 The IDs of the updated records are exactly the same as the IDs of the updated |
|
182 records, used by SYSLIB-SQLITE3-UT-4011 test case. |
|
183 The results of this test case will be compared against the results of |
|
184 the SYSLIB-SQLITE3-UT-4011 test case - "SQL server multi-update performance test". |
|
185 @SYMTestPriority High |
|
186 @SYMTestActions SQLite library multi-update performance test. |
|
187 @SYMTestExpectedResults Test must not fail |
|
188 @SYMREQ REQ8782 |
|
189 */ |
|
190 void SqliteMultiUpdateTest(TPerfTestMode aPerfTestMode, const char aUpdateSql[], int aUpdateRecIds[], int aUpdateRecCnt) |
|
191 { |
|
192 int err; |
|
193 unsigned int fc; |
|
194 |
|
195 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
196 TEST(!TheDb2); |
|
197 err = sqlite3_open(TestDbName(), &TheDb2); |
|
198 TEST2(err, SQLITE_OK); |
|
199 ExecSqliteConfig(aPerfTestMode); |
|
200 |
|
201 FormatSqlStmt(TheSqlBuf2, aUpdateSql, aUpdateRecIds, aUpdateRecCnt); |
|
202 |
|
203 fc = FastCounterValue(); |
|
204 err = sqlite3_exec(TheDb2, TheSqlBuf2, 0, 0, 0); |
|
205 StorePerfTestResult(aPerfTestMode, EPerfTestMultiUpdate, FastCounterValue() - fc); |
|
206 TEST2(err, SQLITE_OK); |
|
207 |
|
208 sqlite3_close(TheDb2); |
|
209 TheDb2 = 0; |
|
210 } |
|
211 |
|
212 /** |
|
213 @SYMTestCaseID SYSLIB-SQLITE3-UT-4020 |
|
214 @SYMTestCaseDesc SQLite library multi-delete performance test. |
|
215 The test deletes 100 records and stores |
|
216 the execution time for later use (comparison and printing). |
|
217 The IDs of the deleted records are exactly the same as the IDs of the deleted |
|
218 records, used by SYSLIB-SQLITE3-UT-4012 test case. |
|
219 The results of this test case will be compared against the results of |
|
220 the SYSLIB-SQLITE3-UT-4012 test case - "SQL server multi-delete performance test". |
|
221 @SYMTestPriority High |
|
222 @SYMTestActions SQLite library multi-delete performance test. |
|
223 @SYMTestExpectedResults Test must not fail |
|
224 @SYMREQ REQ8782 |
|
225 */ |
|
226 void SqliteMultiDeleteTest(TPerfTestMode aPerfTestMode, const char aDeleteSql[], int aDeleteRecIds[], int aDeleteRecCnt) |
|
227 { |
|
228 int err; |
|
229 unsigned int fc; |
|
230 |
|
231 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
232 TEST(!TheDb2); |
|
233 err = sqlite3_open(TestDbName(), &TheDb2); |
|
234 TEST2(err, SQLITE_OK); |
|
235 ExecSqliteConfig(aPerfTestMode); |
|
236 |
|
237 FormatSqlStmt(TheSqlBuf2, aDeleteSql, aDeleteRecIds, aDeleteRecCnt); |
|
238 |
|
239 fc = FastCounterValue(); |
|
240 err = sqlite3_exec(TheDb2, TheSqlBuf2, 0, 0, 0); |
|
241 StorePerfTestResult(aPerfTestMode, EPerfTestMultiDelete, FastCounterValue() - fc); |
|
242 TEST2(err, SQLITE_OK); |
|
243 |
|
244 sqlite3_close(TheDb2); |
|
245 TheDb2 = 0; |
|
246 } |
|
247 |
|
248 /** |
|
249 @SYMTestCaseID SYSLIB-SQLITE3-UT-4021 |
|
250 @SYMTestCaseDesc SQLite library multi-select performance test. |
|
251 The test selects 100 records and stores |
|
252 the execution time for later use (comparison and printing). |
|
253 The IDs of the selected records are exactly the same as the IDs of the selected |
|
254 records, used by SYSLIB-SQLITE3-UT-4013 test case. |
|
255 The results of this test case will be compared against the results of |
|
256 the SYSLIB-SQLITE3-UT-4013 test case - "SQL server multi-select performance test". |
|
257 @SYMTestPriority High |
|
258 @SYMTestActions SQLite library multi-select performance test. |
|
259 @SYMTestExpectedResults Test must not fail |
|
260 @SYMREQ REQ8782 |
|
261 */ |
|
262 void SqliteMultiSelectTest(TPerfTestMode aPerfTestMode, const char aSelectSql[], int aSelectRecIds[], int aSelectRecCnt) |
|
263 { |
|
264 int err; |
|
265 const char* tail = 0; |
|
266 sqlite3_stmt* stmt = 0; |
|
267 int recCnt = 0; |
|
268 unsigned int fc; |
|
269 |
|
270 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
271 TEST(!TheDb2); |
|
272 err = sqlite3_open(TestDbName(), &TheDb2); |
|
273 TEST2(err, SQLITE_OK); |
|
274 ExecSqliteConfig(aPerfTestMode); |
|
275 |
|
276 FormatSqlStmt(TheSqlBuf2, aSelectSql, aSelectRecIds, aSelectRecCnt); |
|
277 |
|
278 err = sqlite3_prepare(TheDb2, TheSqlBuf2, -1, &stmt, &tail); |
|
279 TEST2(err, SQLITE_OK); |
|
280 |
|
281 fc = FastCounterValue(); |
|
282 while((err = sqlite3_step(stmt)) == SQLITE_ROW) |
|
283 { |
|
284 __int64 i64; |
|
285 double d; |
|
286 const unsigned short* t; |
|
287 const unsigned char* b; |
|
288 |
|
289 i64 = sqlite3_column_int64(stmt, 0); |
|
290 UNUSED_VAR(i64); |
|
291 d = sqlite3_column_double(stmt, 1); |
|
292 UNUSED_VAR(d); |
|
293 t = (const unsigned short*)sqlite3_column_text16(stmt, 2); |
|
294 UNUSED_VAR(t); |
|
295 b = (const unsigned char*)sqlite3_column_blob(stmt, 3); |
|
296 UNUSED_VAR(b); |
|
297 ++recCnt; |
|
298 } |
|
299 StorePerfTestResult(aPerfTestMode, EPerfTestMultiSelect, FastCounterValue() - fc); |
|
300 TEST2(err, SQLITE_DONE); |
|
301 TEST2(recCnt, aSelectRecCnt); |
|
302 |
|
303 sqlite3_finalize(stmt); |
|
304 sqlite3_close(TheDb2); |
|
305 TheDb2 = 0; |
|
306 } |
|
307 |
|
308 /** |
|
309 @SYMTestCaseID SYSLIB-SQLITE3-UT-4022 |
|
310 @SYMTestCaseDesc SQLite library single-insert performance test. |
|
311 The test inserts one record and stores |
|
312 the execution time for later use (comparison and printing). |
|
313 The ID of the inserted record is exactly the same as the ID of the inserted |
|
314 record, used by SYSLIB-SQLITE3-UT-4014 test case. |
|
315 The results of this test case will be compared against the results of |
|
316 the SYSLIB-SQLITE3-UT-4014 test case - "SQL server single-insert performance test". |
|
317 @SYMTestPriority High |
|
318 @SYMTestActions SQLite library single-insert performance test. |
|
319 @SYMTestExpectedResults Test must not fail |
|
320 @SYMREQ REQ8782 |
|
321 */ |
|
322 void SqliteSingleInsertTest(TPerfTestMode aPerfTestMode, const char aSingleInsertSql[], TInt aInsertRecId) |
|
323 { |
|
324 int err; |
|
325 unsigned int fc; |
|
326 |
|
327 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
328 TEST(!TheDb2); |
|
329 err = sqlite3_open(TestDbName(), &TheDb2); |
|
330 TEST2(err, SQLITE_OK); |
|
331 ExecSqliteConfig(aPerfTestMode); |
|
332 |
|
333 sprintf(TheSqlBuf2, aSingleInsertSql, aInsertRecId); |
|
334 fc = FastCounterValue(); |
|
335 err = sqlite3_exec(TheDb2, TheSqlBuf2, 0, 0, 0); |
|
336 StorePerfTestResult(aPerfTestMode, EPerfTestSingleInsert, FastCounterValue() - fc); |
|
337 TEST2(err, SQLITE_OK); |
|
338 |
|
339 sqlite3_close(TheDb2); |
|
340 TheDb2 = 0; |
|
341 } |
|
342 |
|
343 /** |
|
344 @SYMTestCaseID SYSLIB-SQLITE3-UT-4023 |
|
345 @SYMTestCaseDesc SQLite library single-update performance test. |
|
346 The test updates one record and stores |
|
347 the execution time for later use (comparison and printing). |
|
348 The ID of the updated record is exactly the same as the ID of the updated |
|
349 record, used by SYSLIB-SQLITE3-UT-4015 test case. |
|
350 The results of this test case will be compared against the results of |
|
351 the SYSLIB-SQLITE3-UT-4015 test case - "SQL server single-update performance test". |
|
352 @SYMTestPriority High |
|
353 @SYMTestActions SQLite library single-update performance test. |
|
354 @SYMTestExpectedResults Test must not fail |
|
355 @SYMREQ REQ8782 |
|
356 */ |
|
357 void SqliteSingleUpdateTest(TPerfTestMode aPerfTestMode, const char aSingleUpdateSql[], TInt aUpdateRecId) |
|
358 { |
|
359 int err; |
|
360 unsigned int fc; |
|
361 char tmp[10]; |
|
362 |
|
363 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
364 TEST(!TheDb2); |
|
365 err = sqlite3_open(TestDbName(), &TheDb2); |
|
366 TEST2(err, SQLITE_OK); |
|
367 ExecSqliteConfig(aPerfTestMode); |
|
368 |
|
369 sprintf(tmp, "%d", aUpdateRecId); |
|
370 strcpy(TheSqlBuf2, aSingleUpdateSql); |
|
371 strcat(TheSqlBuf2, tmp); |
|
372 fc = FastCounterValue(); |
|
373 err = sqlite3_exec(TheDb2, TheSqlBuf2, 0, 0, 0); |
|
374 StorePerfTestResult(aPerfTestMode, EPerfTestSingleUpdate, FastCounterValue() - fc); |
|
375 TEST2(err, SQLITE_OK); |
|
376 |
|
377 sqlite3_close(TheDb2); |
|
378 TheDb2 = 0; |
|
379 } |
|
380 |
|
381 /** |
|
382 @SYMTestCaseID SYSLIB-SQLITE3-UT-4024 |
|
383 @SYMTestCaseDesc SQLite library single-delete performance test. |
|
384 The test deletes one record and stores |
|
385 the execution time for later use (comparison and printing). |
|
386 The ID of the deleted record is exactly the same as the ID of the deleted |
|
387 record, used by SYSLIB-SQLITE3-UT-4016 test case. |
|
388 The results of this test case will be compared against the results of |
|
389 the SYSLIB-SQLITE3-UT-4016 test case - "SQL server single-delete performance test". |
|
390 @SYMTestPriority High |
|
391 @SYMTestActions SQLite library single-delete performance test. |
|
392 @SYMTestExpectedResults Test must not fail |
|
393 @SYMREQ REQ8782 |
|
394 */ |
|
395 void SqliteSingleDeleteTest(TPerfTestMode aPerfTestMode, const char aSingleDeleteSql[], TInt aDeleteRecId) |
|
396 { |
|
397 int err; |
|
398 unsigned int fc; |
|
399 char tmp[10]; |
|
400 |
|
401 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
402 TEST(!TheDb2); |
|
403 err = sqlite3_open(TestDbName(), &TheDb2); |
|
404 TEST2(err, SQLITE_OK); |
|
405 ExecSqliteConfig(aPerfTestMode); |
|
406 |
|
407 sprintf(tmp, "%d", aDeleteRecId); |
|
408 strcpy(TheSqlBuf2, aSingleDeleteSql); |
|
409 strcat(TheSqlBuf2, tmp); |
|
410 fc = FastCounterValue(); |
|
411 err = sqlite3_exec(TheDb2, TheSqlBuf2, 0, 0, 0); |
|
412 StorePerfTestResult(aPerfTestMode, EPerfTestSingleDelete, FastCounterValue() - fc); |
|
413 TEST2(err, SQLITE_OK); |
|
414 |
|
415 sqlite3_close(TheDb2); |
|
416 TheDb2 = 0; |
|
417 } |
|
418 |
|
419 /** |
|
420 @SYMTestCaseID SYSLIB-SQLITE3-UT-4025 |
|
421 @SYMTestCaseDesc SQLite library single-select performance test. |
|
422 The test selects one record and stores |
|
423 the execution time for later use (comparison and printing). |
|
424 The ID of the selected record is exactly the same as the ID of the selected |
|
425 record, used by SYSLIB-SQLITE3-UT-4017 test case. |
|
426 The results of this test case will be compared against the results of |
|
427 the SYSLIB-SQLITE3-UT-4017 test case - "SQL server single-select performance test". |
|
428 @SYMTestPriority High |
|
429 @SYMTestActions SQLite library single-select performance test. |
|
430 @SYMTestExpectedResults Test must not fail |
|
431 @SYMREQ REQ8782 |
|
432 */ |
|
433 void SqliteSingleSelectTest(TPerfTestMode aPerfTestMode, const char aSingleSelectSql[], TInt aSelectRecId) |
|
434 { |
|
435 int err; |
|
436 const char* tail = 0; |
|
437 sqlite3_stmt* stmt = 0; |
|
438 int recCnt = 0; |
|
439 unsigned int fc; |
|
440 char tmp[10]; |
|
441 |
|
442 TEST(aPerfTestMode > EPerfTestSqlMode && aPerfTestMode < EPerfTestModeCnt); |
|
443 TEST(!TheDb2); |
|
444 err = sqlite3_open(TestDbName(), &TheDb2); |
|
445 TEST2(err, SQLITE_OK); |
|
446 ExecSqliteConfig(aPerfTestMode); |
|
447 |
|
448 sprintf(tmp, "%d", aSelectRecId); |
|
449 strcpy(TheSqlBuf2, aSingleSelectSql); |
|
450 strcat(TheSqlBuf2, tmp); |
|
451 |
|
452 err = sqlite3_prepare(TheDb2, TheSqlBuf2, -1, &stmt, &tail); |
|
453 TEST2(err, SQLITE_OK); |
|
454 |
|
455 fc = FastCounterValue(); |
|
456 while((err = sqlite3_step(stmt)) == SQLITE_ROW) |
|
457 { |
|
458 __int64 i64; |
|
459 double d; |
|
460 const unsigned short* t; |
|
461 const unsigned char* b; |
|
462 |
|
463 i64 = sqlite3_column_int64(stmt, 0); |
|
464 UNUSED_VAR(i64); |
|
465 d = sqlite3_column_double(stmt, 1); |
|
466 UNUSED_VAR(d); |
|
467 t = (const unsigned short*)sqlite3_column_text16(stmt, 2); |
|
468 UNUSED_VAR(t); |
|
469 b = (const unsigned char*)sqlite3_column_blob(stmt, 3); |
|
470 UNUSED_VAR(b); |
|
471 ++recCnt; |
|
472 } |
|
473 StorePerfTestResult(aPerfTestMode, EPerfTestSingleSelect, FastCounterValue() - fc); |
|
474 TEST2(err, SQLITE_DONE); |
|
475 TEST2(recCnt, 1); |
|
476 |
|
477 sqlite3_finalize(stmt); |
|
478 sqlite3_close(TheDb2); |
|
479 TheDb2 = 0; |
|
480 } |
|
481 |
|
482 void SqliteInitialize(TPerfTestMode aMode) |
|
483 { |
|
484 if(aMode == EPerfTestSqliteSqlMode) |
|
485 { |
|
486 const TInt KSqliteLookAsideCellSize = 128; |
|
487 const TInt KSqliteLookAsideCellCount = 512; |
|
488 int err; |
|
489 err = sqlite3_config(SQLITE_CONFIG_LOOKASIDE, KSqliteLookAsideCellSize, KSqliteLookAsideCellCount); |
|
490 TEST2(err, SQLITE_OK); |
|
491 sqlite3_soft_heap_limit(1024 * 1024); |
|
492 err = sqlite3_enable_shared_cache(1); |
|
493 TEST2(err, SQLITE_OK); |
|
494 } |
|
495 } |
|
496 |
|
497 void SqliteFinalize(TPerfTestMode aMode) |
|
498 { |
|
499 if(aMode == EPerfTestSqliteSqlMode) |
|
500 { |
|
501 (void)sqlite3_enable_shared_cache(0); |
|
502 sqlite3_soft_heap_limit(0); |
|
503 } |
|
504 sqlite3_shutdown(); |
|
505 } |