119 REQ10402 |
119 REQ10402 |
120 */ |
120 */ |
121 void CompactConfigTest1L() |
121 void CompactConfigTest1L() |
122 { |
122 { |
123 //Create a test database with "manual" compaction mode |
123 //Create a test database with "manual" compaction mode |
124 _LIT8(KConfigStr1, "encoding=utf8;compaction=manual"); |
124 _LIT8(KConfigStr1, "encoding=utf-8;compaction=manual"); |
125 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
125 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
126 TEST2(err, KErrNone); |
126 TEST2(err, KErrNone); |
127 //Check the vacuum mode. The SQLite vacuum mode should be "incremental" |
127 //Check the vacuum mode. The SQLite vacuum mode should be "incremental" |
128 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
128 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
129 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
129 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
164 REQ10400 |
164 REQ10400 |
165 */ |
165 */ |
166 void CompactConfigTest2L() |
166 void CompactConfigTest2L() |
167 { |
167 { |
168 //Create a test database with "auto" compaction mode |
168 //Create a test database with "auto" compaction mode |
169 _LIT8(KConfigStr1, "encoding=utf8;compaction=auto"); |
169 _LIT8(KConfigStr1, "encoding=utf-8;compaction=auto"); |
170 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
170 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
171 TEST2(err, KErrNone); |
171 TEST2(err, KErrNone); |
172 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
172 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
173 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
173 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
174 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
174 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
175 TEST2(compact, KAutoVacuum); |
175 TEST2(compact, KAutoVacuum); |
176 TheDb.Close(); |
176 TheDb.Close(); |
177 //Create a test database with "synchronous" compaction mode |
177 //Create a test database with "synchronous" compaction mode |
178 err = RSqlDatabase::Delete(KTestDbName1); |
178 err = RSqlDatabase::Delete(KTestDbName1); |
179 TEST2(err, KErrNone); |
179 TEST2(err, KErrNone); |
180 _LIT8(KConfigStr3, "encoding=utf8;compaction=synchronous"); |
180 _LIT8(KConfigStr3, "encoding=utf-8;compaction=synchronous"); |
181 err = TheDb.Create(KTestDbName1, &KConfigStr3); |
181 err = TheDb.Create(KTestDbName1, &KConfigStr3); |
182 TEST2(err, KErrNone); |
182 TEST2(err, KErrNone); |
183 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
183 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
184 scalarQuery.SetDatabase(TheDb); |
184 scalarQuery.SetDatabase(TheDb); |
185 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
185 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
219 @SYMREQ REQ10274 |
219 @SYMREQ REQ10274 |
220 */ |
220 */ |
221 void CompactConfigTest3L() |
221 void CompactConfigTest3L() |
222 { |
222 { |
223 //Create a test database with "background" compaction mode |
223 //Create a test database with "background" compaction mode |
224 _LIT8(KConfigStr1, "encoding=utf8;compaction=background"); |
224 _LIT8(KConfigStr1, "encoding=utf-8;compaction=background"); |
225 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
225 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
226 TEST2(err, KErrNone); |
226 TEST2(err, KErrNone); |
227 //Check the vacuum mode. The SQLite vacuum mode should be "incremental" |
227 //Check the vacuum mode. The SQLite vacuum mode should be "incremental" |
228 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
228 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
229 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
229 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
276 TheDb.Close(); |
276 TheDb.Close(); |
277 //Delete database |
277 //Delete database |
278 err = RSqlDatabase::Delete(KTestDbName1); |
278 err = RSqlDatabase::Delete(KTestDbName1); |
279 TEST2(err, KErrNone); |
279 TEST2(err, KErrNone); |
280 //Create a test database with invalid configuration string |
280 //Create a test database with invalid configuration string |
281 _LIT8(KConfigStr1, "encoding=utf8;compaction=backgrund"); |
281 _LIT8(KConfigStr1, "encoding=utf-8;compaction=backgrund"); |
282 err = TheDb.Create(KTestDbName1, &KConfigStr1); |
282 err = TheDb.Create(KTestDbName1, &KConfigStr1); |
283 TEST2(err, KErrNone); |
283 TEST2(err, KErrNone); |
284 //Check the vacuum mode. The SQLite vacuum mode should be KSqlDefaultVacuum |
284 //Check the vacuum mode. The SQLite vacuum mode should be KSqlDefaultVacuum |
285 scalarQuery.SetDatabase(TheDb); |
285 scalarQuery.SetDatabase(TheDb); |
286 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
286 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
322 REQ10402 |
322 REQ10402 |
323 */ |
323 */ |
324 void CompactConfigTest5L() |
324 void CompactConfigTest5L() |
325 { |
325 { |
326 //Create a private test database with "auto" compaction mode |
326 //Create a private test database with "auto" compaction mode |
327 _LIT8(KConfigStr1, "encoding=utf8;compaction=auto"); |
327 _LIT8(KConfigStr1, "encoding=utf-8;compaction=auto"); |
328 TInt err = TheDb.Create(KTestPrivDbName, &KConfigStr1); |
328 TInt err = TheDb.Create(KTestPrivDbName, &KConfigStr1); |
329 TEST2(err, KErrNone); |
329 TEST2(err, KErrNone); |
330 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
330 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
331 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
331 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
332 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
332 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
454 */ |
454 */ |
455 void CompactConfigTest6L() |
455 void CompactConfigTest6L() |
456 { |
456 { |
457 //Create a secure test database with "auto" compaction mode. |
457 //Create a secure test database with "auto" compaction mode. |
458 RSqlSecurityPolicy securityPolicy = CreateTestSecurityPolicy(); |
458 RSqlSecurityPolicy securityPolicy = CreateTestSecurityPolicy(); |
459 _LIT8(KConfigStr1, "encoding=utf8;compaction=auto"); |
459 _LIT8(KConfigStr1, "encoding=utf-8;compaction=auto"); |
460 TInt err = TheDb.Create(KTestSecureDbName, securityPolicy, &KConfigStr1); |
460 TInt err = TheDb.Create(KTestSecureDbName, securityPolicy, &KConfigStr1); |
461 TEST2(err, KErrNone); |
461 TEST2(err, KErrNone); |
462 securityPolicy.Close(); |
462 securityPolicy.Close(); |
463 TheDb.Close(); |
463 TheDb.Close(); |
464 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
464 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
519 REQ10400 |
519 REQ10400 |
520 */ |
520 */ |
521 void CompactConfigTest7L() |
521 void CompactConfigTest7L() |
522 { |
522 { |
523 //Create a test database with "auto" compaction mode. |
523 //Create a test database with "auto" compaction mode. |
524 _LIT8(KConfigStr1, "encoding=utf8;compaction = auto"); |
524 _LIT8(KConfigStr1, "encoding=utf-8;compaction = auto"); |
525 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
525 TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); |
526 TEST2(err, KErrNone); |
526 TEST2(err, KErrNone); |
527 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
527 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
528 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
528 TSqlScalarFullSelectQuery scalarQuery(TheDb); |
529 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
529 TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
537 TEST2(compact, KAutoVacuum); |
537 TEST2(compact, KAutoVacuum); |
538 TSqlScalarFullSelectQuery scalarQuery2(db2); |
538 TSqlScalarFullSelectQuery scalarQuery2(db2); |
539 compact = scalarQuery2.SelectIntL(_L("PRAGMA auto_vacuum")); |
539 compact = scalarQuery2.SelectIntL(_L("PRAGMA auto_vacuum")); |
540 TEST2(compact, KAutoVacuum); |
540 TEST2(compact, KAutoVacuum); |
541 //Open a third connection to the same database - "background" compaction mode config string |
541 //Open a third connection to the same database - "background" compaction mode config string |
542 _LIT8(KConfigStr2, " encoding = utf8 ; ; ; compaction = background "); |
542 _LIT8(KConfigStr2, " encoding = utf-8 ; ; ; compaction = background "); |
543 RSqlDatabase db3; |
543 RSqlDatabase db3; |
544 err = db3.Open(KTestDbName1, &KConfigStr2); |
544 err = db3.Open(KTestDbName1, &KConfigStr2); |
545 TEST2(err, KErrNone); |
545 TEST2(err, KErrNone); |
546 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
546 //Check the vacuum mode. The SQLite vacuum mode should be "auto" |
547 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
547 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
575 TEST2(compact, KIncrementalVacuum); |
575 TEST2(compact, KIncrementalVacuum); |
576 scalarQuery2.SetDatabase(db2); |
576 scalarQuery2.SetDatabase(db2); |
577 compact = scalarQuery2.SelectIntL(_L("PRAGMA auto_vacuum")); |
577 compact = scalarQuery2.SelectIntL(_L("PRAGMA auto_vacuum")); |
578 TEST2(compact, KIncrementalVacuum); |
578 TEST2(compact, KIncrementalVacuum); |
579 //Open a third connection to the same database - "auto" compaction mode config string |
579 //Open a third connection to the same database - "auto" compaction mode config string |
580 _LIT8(KConfigStr4, " encoding = utf16 ; compaction = auto ; ; ; "); |
580 _LIT8(KConfigStr4, " encoding = utf-16 ; compaction = auto ; ; ; "); |
581 err = db3.Open(KTestDbName1, &KConfigStr4); |
581 err = db3.Open(KTestDbName1, &KConfigStr4); |
582 TEST2(err, KErrNone); |
582 TEST2(err, KErrNone); |
583 //Check the vacuum mode. The SQLite vacuum mode should be "incremental" |
583 //Check the vacuum mode. The SQLite vacuum mode should be "incremental" |
584 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
584 compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); |
585 TEST2(compact, KIncrementalVacuum); |
585 TEST2(compact, KIncrementalVacuum); |