persistentstorage/sql/TEST/t_sqloom.cpp
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2005-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 "t_sqloom.h"
       
    17 
       
    18 ///////////////////////////////////////////////////////////////////////////////////////
       
    19 ///////////////         RSqlDatabase OOM tests         ////////////////////////////////
       
    20 ///////////////////////////////////////////////////////////////////////////////////////
       
    21 
       
    22 /**
       
    23 @SYMTestCaseID			SYSLIB-SQL-CT-1615, SYSLIB-SQL-CT-1639
       
    24 @SYMTestCaseDesc		RSqlDatabase::Create() OOM test - secure and non-secure databases.
       
    25 						Precondition: the database does not exist.
       
    26 						The test calls RSqlDatabase::Create() while simulating OOM failures and checks
       
    27 						that there are no memory and resource leaks.
       
    28 						Note: It's possible for a database to be created even after memory allocation
       
    29 						has failed. This is because SQLITE reuses some pages of the page cache which
       
    30 						have been allocated but are curently not in use. This means it is necessary
       
    31 						to delete the database and continue checking for memory and resource leaks
       
    32 						even after a database has been created successfully.
       
    33 @SYMTestPriority		High
       
    34 @SYMTestActions			RSqlDatabase::Create() OOM test
       
    35 @SYMTestExpectedResults Test must not fail
       
    36 @SYMREQ					REQ5792
       
    37                         REQ5793
       
    38                         REQ10271
       
    39                         REQ10273
       
    40                         REQ10274
       
    41 */
       
    42 void DoCreateDatabaseOomTest(const TDesC& aDbFileName, TDbType aDbType, TInt aExpectedError, const TDesC8* aConfigStr = NULL)
       
    43 	{
       
    44 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1639 RSqlDatabase::Create() - OOM test"));
       
    45 	RSqlSecurityPolicy securityPolicy;
       
    46 	CreateTestSecurityPolicy(securityPolicy);
       
    47 	enum TMethodType {ENonLeavingMethod, ELeavingMethod};
       
    48 	const TMethodType KMethodType[] = {ENonLeavingMethod, ELeavingMethod};
       
    49 	for(TInt j=0;j<sizeof(KMethodType)/sizeof(KMethodType[0]);++j)
       
    50 		{
       
    51 		for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
       
    52 			{
       
    53 			if(aExpectedError != KErrAlreadyExists)
       
    54 				{
       
    55 				(void)RSqlDatabase::Delete(aDbFileName);
       
    56 				}
       
    57 			TInt err = KErrNone;
       
    58 			TInt failingAllocationNo = 0;
       
    59 			TInt allocationNo = 0;
       
    60 			TInt maxAllocationNo = TheOomTestType[i] == EServerSideTest ? KDoCreateDatabaseOomTestAllocLimitServer : KDoCreateDatabaseOomTestAllocLimitClient;
       
    61 			while(allocationNo < maxAllocationNo)
       
    62 				{
       
    63 				MarkHandles();
       
    64 				MarkAllocatedCells();
       
    65 
       
    66 				__UHEAP_MARK;
       
    67 
       
    68 				RSqlDatabase db;
       
    69 
       
    70 				SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
       
    71 
       
    72 				if(KMethodType[j] == ENonLeavingMethod)
       
    73 					{
       
    74 					err =  aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy, aConfigStr) : db.Create(aDbFileName, aConfigStr);
       
    75 					}
       
    76 				else
       
    77 					{
       
    78 					TRAP(err, aDbType == ESecureDb ? db.CreateL(aDbFileName, securityPolicy, aConfigStr) : db.CreateL(aDbFileName, aConfigStr));
       
    79 					}
       
    80 
       
    81 				db.Close();
       
    82 				if(err != KErrNoMemory)
       
    83 					{
       
    84 					TEST2(err, aExpectedError);
       
    85 					}
       
    86 				else
       
    87 					{
       
    88 					failingAllocationNo = allocationNo;
       
    89 					}
       
    90 
       
    91 				ResetDbHeapFailure(TheOomTestType[i]);
       
    92 
       
    93 				if(err == KErrNone && aExpectedError != KErrAlreadyExists)
       
    94 					{
       
    95 					err = db.Delete(aDbFileName);
       
    96 					TEST2(err, KErrNone);
       
    97 					}
       
    98 
       
    99 				__UHEAP_MARKEND;
       
   100 
       
   101 				CheckAllocatedCells();
       
   102 				CheckHandles();
       
   103 				
       
   104 				if(err == KErrNoMemory && allocationNo == maxAllocationNo)
       
   105 					{
       
   106 					maxAllocationNo += 10;
       
   107 					}
       
   108 				}
       
   109 			TEST2(err, aExpectedError);
       
   110 			PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo + 1);
       
   111 			}
       
   112 		}
       
   113 	RSqlDatabase::Delete(aDbFileName);
       
   114 	securityPolicy.Close();
       
   115 	}
       
   116 
       
   117 //"RSqlDatabase::Open()" OOM test
       
   118 void OpenDatabaseL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   119 	{
       
   120 	TInt err = aDb.Open(aDbFileName);
       
   121 	User::LeaveIfError(err);
       
   122 	}
       
   123 
       
   124 //"RSqlDatabase::OpenL()" OOM test
       
   125 void OpenDatabase2L(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   126 	{
       
   127 	aDb.OpenL(aDbFileName);
       
   128 	}
       
   129 
       
   130 //"RSqlDatabase::Open()" + config string OOM test
       
   131 void OpenDatabase3L(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   132 	{
       
   133 	_LIT8(KConfig, "cache_size=128;compaction=auto");
       
   134 	TInt err = aDb.Open(aDbFileName, &KConfig);
       
   135 	User::LeaveIfError(err);
       
   136 	}
       
   137 
       
   138 //"RSqlDatabase::Open() - from handle" OOM test
       
   139 void OpenDatabaseFromHandleL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   140 	{
       
   141 	TInt err = aDb.Open(aDbFileName);
       
   142 	User::LeaveIfError(err);
       
   143 	}
       
   144 
       
   145 //"RSqlDatabase::Open() - from handle + config string" OOM test
       
   146 void OpenDatabaseFromHandle2L(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   147 	{
       
   148 	_LIT8(KConfig, "cache_size=128;compaction=background");
       
   149 	TInt err = aDb.Open(aDbFileName, &KConfig);
       
   150 	User::LeaveIfError(err);
       
   151 	}
       
   152 
       
   153 //"RSqlDatabase::Exec()" OOM test (8-bit SQL statements)
       
   154 void ExecStatement8L(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   155 	{
       
   156 	_LIT8(KSqlString, "BEGIN;\
       
   157 					   CREATE TABLE BBB(Fld1 INTEGER, Fld2 BIGINT, Fld3 DOUBLE, Fld4 TEXT);\
       
   158 	                   INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(4562, 123456789012345, 78612.0091, 'text data');\
       
   159 	                   COMMIT;");
       
   160 	TInt err = aDb.Exec(KSqlString);
       
   161 	User::LeaveIfError(err);
       
   162 	}
       
   163 
       
   164 //"RSqlDatabase::Exec()" OOM test (16-bit SQL statements)
       
   165 void ExecStatement16L(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   166 	{
       
   167 	_LIT(KSqlString, "BEGIN;\
       
   168 					  CREATE TABLE BBB(Fld1 INTEGER, Fld2 BIGINT, Fld3 DOUBLE, Fld4 TEXT);\
       
   169 	                  INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(4562, 123456789012345, 78612.0091, 'text data');\
       
   170 	                  COMMIT;");
       
   171 	TInt err = aDb.Exec(KSqlString);
       
   172 	User::LeaveIfError(err);
       
   173 	}
       
   174 
       
   175 //"RSqlDatabase::SetIsolationLevel()" OOM test
       
   176 void SetIsolationLevelL(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   177 	{
       
   178 	TInt err = aDb.SetIsolationLevel(RSqlDatabase::EReadUncommitted);
       
   179 	User::LeaveIfError(err);
       
   180 	}
       
   181 
       
   182 //"RSqlDatabase::Size()" OOM test
       
   183 void DbSizeL(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   184 	{
       
   185 	TInt rc = aDb.Size();
       
   186 	User::LeaveIfError(rc);
       
   187 	}
       
   188 
       
   189 //"RSqlDatabase::Size(TSize&)" OOM test
       
   190 void DbSize2L(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   191 	{
       
   192 	RSqlDatabase::TSize size;
       
   193 	TInt err = aDb.Size(size);
       
   194 	User::LeaveIfError(err);
       
   195 	}
       
   196 
       
   197 //"RSqlDatabase::Size(TSize&)" OOM test - attached database
       
   198 void DbAttachSize2L(RSqlDatabase& aDb, const TDesC& aDbName, TDbType)
       
   199 	{
       
   200 	_LIT(KAttachDbName, "HHH");
       
   201 	TInt err = aDb.Attach(aDbName, KAttachDbName);
       
   202 	User::LeaveIfError(err);
       
   203 	RSqlDatabase::TSize size;
       
   204 	err = aDb.Size(size, KAttachDbName);
       
   205 	(void)aDb.Detach(KAttachDbName);
       
   206 	User::LeaveIfError(err);
       
   207 	}
       
   208 
       
   209 //"RSqlDatabase::Delete()" OOM test
       
   210 void DeleteDbL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   211 	{
       
   212 	aDb.Close();
       
   213 	TInt err = RSqlDatabase::Delete(aDbFileName);
       
   214 	User::LeaveIfError(err);
       
   215 	}
       
   216 
       
   217 //"RSqlDatabase::Attach()" OOM test
       
   218 void AttachDatabaseL(RSqlDatabase& aDb, const TDesC&, TDbType aDbType)
       
   219 	{
       
   220 	_LIT(KDbName, "Db2");
       
   221 	TInt err = KErrNone;
       
   222 	if(aDbType == ESecureDb)
       
   223 		{
       
   224 		err = aDb.Attach(KSecureTestDb, KDbName);
       
   225 		}
       
   226 	else
       
   227 		{
       
   228 		err = aDb.Attach(KAttachDb, KDbName);
       
   229 		}
       
   230 	User::LeaveIfError(err);
       
   231 	err = aDb.Detach(KDbName);
       
   232 	User::LeaveIfError(err);
       
   233 	}
       
   234 
       
   235 //"RSqlDatabase::Attach() - from handle" OOM test
       
   236 void AttachDatabase2L(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   237 	{
       
   238 	_LIT(KDbName, "Db2");
       
   239 	TInt err = aDb.Attach(KPrivateTestDb, KDbName);
       
   240 	User::LeaveIfError(err);
       
   241 	err = aDb.Detach(KDbName);
       
   242 	User::LeaveIfError(err);
       
   243 	}
       
   244 
       
   245 //"RSqlDatabase::Copy()" OOM test
       
   246 void CopyDatabaseL(RSqlDatabase& aDb, const TDesC& aDbFileName, TDbType)
       
   247 	{
       
   248 	aDb.Close();
       
   249 	TInt err = RSqlDatabase::Copy(aDbFileName,aDbFileName);
       
   250 	User::LeaveIfError(err);
       
   251 	}
       
   252 
       
   253 //"RSqlDatabase::GetSecurityPolicy()" OOM test
       
   254 void GetSecurityPolicyL(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   255 	{
       
   256 	RSqlSecurityPolicy policy;
       
   257 	TInt err = aDb.GetSecurityPolicy(policy);
       
   258 	policy.Close();
       
   259 	User::LeaveIfError(err);
       
   260 	}
       
   261 
       
   262 //"RSqlDatabase::GetSecurityPolicyL()" OOM test
       
   263 void GetSecurityPolicy2L(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   264 	{
       
   265 	RSqlSecurityPolicy policy;
       
   266 	CleanupClosePushL(policy);
       
   267 	aDb.GetSecurityPolicyL(policy);
       
   268 	CleanupStack::PopAndDestroy(&policy);
       
   269 	}
       
   270 
       
   271 //"RSqlDatabase::ReserveDriveSpace()" OOM test
       
   272 void ReserveDriveSpaceL(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   273 	{
       
   274 	TInt err = aDb.ReserveDriveSpace(0);
       
   275 	User::LeaveIfError(err);
       
   276 	aDb.FreeReservedSpace();
       
   277 	}
       
   278 
       
   279 //"RSqlDatabase::GetReserveAccess()" OOM test
       
   280 void GetReserveAccessL(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   281 	{
       
   282 	TInt err = aDb.ReserveDriveSpace(0);
       
   283 	User::LeaveIfError(err);
       
   284 	err = aDb.GetReserveAccess();
       
   285 	User::LeaveIfError(err);
       
   286 	aDb.ReleaseReserveAccess();
       
   287 	aDb.FreeReservedSpace();
       
   288 	}
       
   289 
       
   290 //"RSqlDatabase::LastInsertedRowId()" OOM test
       
   291 void DbLastInsertedRowIdL(RSqlDatabase& aDb, const TDesC&, TDbType)
       
   292 	{
       
   293 	TInt64 rowid = aDb.LastInsertedRowId();
       
   294 	User::LeaveIfError(rowid);
       
   295 	}
       
   296 
       
   297 
       
   298 
       
   299 /**
       
   300 @SYMTestCaseID			SYSLIB-SQL-CT-1616
       
   301 @SYMTestCaseDesc		RSqlDatabase methods OOM test
       
   302 						Precondition: the database exists.
       
   303 						The test calls the given as an argument function while simulating OOM failures
       
   304 						and checks that there are no memory and resource leaks.
       
   305 						Note: It's possible for database operations to be performed even after memory
       
   306 						allocation has failed. This is because SQLITE reuses some pages of the page
       
   307 						cache which have been allocated but are curently not in use. This means it is
       
   308 						necessary to undo any operations on the database and continue checking for
       
   309 						memory and resource leaks even after an operation has been completed successfully.
       
   310 @SYMTestPriority		High
       
   311 @SYMTestActions			RSqlDatabase methods OOM tests
       
   312 @SYMTestExpectedResults Test must not fail
       
   313 @SYMDEF                 DEF105444
       
   314 */
       
   315 void DoDbOomTest(TDbFuncPtrL aTestFunctionPtrL, const TDesC& aDbFileName, TDbAction aDbAction, TDbType aDbType)
       
   316 	{
       
   317 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1616 RSqlDatabase - OOM test"));
       
   318 	RSqlSecurityPolicy securityPolicy;
       
   319 	CreateTestSecurityPolicy(securityPolicy);
       
   320 	for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
       
   321 		{
       
   322 		//Recreate the database file
       
   323 		RSqlDatabase::Delete(aDbFileName);
       
   324 		RSqlDatabase db;
       
   325 		TInt err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
       
   326 		db.Close();
       
   327 		TEST2(err, KErrNone);
       
   328 
       
   329 		TInt failingAllocationNo = 0;
       
   330 		TInt allocationNo = 0;
       
   331 		TInt maxAllocationNo = TheOomTestType[i] == EServerSideTest ? KDoDbOomTestAllocLimitServer : KDoDbOomTestAllocLimitClient;
       
   332 		while(allocationNo < maxAllocationNo)
       
   333 			{
       
   334 			MarkHandles();
       
   335 			MarkAllocatedCells();
       
   336 
       
   337 			__UHEAP_MARK;
       
   338 
       
   339 			if(TheOomTestType[i] == EServerSideTest)
       
   340 				{//If aDbAction is EOpenDb, then we will delay the heap failure simulation, until the database is opened
       
   341 				SetDbHeapFailure(TheOomTestType[i], ++allocationNo, aDbAction == EOpenDb);
       
   342 				}
       
   343 
       
   344 			//if aDbAction is EOpenDb then this is a OOM test different than a test for RSqlDatabase::Open
       
   345 			if(aDbAction == EOpenDb)
       
   346 				{
       
   347 				err = db.Open(aDbFileName);
       
   348 				TEST2(err, KErrNone);
       
   349 				}
       
   350 
       
   351 			if(TheOomTestType[i] == EClientSideTest)
       
   352 				{
       
   353 				SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
       
   354 				}
       
   355 
       
   356 			TRAP(err, (*aTestFunctionPtrL)(db, aDbFileName, aDbType));
       
   357 			if(err != KErrNoMemory)
       
   358 				{
       
   359 				TEST2(err, KErrNone);
       
   360 				}
       
   361 			else
       
   362 				{
       
   363 				failingAllocationNo = allocationNo;
       
   364 				}
       
   365 
       
   366 			ResetDbHeapFailure(TheOomTestType[i]);
       
   367 
       
   368 			if(aTestFunctionPtrL == &ExecStatement8L || aTestFunctionPtrL == &ExecStatement16L)
       
   369 				{
       
   370 				_LIT(KSqlDropString, "DROP TABLE IF EXISTS BBB;");
       
   371 				err = db.Exec(KSqlDropString);
       
   372 				TEST(err >= 0);
       
   373 				err = KErrNone;
       
   374 				}
       
   375 			else if(aTestFunctionPtrL == &DeleteDbL && err == KErrNone)
       
   376 				{
       
   377 				err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
       
   378 				TEST2(err, KErrNone);
       
   379 				}
       
   380 			db.Close();
       
   381 
       
   382 			__UHEAP_MARKEND;
       
   383 
       
   384 			CheckAllocatedCells();
       
   385 			CheckHandles();
       
   386 			
       
   387 			if(err == KErrNoMemory && allocationNo == maxAllocationNo)
       
   388 				{
       
   389 				maxAllocationNo += 10;
       
   390 				}
       
   391 			}
       
   392 		TEST2(err, KErrNone);
       
   393 		PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo + 1);
       
   394 		}
       
   395 	//Delete the database file
       
   396 	RSqlDatabase::Delete(aDbFileName);
       
   397 	securityPolicy.Close();
       
   398 	}
       
   399 
       
   400 //An attempt to open a non-secure database somehow happened to be in the server's private data cage.
       
   401 void DoDbOomTest2()
       
   402 	{
       
   403 	for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
       
   404 		{
       
   405 		TInt err = KErrNone;
       
   406 		TInt failingAllocationNo = 0;
       
   407 		TInt allocationNo = 0;
       
   408 		TInt maxAllocationNo = TheOomTestType[i] == EServerSideTest ? KDoDbOomTest2AllocLimitServer : KDoDbOomTest2AllocLimitClient;
       
   409 		while(allocationNo < maxAllocationNo)
       
   410 			{
       
   411 			MarkHandles();
       
   412 			MarkAllocatedCells();
       
   413 
       
   414 			__UHEAP_MARK;
       
   415 
       
   416 			SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
       
   417 
       
   418 			RSqlDatabase db;
       
   419 			err = db.Open(KSecureAttachDb2);
       
   420 			db.Close();
       
   421 			if(err != KErrNoMemory)
       
   422 				{
       
   423 				TEST2(err, KSqlErrGeneral);
       
   424 				}
       
   425 			else
       
   426 				{
       
   427 				failingAllocationNo = allocationNo;
       
   428 				}
       
   429 
       
   430 			ResetDbHeapFailure(TheOomTestType[i]);
       
   431 
       
   432 			__UHEAP_MARKEND;
       
   433 
       
   434 			CheckAllocatedCells();
       
   435 			CheckHandles();
       
   436 			
       
   437 			if(err == KErrNoMemory && allocationNo == maxAllocationNo)
       
   438 				{
       
   439 				maxAllocationNo += 10;
       
   440 				}
       
   441 			}
       
   442 		TEST2(err, KSqlErrGeneral);
       
   443 		PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo + 1);
       
   444 		}
       
   445 	}
       
   446 
       
   447 ///////////////////////////////////////////////////////////////////////////////////////
       
   448 ///////////////////////////////////////////////////////////////////////////////////////
       
   449 
       
   450 //RSqlDatabase OOM tests
       
   451 void DbOomTestsL(TDbType aDbType)
       
   452 	{
       
   453 	TPtrC dbFileName(KTestDb);
       
   454 	if(aDbType == ESecureDb)
       
   455 		{
       
   456 		dbFileName.Set(KSecureTestDb());
       
   457 		}
       
   458 
       
   459 	CreateAttachDb();
       
   460 
       
   461 	TheTest.Printf(_L("===RSqlDatabase::Create()\r\n"));
       
   462 	DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone);
       
   463 
       
   464 	TheTest.Printf(_L("===RSqlDatabase::Create() + config string\r\n"));
       
   465 	_LIT8(KConfigStr, "page_size=2048");
       
   466 	DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr);
       
   467 
       
   468 	TheTest.Printf(_L("===RSqlDatabase::Create() + config string + manual compaction\r\n"));
       
   469 	_LIT8(KConfigStr2, "compaction=manual");
       
   470 	DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr2);
       
   471 	
       
   472 	TheTest.Printf(_L("===RSqlDatabase::Create() + config string + background compaction\r\n"));
       
   473 	_LIT8(KConfigStr3, "compaction=background");
       
   474 	DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr3);
       
   475 	
       
   476 	TheTest.Printf(_L("===RSqlDatabase::Create() + config string + auto compaction\r\n"));
       
   477 	_LIT8(KConfigStr4, "compaction=auto");
       
   478 	DoCreateDatabaseOomTest(dbFileName, aDbType, KErrNone, &KConfigStr4);
       
   479 
       
   480 	if(aDbType == ENonSecureDb)
       
   481 		{//Private database is not a database taht will be created in the SQL server private data cage.
       
   482 		(void)RSqlDatabase::Delete(KPrivateTestDb);
       
   483 		TheTest.Printf(_L("===RSqlDatabase::Create() private database + config string + manual compaction\r\n"));
       
   484 		DoCreateDatabaseOomTest(KPrivateTestDb, ENonSecureDb, KErrNone, &KConfigStr2);
       
   485 		
       
   486 		(void)RSqlDatabase::Delete(KPrivateTestDb);
       
   487 		TheTest.Printf(_L("===RSqlDatabase::Create() private database + config string + background compaction\r\n"));
       
   488 		DoCreateDatabaseOomTest(KPrivateTestDb, ENonSecureDb, KErrNone, &KConfigStr3);
       
   489 		
       
   490 		(void)RSqlDatabase::Delete(KPrivateTestDb);
       
   491 		TheTest.Printf(_L("===RSqlDatabase::Create() private database + config string + auto compaction\r\n"));
       
   492 		DoCreateDatabaseOomTest(KPrivateTestDb, ENonSecureDb, KErrNone, &KConfigStr4);
       
   493 		}
       
   494 	
       
   495 	TheTest.Printf(_L("===RSqlDatabase::Open()\r\n"));
       
   496 	DoDbOomTest(&OpenDatabaseL, dbFileName, ENotOpenDb, aDbType);
       
   497 
       
   498 	TheTest.Printf(_L("===RSqlDatabase::OpenL()\r\n"));
       
   499 	DoDbOomTest(&OpenDatabase2L, dbFileName, ENotOpenDb, aDbType);
       
   500 
       
   501 	TheTest.Printf(_L("===RSqlDatabase::Open() + config string\r\n"));
       
   502 	DoDbOomTest(&OpenDatabase3L, dbFileName, ENotOpenDb, aDbType);
       
   503 	
       
   504 	if(aDbType == ENonSecureDb)
       
   505 		{//Private database cannot be opened as a secure database
       
   506 		TheTest.Printf(_L("===RSqlDatabase::Open() - from handle\r\n"));
       
   507 		DoDbOomTest(&OpenDatabaseFromHandleL, KPrivateTestDb, ENotOpenDb, aDbType);
       
   508 
       
   509 		TheTest.Printf(_L("===RSqlDatabase::Open() - from handle + config string\r\n"));
       
   510 		DoDbOomTest(&OpenDatabaseFromHandle2L, KPrivateTestDb, ENotOpenDb, aDbType);
       
   511 		}
       
   512 
       
   513 	TheTest.Printf(_L("===RSqlDatabase::Exec(), 8-bit SQL\r\n"));
       
   514 	DoDbOomTest(&ExecStatement8L, dbFileName, EOpenDb, aDbType);
       
   515 
       
   516 	TheTest.Printf(_L("===RSqlDatabase::Exec(), 16-bit SQL\r\n"));
       
   517 	DoDbOomTest(&ExecStatement16L, dbFileName, EOpenDb, aDbType);
       
   518 
       
   519 	TheTest.Printf(_L("===RSqlDatabase::SetIsolationLevel()\r\n"));
       
   520 	DoDbOomTest(&SetIsolationLevelL, dbFileName, EOpenDb, aDbType);
       
   521 
       
   522 	TheTest.Printf(_L("===RSqlDatabase::Size()\r\n"));
       
   523 	DoDbOomTest(&DbSizeL, dbFileName, EOpenDb, aDbType);
       
   524 
       
   525 	TheTest.Printf(_L("===RSqlDatabase::Size(TSize&)\r\n"));
       
   526 	DoDbOomTest(&DbSize2L, dbFileName, EOpenDb, aDbType);
       
   527 
       
   528 	TheTest.Printf(_L("===RSqlDatabase::Size(TSize&) - attached database\r\n"));
       
   529 	DoDbOomTest(&DbAttachSize2L, dbFileName, EOpenDb, aDbType);
       
   530 
       
   531 	TheTest.Printf(_L("===RSqlDatabase::Delete()\r\n"));
       
   532 	DoDbOomTest(&DeleteDbL, dbFileName, ENotOpenDb, aDbType);
       
   533 
       
   534 	TheTest.Printf(_L("===RSqlDatabase::Attach()\r\n"));
       
   535 	DoDbOomTest(&AttachDatabaseL, dbFileName, EOpenDb, aDbType);
       
   536 
       
   537 	//Ensure that the private database to be attached exists
       
   538 	PrepareAttachFromHandle();
       
   539 	TheTest.Printf(_L("===RSqlDatabase::Attach() - from handle\r\n"));
       
   540 	DoDbOomTest(&AttachDatabase2L, dbFileName, EOpenDb, aDbType);
       
   541 
       
   542 	TheTest.Printf(_L("===RSqlDatabase::Copy()\r\n"));
       
   543 	DoDbOomTest(&CopyDatabaseL, dbFileName, ENotOpenDb, aDbType);
       
   544 
       
   545 	if(aDbType == ESecureDb)
       
   546 		{
       
   547 		TheTest.Printf(_L("===RSqlDatabase::GetSecurityPolicy()\r\n"));
       
   548 		DoDbOomTest(&GetSecurityPolicyL, dbFileName, EOpenDb, aDbType);
       
   549 
       
   550 		TheTest.Printf(_L("===RSqlDatabase::GetSecurityPolicyL()\r\n"));
       
   551 		DoDbOomTest(&GetSecurityPolicy2L, dbFileName, EOpenDb, aDbType);
       
   552 		}
       
   553 
       
   554 	TheTest.Printf(_L("===RSqlDatabase::ReserveDriveSpace()\r\n"));
       
   555 	DoDbOomTest(&ReserveDriveSpaceL, dbFileName, EOpenDb, aDbType);
       
   556 
       
   557 	TheTest.Printf(_L("===RSqlDatabase::GetReserveAccess()\r\n"));
       
   558 	DoDbOomTest(&GetReserveAccessL, dbFileName, EOpenDb, aDbType);
       
   559 
       
   560 	TheTest.Printf(_L("===RSqlDatabase::LastInsertedRowId()\r\n"));
       
   561 	DoDbOomTest(&DbLastInsertedRowIdL, dbFileName, EOpenDb, aDbType);
       
   562 
       
   563 	TheTest.Printf(_L("===RSqlDatabase::Open(), non-secure database in server data cage\r\n"));
       
   564 	DoDbOomTest2();
       
   565 	}