1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sql/TEST/t_sqloom.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,565 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "t_sqloom.h"
1.20 +
1.21 +///////////////////////////////////////////////////////////////////////////////////////
1.22 +/////////////// RSqlDatabase OOM tests ////////////////////////////////
1.23 +///////////////////////////////////////////////////////////////////////////////////////
1.24 +
1.25 +/**
1.26 +@SYMTestCaseID SYSLIB-SQL-CT-1615, SYSLIB-SQL-CT-1639
1.27 +@SYMTestCaseDesc RSqlDatabase::Create() OOM test - secure and non-secure databases.
1.28 + Precondition: the database does not exist.
1.29 + The test calls RSqlDatabase::Create() while simulating OOM failures and checks
1.30 + that there are no memory and resource leaks.
1.31 + Note: It's possible for a database to be created even after memory allocation
1.32 + has failed. This is because SQLITE reuses some pages of the page cache which
1.33 + have been allocated but are curently not in use. This means it is necessary
1.34 + to delete the database and continue checking for memory and resource leaks
1.35 + even after a database has been created successfully.
1.36 +@SYMTestPriority High
1.37 +@SYMTestActions RSqlDatabase::Create() OOM test
1.38 +@SYMTestExpectedResults Test must not fail
1.39 +@SYMREQ REQ5792
1.40 + REQ5793
1.41 + REQ10271
1.42 + REQ10273
1.43 + REQ10274
1.44 +*/
1.45 +void DoCreateDatabaseOomTest(const TDesC& aDbFileName, TDbType aDbType, TInt aExpectedError, const TDesC8* aConfigStr = NULL)
1.46 + {
1.47 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1639 RSqlDatabase::Create() - OOM test"));
1.48 + RSqlSecurityPolicy securityPolicy;
1.49 + CreateTestSecurityPolicy(securityPolicy);
1.50 + enum TMethodType {ENonLeavingMethod, ELeavingMethod};
1.51 + const TMethodType KMethodType[] = {ENonLeavingMethod, ELeavingMethod};
1.52 + for(TInt j=0;j<sizeof(KMethodType)/sizeof(KMethodType[0]);++j)
1.53 + {
1.54 + for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
1.55 + {
1.56 + if(aExpectedError != KErrAlreadyExists)
1.57 + {
1.58 + (void)RSqlDatabase::Delete(aDbFileName);
1.59 + }
1.60 + TInt err = KErrNone;
1.61 + TInt failingAllocationNo = 0;
1.62 + TInt allocationNo = 0;
1.63 + TInt maxAllocationNo = TheOomTestType[i] == EServerSideTest ? KDoCreateDatabaseOomTestAllocLimitServer : KDoCreateDatabaseOomTestAllocLimitClient;
1.64 + while(allocationNo < maxAllocationNo)
1.65 + {
1.66 + MarkHandles();
1.67 + MarkAllocatedCells();
1.68 +
1.69 + __UHEAP_MARK;
1.70 +
1.71 + RSqlDatabase db;
1.72 +
1.73 + SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
1.74 +
1.75 + if(KMethodType[j] == ENonLeavingMethod)
1.76 + {
1.77 + err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy, aConfigStr) : db.Create(aDbFileName, aConfigStr);
1.78 + }
1.79 + else
1.80 + {
1.81 + TRAP(err, aDbType == ESecureDb ? db.CreateL(aDbFileName, securityPolicy, aConfigStr) : db.CreateL(aDbFileName, aConfigStr));
1.82 + }
1.83 +
1.84 + db.Close();
1.85 + if(err != KErrNoMemory)
1.86 + {
1.87 + TEST2(err, aExpectedError);
1.88 + }
1.89 + else
1.90 + {
1.91 + failingAllocationNo = allocationNo;
1.92 + }
1.93 +
1.94 + ResetDbHeapFailure(TheOomTestType[i]);
1.95 +
1.96 + if(err == KErrNone && aExpectedError != KErrAlreadyExists)
1.97 + {
1.98 + err = db.Delete(aDbFileName);
1.99 + TEST2(err, KErrNone);
1.100 + }
1.101 +
1.102 + __UHEAP_MARKEND;
1.103 +
1.104 + CheckAllocatedCells();
1.105 + CheckHandles();
1.106 +
1.107 + if(err == KErrNoMemory && allocationNo == maxAllocationNo)
1.108 + {
1.109 + maxAllocationNo += 10;
1.110 + }
1.111 + }
1.112 + TEST2(err, aExpectedError);
1.113 + PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo + 1);
1.114 + }
1.115 + }
1.116 + RSqlDatabase::Delete(aDbFileName);
1.117 + securityPolicy.Close();
1.118 + }
1.119 +
1.120 +//"RSqlDatabase::Open()" OOM test
1.121 +void OpenDatabaseL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.122 + {
1.123 + TInt err = aDb.Open(aDbFileName);
1.124 + User::LeaveIfError(err);
1.125 + }
1.126 +
1.127 +//"RSqlDatabase::OpenL()" OOM test
1.128 +void OpenDatabase2L(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.129 + {
1.130 + aDb.OpenL(aDbFileName);
1.131 + }
1.132 +
1.133 +//"RSqlDatabase::Open()" + config string OOM test
1.134 +void OpenDatabase3L(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.135 + {
1.136 + _LIT8(KConfig, "cache_size=128;compaction=auto");
1.137 + TInt err = aDb.Open(aDbFileName, &KConfig);
1.138 + User::LeaveIfError(err);
1.139 + }
1.140 +
1.141 +//"RSqlDatabase::Open() - from handle" OOM test
1.142 +void OpenDatabaseFromHandleL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.143 + {
1.144 + TInt err = aDb.Open(aDbFileName);
1.145 + User::LeaveIfError(err);
1.146 + }
1.147 +
1.148 +//"RSqlDatabase::Open() - from handle + config string" OOM test
1.149 +void OpenDatabaseFromHandle2L(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.150 + {
1.151 + _LIT8(KConfig, "cache_size=128;compaction=background");
1.152 + TInt err = aDb.Open(aDbFileName, &KConfig);
1.153 + User::LeaveIfError(err);
1.154 + }
1.155 +
1.156 +//"RSqlDatabase::Exec()" OOM test (8-bit SQL statements)
1.157 +void ExecStatement8L(RSqlDatabase& aDb, const TDesC&, TDbType)
1.158 + {
1.159 + _LIT8(KSqlString, "BEGIN;\
1.160 + CREATE TABLE BBB(Fld1 INTEGER, Fld2 BIGINT, Fld3 DOUBLE, Fld4 TEXT);\
1.161 + INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(4562, 123456789012345, 78612.0091, 'text data');\
1.162 + COMMIT;");
1.163 + TInt err = aDb.Exec(KSqlString);
1.164 + User::LeaveIfError(err);
1.165 + }
1.166 +
1.167 +//"RSqlDatabase::Exec()" OOM test (16-bit SQL statements)
1.168 +void ExecStatement16L(RSqlDatabase& aDb, const TDesC&, TDbType)
1.169 + {
1.170 + _LIT(KSqlString, "BEGIN;\
1.171 + CREATE TABLE BBB(Fld1 INTEGER, Fld2 BIGINT, Fld3 DOUBLE, Fld4 TEXT);\
1.172 + INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(4562, 123456789012345, 78612.0091, 'text data');\
1.173 + COMMIT;");
1.174 + TInt err = aDb.Exec(KSqlString);
1.175 + User::LeaveIfError(err);
1.176 + }
1.177 +
1.178 +//"RSqlDatabase::SetIsolationLevel()" OOM test
1.179 +void SetIsolationLevelL(RSqlDatabase& aDb, const TDesC&, TDbType)
1.180 + {
1.181 + TInt err = aDb.SetIsolationLevel(RSqlDatabase::EReadUncommitted);
1.182 + User::LeaveIfError(err);
1.183 + }
1.184 +
1.185 +//"RSqlDatabase::Size()" OOM test
1.186 +void DbSizeL(RSqlDatabase& aDb, const TDesC&, TDbType)
1.187 + {
1.188 + TInt rc = aDb.Size();
1.189 + User::LeaveIfError(rc);
1.190 + }
1.191 +
1.192 +//"RSqlDatabase::Size(TSize&)" OOM test
1.193 +void DbSize2L(RSqlDatabase& aDb, const TDesC&, TDbType)
1.194 + {
1.195 + RSqlDatabase::TSize size;
1.196 + TInt err = aDb.Size(size);
1.197 + User::LeaveIfError(err);
1.198 + }
1.199 +
1.200 +//"RSqlDatabase::Size(TSize&)" OOM test - attached database
1.201 +void DbAttachSize2L(RSqlDatabase& aDb, const TDesC& aDbName, TDbType)
1.202 + {
1.203 + _LIT(KAttachDbName, "HHH");
1.204 + TInt err = aDb.Attach(aDbName, KAttachDbName);
1.205 + User::LeaveIfError(err);
1.206 + RSqlDatabase::TSize size;
1.207 + err = aDb.Size(size, KAttachDbName);
1.208 + (void)aDb.Detach(KAttachDbName);
1.209 + User::LeaveIfError(err);
1.210 + }
1.211 +
1.212 +//"RSqlDatabase::Delete()" OOM test
1.213 +void DeleteDbL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.214 + {
1.215 + aDb.Close();
1.216 + TInt err = RSqlDatabase::Delete(aDbFileName);
1.217 + User::LeaveIfError(err);
1.218 + }
1.219 +
1.220 +//"RSqlDatabase::Attach()" OOM test
1.221 +void AttachDatabaseL(RSqlDatabase& aDb, const TDesC&, TDbType aDbType)
1.222 + {
1.223 + _LIT(KDbName, "Db2");
1.224 + TInt err = KErrNone;
1.225 + if(aDbType == ESecureDb)
1.226 + {
1.227 + err = aDb.Attach(KSecureTestDb, KDbName);
1.228 + }
1.229 + else
1.230 + {
1.231 + err = aDb.Attach(KAttachDb, KDbName);
1.232 + }
1.233 + User::LeaveIfError(err);
1.234 + err = aDb.Detach(KDbName);
1.235 + User::LeaveIfError(err);
1.236 + }
1.237 +
1.238 +//"RSqlDatabase::Attach() - from handle" OOM test
1.239 +void AttachDatabase2L(RSqlDatabase& aDb, const TDesC&, TDbType)
1.240 + {
1.241 + _LIT(KDbName, "Db2");
1.242 + TInt err = aDb.Attach(KPrivateTestDb, KDbName);
1.243 + User::LeaveIfError(err);
1.244 + err = aDb.Detach(KDbName);
1.245 + User::LeaveIfError(err);
1.246 + }
1.247 +
1.248 +//"RSqlDatabase::Copy()" OOM test
1.249 +void CopyDatabaseL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
1.250 + {
1.251 + aDb.Close();
1.252 + TInt err = RSqlDatabase::Copy(aDbFileName,aDbFileName);
1.253 + User::LeaveIfError(err);
1.254 + }
1.255 +
1.256 +//"RSqlDatabase::GetSecurityPolicy()" OOM test
1.257 +void GetSecurityPolicyL(RSqlDatabase& aDb, const TDesC&, TDbType)
1.258 + {
1.259 + RSqlSecurityPolicy policy;
1.260 + TInt err = aDb.GetSecurityPolicy(policy);
1.261 + policy.Close();
1.262 + User::LeaveIfError(err);
1.263 + }
1.264 +
1.265 +//"RSqlDatabase::GetSecurityPolicyL()" OOM test
1.266 +void GetSecurityPolicy2L(RSqlDatabase& aDb, const TDesC&, TDbType)
1.267 + {
1.268 + RSqlSecurityPolicy policy;
1.269 + CleanupClosePushL(policy);
1.270 + aDb.GetSecurityPolicyL(policy);
1.271 + CleanupStack::PopAndDestroy(&policy);
1.272 + }
1.273 +
1.274 +//"RSqlDatabase::ReserveDriveSpace()" OOM test
1.275 +void ReserveDriveSpaceL(RSqlDatabase& aDb, const TDesC&, TDbType)
1.276 + {
1.277 + TInt err = aDb.ReserveDriveSpace(0);
1.278 + User::LeaveIfError(err);
1.279 + aDb.FreeReservedSpace();
1.280 + }
1.281 +
1.282 +//"RSqlDatabase::GetReserveAccess()" OOM test
1.283 +void GetReserveAccessL(RSqlDatabase& aDb, const TDesC&, TDbType)
1.284 + {
1.285 + TInt err = aDb.ReserveDriveSpace(0);
1.286 + User::LeaveIfError(err);
1.287 + err = aDb.GetReserveAccess();
1.288 + User::LeaveIfError(err);
1.289 + aDb.ReleaseReserveAccess();
1.290 + aDb.FreeReservedSpace();
1.291 + }
1.292 +
1.293 +//"RSqlDatabase::LastInsertedRowId()" OOM test
1.294 +void DbLastInsertedRowIdL(RSqlDatabase& aDb, const TDesC&, TDbType)
1.295 + {
1.296 + TInt64 rowid = aDb.LastInsertedRowId();
1.297 + User::LeaveIfError(rowid);
1.298 + }
1.299 +
1.300 +
1.301 +
1.302 +/**
1.303 +@SYMTestCaseID SYSLIB-SQL-CT-1616
1.304 +@SYMTestCaseDesc RSqlDatabase methods OOM test
1.305 + Precondition: the database exists.
1.306 + The test calls the given as an argument function while simulating OOM failures
1.307 + and checks that there are no memory and resource leaks.
1.308 + Note: It's possible for database operations to be performed even after memory
1.309 + allocation has failed. This is because SQLITE reuses some pages of the page
1.310 + cache which have been allocated but are curently not in use. This means it is
1.311 + necessary to undo any operations on the database and continue checking for
1.312 + memory and resource leaks even after an operation has been completed successfully.
1.313 +@SYMTestPriority High
1.314 +@SYMTestActions RSqlDatabase methods OOM tests
1.315 +@SYMTestExpectedResults Test must not fail
1.316 +@SYMDEF DEF105444
1.317 +*/
1.318 +void DoDbOomTest(TDbFuncPtrL aTestFunctionPtrL, const TDesC& aDbFileName, TDbAction aDbAction, TDbType aDbType)
1.319 + {
1.320 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1616 RSqlDatabase - OOM test"));
1.321 + RSqlSecurityPolicy securityPolicy;
1.322 + CreateTestSecurityPolicy(securityPolicy);
1.323 + for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
1.324 + {
1.325 + //Recreate the database file
1.326 + RSqlDatabase::Delete(aDbFileName);
1.327 + RSqlDatabase db;
1.328 + TInt err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
1.329 + db.Close();
1.330 + TEST2(err, KErrNone);
1.331 +
1.332 + TInt failingAllocationNo = 0;
1.333 + TInt allocationNo = 0;
1.334 + TInt maxAllocationNo = TheOomTestType[i] == EServerSideTest ? KDoDbOomTestAllocLimitServer : KDoDbOomTestAllocLimitClient;
1.335 + while(allocationNo < maxAllocationNo)
1.336 + {
1.337 + MarkHandles();
1.338 + MarkAllocatedCells();
1.339 +
1.340 + __UHEAP_MARK;
1.341 +
1.342 + if(TheOomTestType[i] == EServerSideTest)
1.343 + {//If aDbAction is EOpenDb, then we will delay the heap failure simulation, until the database is opened
1.344 + SetDbHeapFailure(TheOomTestType[i], ++allocationNo, aDbAction == EOpenDb);
1.345 + }
1.346 +
1.347 + //if aDbAction is EOpenDb then this is a OOM test different than a test for RSqlDatabase::Open
1.348 + if(aDbAction == EOpenDb)
1.349 + {
1.350 + err = db.Open(aDbFileName);
1.351 + TEST2(err, KErrNone);
1.352 + }
1.353 +
1.354 + if(TheOomTestType[i] == EClientSideTest)
1.355 + {
1.356 + SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
1.357 + }
1.358 +
1.359 + TRAP(err, (*aTestFunctionPtrL)(db, aDbFileName, aDbType));
1.360 + if(err != KErrNoMemory)
1.361 + {
1.362 + TEST2(err, KErrNone);
1.363 + }
1.364 + else
1.365 + {
1.366 + failingAllocationNo = allocationNo;
1.367 + }
1.368 +
1.369 + ResetDbHeapFailure(TheOomTestType[i]);
1.370 +
1.371 + if(aTestFunctionPtrL == &ExecStatement8L || aTestFunctionPtrL == &ExecStatement16L)
1.372 + {
1.373 + _LIT(KSqlDropString, "DROP TABLE IF EXISTS BBB;");
1.374 + err = db.Exec(KSqlDropString);
1.375 + TEST(err >= 0);
1.376 + err = KErrNone;
1.377 + }
1.378 + else if(aTestFunctionPtrL == &DeleteDbL && err == KErrNone)
1.379 + {
1.380 + err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
1.381 + TEST2(err, KErrNone);
1.382 + }
1.383 + db.Close();
1.384 +
1.385 + __UHEAP_MARKEND;
1.386 +
1.387 + CheckAllocatedCells();
1.388 + CheckHandles();
1.389 +
1.390 + if(err == KErrNoMemory && allocationNo == maxAllocationNo)
1.391 + {
1.392 + maxAllocationNo += 10;
1.393 + }
1.394 + }
1.395 + TEST2(err, KErrNone);
1.396 + PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo + 1);
1.397 + }
1.398 + //Delete the database file
1.399 + RSqlDatabase::Delete(aDbFileName);
1.400 + securityPolicy.Close();
1.401 + }
1.402 +
1.403 +//An attempt to open a non-secure database somehow happened to be in the server's private data cage.
1.404 +void DoDbOomTest2()
1.405 + {
1.406 + for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
1.407 + {
1.408 + TInt err = KErrNone;
1.409 + TInt failingAllocationNo = 0;
1.410 + TInt allocationNo = 0;
1.411 + TInt maxAllocationNo = TheOomTestType[i] == EServerSideTest ? KDoDbOomTest2AllocLimitServer : KDoDbOomTest2AllocLimitClient;
1.412 + while(allocationNo < maxAllocationNo)
1.413 + {
1.414 + MarkHandles();
1.415 + MarkAllocatedCells();
1.416 +
1.417 + __UHEAP_MARK;
1.418 +
1.419 + SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
1.420 +
1.421 + RSqlDatabase db;
1.422 + err = db.Open(KSecureAttachDb2);
1.423 + db.Close();
1.424 + if(err != KErrNoMemory)
1.425 + {
1.426 + TEST2(err, KSqlErrGeneral);
1.427 + }
1.428 + else
1.429 + {
1.430 + failingAllocationNo = allocationNo;
1.431 + }
1.432 +
1.433 + ResetDbHeapFailure(TheOomTestType[i]);
1.434 +
1.435 + __UHEAP_MARKEND;
1.436 +
1.437 + CheckAllocatedCells();
1.438 + CheckHandles();
1.439 +
1.440 + if(err == KErrNoMemory && allocationNo == maxAllocationNo)
1.441 + {
1.442 + maxAllocationNo += 10;
1.443 + }
1.444 + }
1.445 + TEST2(err, KSqlErrGeneral);
1.446 + PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo + 1);
1.447 + }
1.448 + }
1.449 +
1.450 +///////////////////////////////////////////////////////////////////////////////////////
1.451 +///////////////////////////////////////////////////////////////////////////////////////
1.452 +
1.453 +//RSqlDatabase OOM tests
1.454 +void DbOomTestsL(TDbType aDbType)
1.455 + {
1.456 + TPtrC dbFileName(KTestDb);
1.457 + if(aDbType == ESecureDb)
1.458 + {
1.459 + dbFileName.Set(KSecureTestDb());
1.460 + }
1.461 +
1.462 + CreateAttachDb();
1.463 +
1.464 + TheTest.Printf(_L("===RSqlDatabase::Create()\r\n"));
1.465 + DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone);
1.466 +
1.467 + TheTest.Printf(_L("===RSqlDatabase::Create() + config string\r\n"));
1.468 + _LIT8(KConfigStr, "page_size=2048");
1.469 + DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr);
1.470 +
1.471 + TheTest.Printf(_L("===RSqlDatabase::Create() + config string + manual compaction\r\n"));
1.472 + _LIT8(KConfigStr2, "compaction=manual");
1.473 + DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr2);
1.474 +
1.475 + TheTest.Printf(_L("===RSqlDatabase::Create() + config string + background compaction\r\n"));
1.476 + _LIT8(KConfigStr3, "compaction=background");
1.477 + DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr3);
1.478 +
1.479 + TheTest.Printf(_L("===RSqlDatabase::Create() + config string + auto compaction\r\n"));
1.480 + _LIT8(KConfigStr4, "compaction=auto");
1.481 + DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr4);
1.482 +
1.483 + if(aDbType == ENonSecureDb)
1.484 + {//Private database is not a database taht will be created in the SQL server private data cage.
1.485 + (void)RSqlDatabase::Delete(KPrivateTestDb);
1.486 + TheTest.Printf(_L("===RSqlDatabase::Create() private database + config string + manual compaction\r\n"));
1.487 + DoCreateDatabaseOomTest(KPrivateTestDb, ENonSecureDb, KErrNone, &KConfigStr2);
1.488 +
1.489 + (void)RSqlDatabase::Delete(KPrivateTestDb);
1.490 + TheTest.Printf(_L("===RSqlDatabase::Create() private database + config string + background compaction\r\n"));
1.491 + DoCreateDatabaseOomTest(KPrivateTestDb, ENonSecureDb, KErrNone, &KConfigStr3);
1.492 +
1.493 + (void)RSqlDatabase::Delete(KPrivateTestDb);
1.494 + TheTest.Printf(_L("===RSqlDatabase::Create() private database + config string + auto compaction\r\n"));
1.495 + DoCreateDatabaseOomTest(KPrivateTestDb, ENonSecureDb, KErrNone, &KConfigStr4);
1.496 + }
1.497 +
1.498 + TheTest.Printf(_L("===RSqlDatabase::Open()\r\n"));
1.499 + DoDbOomTest(&OpenDatabaseL, dbFileName, ENotOpenDb, aDbType);
1.500 +
1.501 + TheTest.Printf(_L("===RSqlDatabase::OpenL()\r\n"));
1.502 + DoDbOomTest(&OpenDatabase2L, dbFileName, ENotOpenDb, aDbType);
1.503 +
1.504 + TheTest.Printf(_L("===RSqlDatabase::Open() + config string\r\n"));
1.505 + DoDbOomTest(&OpenDatabase3L, dbFileName, ENotOpenDb, aDbType);
1.506 +
1.507 + if(aDbType == ENonSecureDb)
1.508 + {//Private database cannot be opened as a secure database
1.509 + TheTest.Printf(_L("===RSqlDatabase::Open() - from handle\r\n"));
1.510 + DoDbOomTest(&OpenDatabaseFromHandleL, KPrivateTestDb, ENotOpenDb, aDbType);
1.511 +
1.512 + TheTest.Printf(_L("===RSqlDatabase::Open() - from handle + config string\r\n"));
1.513 + DoDbOomTest(&OpenDatabaseFromHandle2L, KPrivateTestDb, ENotOpenDb, aDbType);
1.514 + }
1.515 +
1.516 + TheTest.Printf(_L("===RSqlDatabase::Exec(), 8-bit SQL\r\n"));
1.517 + DoDbOomTest(&ExecStatement8L, dbFileName, EOpenDb, aDbType);
1.518 +
1.519 + TheTest.Printf(_L("===RSqlDatabase::Exec(), 16-bit SQL\r\n"));
1.520 + DoDbOomTest(&ExecStatement16L, dbFileName, EOpenDb, aDbType);
1.521 +
1.522 + TheTest.Printf(_L("===RSqlDatabase::SetIsolationLevel()\r\n"));
1.523 + DoDbOomTest(&SetIsolationLevelL, dbFileName, EOpenDb, aDbType);
1.524 +
1.525 + TheTest.Printf(_L("===RSqlDatabase::Size()\r\n"));
1.526 + DoDbOomTest(&DbSizeL, dbFileName, EOpenDb, aDbType);
1.527 +
1.528 + TheTest.Printf(_L("===RSqlDatabase::Size(TSize&)\r\n"));
1.529 + DoDbOomTest(&DbSize2L, dbFileName, EOpenDb, aDbType);
1.530 +
1.531 + TheTest.Printf(_L("===RSqlDatabase::Size(TSize&) - attached database\r\n"));
1.532 + DoDbOomTest(&DbAttachSize2L, dbFileName, EOpenDb, aDbType);
1.533 +
1.534 + TheTest.Printf(_L("===RSqlDatabase::Delete()\r\n"));
1.535 + DoDbOomTest(&DeleteDbL, dbFileName, ENotOpenDb, aDbType);
1.536 +
1.537 + TheTest.Printf(_L("===RSqlDatabase::Attach()\r\n"));
1.538 + DoDbOomTest(&AttachDatabaseL, dbFileName, EOpenDb, aDbType);
1.539 +
1.540 + //Ensure that the private database to be attached exists
1.541 + PrepareAttachFromHandle();
1.542 + TheTest.Printf(_L("===RSqlDatabase::Attach() - from handle\r\n"));
1.543 + DoDbOomTest(&AttachDatabase2L, dbFileName, EOpenDb, aDbType);
1.544 +
1.545 + TheTest.Printf(_L("===RSqlDatabase::Copy()\r\n"));
1.546 + DoDbOomTest(&CopyDatabaseL, dbFileName, ENotOpenDb, aDbType);
1.547 +
1.548 + if(aDbType == ESecureDb)
1.549 + {
1.550 + TheTest.Printf(_L("===RSqlDatabase::GetSecurityPolicy()\r\n"));
1.551 + DoDbOomTest(&GetSecurityPolicyL, dbFileName, EOpenDb, aDbType);
1.552 +
1.553 + TheTest.Printf(_L("===RSqlDatabase::GetSecurityPolicyL()\r\n"));
1.554 + DoDbOomTest(&GetSecurityPolicy2L, dbFileName, EOpenDb, aDbType);
1.555 + }
1.556 +
1.557 + TheTest.Printf(_L("===RSqlDatabase::ReserveDriveSpace()\r\n"));
1.558 + DoDbOomTest(&ReserveDriveSpaceL, dbFileName, EOpenDb, aDbType);
1.559 +
1.560 + TheTest.Printf(_L("===RSqlDatabase::GetReserveAccess()\r\n"));
1.561 + DoDbOomTest(&GetReserveAccessL, dbFileName, EOpenDb, aDbType);
1.562 +
1.563 + TheTest.Printf(_L("===RSqlDatabase::LastInsertedRowId()\r\n"));
1.564 + DoDbOomTest(&DbLastInsertedRowIdL, dbFileName, EOpenDb, aDbType);
1.565 +
1.566 + TheTest.Printf(_L("===RSqlDatabase::Open(), non-secure database in server data cage\r\n"));
1.567 + DoDbOomTest2();
1.568 + }