First public contribution.
     1 // Copyright (c) 2005-2010 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".
 
     8 // Initial Contributors:
 
     9 // Nokia Corporation - initial contribution.
 
    18 RTest TheTest(_L("t_sqloom2 test"));
 
    20 const TInt KSqlBufMaxLen = 16 * 1024;
 
    21 const TInt KBlobStrLen = KSqlBufMaxLen / 2 - 100;
 
    22 const TInt KBlobLen = KBlobStrLen;
 
    24 TBuf8<KSqlBufMaxLen> TheSqlBuf;
 
    25 TBuf8<KBlobStrLen> TheSqlBuf2;
 
    27 ///////////////////////////////////////////////////////////////////////////////////////
 
    28 ///////////////         RSqlStatement OOM tests         ///////////////////////////////
 
    29 ///////////////////////////////////////////////////////////////////////////////////////
 
    31 _LIT8(KSqlDbString, "BEGIN;\
 
    32 					 CREATE TABLE BBB(Fld1 INTEGER, Fld2 BIGINT, Fld3 DOUBLE, Fld4 TEXT, Fld5 LONGBLOB);\
 
    33                      INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(4562, 123456789012345, 78612.0091, 'text data');\
 
    35 _LIT8(KSqlDbString2,"INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(1, 34, 10.9897, 'data2');");
 
    37 const TInt KLongColumnSize = 3013;
 
    38 const TInt KLongParameterSize = 4501;
 
    40 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 
    42 static TUint16 TheTextColumnData[MAX(KLongColumnSize, KLongParameterSize)];
 
    43 static TUint8 TheBinaryColumnData[MAX(KLongColumnSize, KLongParameterSize) * sizeof(TUint16)];
 
    45 //"RSqlStatement::Prepare()" OOM test (8-bit SELECT SQL statement)
 
    46 void PrepareStmt8L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
    48 	_LIT8(KSqlString, "SELECT * FROM BBB WHERE Fld1=? AND Fld4<>?");
 
    49 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
    50 	User::LeaveIfError(err);
 
    53 //"RSqlStatement::PrepareL()" OOM test (8-bit SELECT SQL statement)
 
    54 void PrepareStmt8_2L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
    56 	_LIT8(KSqlString, "SELECT * FROM BBB WHERE Fld1=? AND Fld4<>?");
 
    57 	aStmt.PrepareL(aDb, KSqlString);
 
    60 //"RSqlStatement::Prepare()" OOM test (8-bit SELECT SQL statement), syntax error
 
    61 void PrepareBadStmt8L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
    63 	_LIT8(KSqlString, "SELECT123 * FROM BBB WHERE Fld1=? AND Fld4<>?");
 
    64 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
    65 	User::LeaveIfError(err);
 
    68 //"RSqlStatement::Prepare()" OOM test (8-bit SELECT SQL statement, move next)
 
    69 void PrepareMoveStmt8L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
    71 	_LIT8(KSqlString, "SELECT * FROM BBB WHERE Fld1=? AND Fld4<>?");
 
    72 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
    73     User::LeaveIfError(err);
 
    74     err = aStmt.BindInt(0, 1);
 
    75     User::LeaveIfError(err);
 
    76     err = aStmt.BindText(1, _L("data244weewfn43wr83224iu23ewkjfbrektug4i433b3k45b"));
 
    77     User::LeaveIfError(err);
 
    83 	User::LeaveIfError(err);
 
    86 //"RSqlStatement::Prepare()" OOM test (8-bit INSERT SQL statement)
 
    87 void PrepareInsertStmt8L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
    89 	_LIT8(KSqlString, "INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(2, 22, 22.2222, '2-2-2-2');");
 
    90 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
    91 	User::LeaveIfError(err);
 
    94 //"RSqlStatement::Prepare(), RSqlStatement::Exec(), RSqlStatement::Next()" OOM test (8-bit INSERT SQL statement, long column)
 
    95 void ExecInsertNextStmt8L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
    97 	_LIT8(KSqlString1, "INSERT INTO BBB(fld1, fld2, fld3, fld4, fld5) VALUES(10, 100, 100.001, :Prm1, :Prm2);");
 
    98 	_LIT8(KSqlString2, "SELECT * FROM BBB WHERE fld1 = 10");
 
    99 	TInt err = aStmt.Prepare(aDb, KSqlString1);
 
   102 		for(TInt i=0;i<KLongColumnSize;++i)
 
   104 			TheTextColumnData[i] = (TUint16)i;
 
   106 		const TPtrC textVal(TheTextColumnData, KLongColumnSize);
 
   107 		const TPtrC8 binVal((TUint8*)TheTextColumnData, KLongColumnSize * sizeof(TUint16));
 
   108 		TInt err = aStmt.BindText(0, textVal);
 
   111 			err = aStmt.BindBinary(1, binVal);
 
   121 		err = aStmt.Prepare(aDb, KSqlString2);
 
   127 	User::LeaveIfError(err);
 
   130 //"RSqlStatement::Prepare()" OOM test (8-bit INSERT SQL statement with parameters)
 
   131 void PrepareInsertPrmStmt8L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   133 	_LIT8(KSqlString, "INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(:Prm0, :Prm1, :Prm2, :Prm3);");
 
   134 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
   135 	User::LeaveIfError(err);
 
   138 //"RSqlStatement::Prepare()" OOM test (16-bit SELECT SQL statement)
 
   139 void PrepareStmt16L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   141 	_LIT(KSqlString, "SELECT * FROM BBB");
 
   142 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
   143 	User::LeaveIfError(err);
 
   146 //"RSqlStatement::PrepareL()" OOM test (16-bit SELECT SQL statement)
 
   147 void PrepareStmt16_2L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   149 	_LIT(KSqlString, "SELECT * FROM BBB");
 
   150 	aStmt.PrepareL(aDb, KSqlString);
 
   153 //"RSqlStatement::Prepare()" OOM test (16-bit SELECT SQL statement), syntax error
 
   154 void PrepareBadStmt16L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   156 	_LIT(KSqlString, "23478SELECT * FROM BBB");
 
   157 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
   158 	User::LeaveIfError(err);
 
   161 //"RSqlStatement::Prepare()" OOM test (16-bit SELECT SQL statement, move next)
 
   162 void PrepareMoveStmt16L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   164 	_LIT(KSqlString, "SELECT * FROM BBB");
 
   165 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
   174 	User::LeaveIfError(err);
 
   177 //"RSqlStatement::Prepare()" OOM test (16-bit INSERT SQL statement)
 
   178 void PrepareInsertStmt16L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   180 	_LIT(KSqlString, "INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(2, 22, 22.2222, '2-2-2-2');");
 
   181 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
   182 	User::LeaveIfError(err);
 
   185 //"RSqlStatement::Prepare(), RSqlStatement::Exec(), RSqlStatement::Next()" OOM test (16-bit INSERT SQL statement, long column)
 
   186 void ExecInsertNextStmt16L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   188 	_LIT(KSqlString1, "INSERT INTO BBB(fld1, fld2, fld3, fld4, fld5) VALUES(10, 100, 100.001, :Prm1, :Prm2);");
 
   189 	_LIT(KSqlString2, "SELECT * FROM BBB WHERE fld1 = 10");
 
   190 	TInt err = aStmt.Prepare(aDb, KSqlString1);
 
   193 		for(TInt i=0;i<KLongColumnSize;++i)
 
   195 			TheTextColumnData[i] = (TUint16)i;
 
   197 		const TPtrC textVal(TheTextColumnData, KLongColumnSize);
 
   198 		const TPtrC8 binVal((TUint8*)TheTextColumnData, KLongColumnSize * sizeof(TUint16));
 
   199 		TInt err = aStmt.BindText(0, textVal);
 
   202 			err = aStmt.BindBinary(1, binVal);
 
   212 		err = aStmt.Prepare(aDb, KSqlString2);
 
   218 	User::LeaveIfError(err);
 
   221 //"RSqlStatement::Prepare()" OOM test (16-bit INSERT SQL statement with parameters)
 
   222 void PrepareInsertPrmStmt16L(RSqlDatabase& aDb, RSqlStatement& aStmt)
 
   224 	_LIT(KSqlString, "INSERT INTO BBB(fld1, fld2, fld3, fld4) VALUES(:Prm0, :Prm1, :Prm2, :Prm3);");
 
   225 	TInt err = aStmt.Prepare(aDb, KSqlString);
 
   226 	User::LeaveIfError(err);
 
   230 @SYMTestCaseID			SYSLIB-SQL-CT-1617
 
   231 @SYMTestCaseDesc		RSqlStatement::Prepare() OOM test
 
   232 						Precondition: the database exists, opened, some record(s) inserted.
 
   233 						The test calls the given as an argument function while simulating OOM failures
 
   234 						and checks that there are no memory and resource leaks.
 
   235 @SYMTestPriority		High
 
   236 @SYMTestActions			RSqlStatement::Prepare() OOM test
 
   237 @SYMTestExpectedResults Test must not fail
 
   241 void DoStmtPrepareOomTestL(TStmtFuncPtrL aStmtFuncPtrL, const TDesC& aDbFileName, TDbType aDbType, TInt aExpectedError = KErrNone)
 
   243 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1617 RSqlStatement::Prepare() - OOM test"));
 
   244 	RSqlSecurityPolicy securityPolicy;
 
   245 	CreateTestSecurityPolicy(securityPolicy);
 
   246 	for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
 
   248 		RSqlDatabase::Delete(aDbFileName);
 
   250 		TInt err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
 
   251 		TEST2(err, KErrNone);
 
   252 		err = db.Exec(KSqlDbString);
 
   254 		//The next operation is executed to force the SQL server side session to make one memory allocation
 
   255 		//for the statement handle in its RDbObjContainer contrainer data member. Otherwise the OOM test will fail,
 
   256 		//because the server side session will do one additional allocation, which stays alive untill the
 
   257 		//session gets closed.
 
   258 		RSqlStatement dummyStmt;
 
   259 		err = dummyStmt.Prepare(db, _L("SELECT * FROM BBB"));
 
   260 		TEST2(err, KErrNone);
 
   264 		const TInt KMaxAllocation = TheOomTestType[i] == EServerSideTest ? KStmtOomTestAllocLimitServer : KStmtOomTestAllocLimitClient;
 
   265 		TInt allocationNo = 0;
 
   266 		TInt failingAllocationNo = 0;//the real exit point of the OOM test. allocationNo is set KMaxAllocation times.
 
   267 		while(allocationNo < KMaxAllocation)
 
   270 			MarkAllocatedCells();
 
   274 			SetHeapFailure(TheOomTestType[i], ++allocationNo);
 
   277 			TRAP(err, (*aStmtFuncPtrL)(db, stmt));
 
   279 			if(err != KErrNoMemory)
 
   281 				TEST2(err, aExpectedError);
 
   285 				failingAllocationNo = allocationNo;	
 
   288 			ResetHeapFailure(TheOomTestType[i]);
 
   292 			CheckAllocatedCells();
 
   297 		TEST2(err, aExpectedError);
 
   298 		PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo);
 
   300 	//Delete the database file
 
   301 	RSqlDatabase::Delete(aDbFileName);
 
   302 	securityPolicy.Close();
 
   305 //"RSqlStatement::Reset()" OOM test
 
   306 void ResetStmtL(RSqlStatement& aStmt)
 
   308 	TInt err = aStmt.Next();
 
   313 	User::LeaveIfError(err);
 
   316 //"RSqlStatement::Exec()" OOM test
 
   317 void ExecStmtL(RSqlStatement& aStmt)
 
   319 	TInt err = aStmt.Exec();
 
   320 	User::LeaveIfError(err);
 
   323 //"RSqlStatement::Next()" OOM test
 
   324 void NextStmtL(RSqlStatement& aStmt)
 
   326 	TInt err = aStmt.Next();
 
   331 	User::LeaveIfError(err);
 
   334 //"RSqlStatement::ParameterIndex()" OOM test
 
   335 void StmtParameterIndexL(RSqlStatement& aStmt)
 
   337 	TInt err = aStmt.ParameterIndex(_L(":Prm2"));
 
   338 	if(err == 1) //":Prm2" index is 1
 
   342 	User::LeaveIfError(err);
 
   345 //"RSqlStatement::ParameterName()" OOM test
 
   346 void StmtParameterNameL(RSqlStatement& aStmt)
 
   348 	// _LIT(KExcpected, ":Prm2");
 
   350 	TInt err = aStmt.ParameterName(1, paramName);
 
   351 	User::LeaveIfError(err);
 
   354 //"RSqlStatement::ParamName()" OOM test
 
   355 void StmtParamNameL(RSqlStatement& aStmt)
 
   358 	TInt err = aStmt.ParamName(1, paramName);
 
   359 	User::LeaveIfError(err);
 
   362 //"RSqlStatement::ColumnIndex()" OOM test
 
   363 void StmtColumnIndexL(RSqlStatement& aStmt)
 
   365 	TInt err = aStmt.ColumnIndex(_L("fLd3"));
 
   366 	if(err == 2) //"fLd3" index is 2
 
   370 	User::LeaveIfError(err);
 
   373 //"RSqlStatement::ColumnName()" OOM test
 
   374 void StmtColumnNameL(RSqlStatement& aStmt)
 
   376 	//_LIT(KExpected, "fLd3");
 
   378 	TInt err = aStmt.ColumnName(2, colName);
 
   379 	User::LeaveIfError(err);
 
   383 //"RSqlStatement::ColumnType()" OOM test
 
   384 void StmtColumnTypeL(RSqlStatement& aStmt)
 
   386 	TSqlColumnType coltype = aStmt.ColumnType(2);
 
   387 	TEST(coltype == ESqlReal);
 
   390 //"RSqlStatement::ColumnSize()" OOM test
 
   391 void StmtColumnSizeL(RSqlStatement& aStmt)
 
   393 	TInt colsize = aStmt.ColumnSize(2);
 
   394 	TEST(colsize == sizeof(TReal));
 
   397 //"RSqlStatement::BindNull()" OOM test
 
   398 void StmtBindNullL(RSqlStatement& aStmt)
 
   400 	TInt err = aStmt.BindNull(1);
 
   401 	//The bindings will be transferred on the server side right before Next() or Exec() call
 
   406 	User::LeaveIfError(err);
 
   409 //"RSqlStatement::BindInt()" OOM test
 
   410 void StmtBindIntL(RSqlStatement& aStmt)
 
   413 	TInt err = aStmt.BindInt(0, val);
 
   414 	//The bindings will be transferred on the server side right before Next() or Exec() call
 
   419 	User::LeaveIfError(err);
 
   422 //"RSqlStatement::BindInt64()" OOM test
 
   423 void StmtBindInt64L(RSqlStatement& aStmt)
 
   425 	TInt64 val = MAKE_TINT64(0x00FF00FF, 0x12345678);
 
   426 	TInt err = aStmt.BindInt64(1, val);
 
   427 	//The bindings will be transferred on the server side right before Next() or Exec() call
 
   432 	User::LeaveIfError(err);
 
   435 //"RSqlStatement::BindReal()" OOM test
 
   436 void StmtBindRealL(RSqlStatement& aStmt)
 
   439 	TInt err = aStmt.BindReal(2, val);
 
   440 	//The bindings will be transferred on the server side right before Next() or Exec() call
 
   445 	User::LeaveIfError(err);
 
   448 //"RSqlStatement::BindText()" OOM test
 
   449 void StmtBindTextL(RSqlStatement& aStmt)
 
   451 	for(TInt i=0;i<KLongParameterSize;++i)
 
   453 		TheTextColumnData[i] = (TUint16)i;
 
   455 	const TPtrC val(TheTextColumnData, KLongParameterSize);
 
   456 	TInt err = aStmt.BindText(3, val);
 
   457 	//The bindings will be transferred on the server side right before a Next() or Exec() call
 
   462 	User::LeaveIfError(err);
 
   465 //"RSqlStatement::BindBinary()" OOM test
 
   466 void StmtBindBinaryL(RSqlStatement& aStmt)
 
   468 	for(TInt i=0;i<KLongParameterSize;++i)
 
   470 		TheBinaryColumnData[i] = (TUint8)i;
 
   472 	const TPtrC8 val(TheBinaryColumnData, KLongParameterSize);
 
   473 	TInt err = aStmt.BindBinary(3, val);
 
   474 	//The bindings will be transferred on the server side right before a Next() or Exec() call
 
   479 	User::LeaveIfError(err);
 
   482 //"RSqlStatement::BindZeroBlob()" OOM test
 
   483 void StmtBindZeroBlobL(RSqlStatement& aStmt)
 
   485 	TInt err = aStmt.BindZeroBlob(3, KLongParameterSize);
 
   486 	//The bindings will be transferred on the server side right before a Next() or Exec() call
 
   491 	User::LeaveIfError(err);
 
   494 //"RSqlStatement::IsNull()" OOM test
 
   495 void StmtIsNullColumnL(RSqlStatement& aStmt)
 
   497 	TBool rc = aStmt.IsNull(0);
 
   501 //"RSqlStatement::ColumnInt()" OOM test
 
   502 void StmtColumnIntL(RSqlStatement& aStmt)
 
   504 	TInt val = aStmt.ColumnInt(0);
 
   508 //"RSqlStatement::ColumnInt64()" OOM test
 
   509 void StmtColumnInt64L(RSqlStatement& aStmt)
 
   511 	TInt64 val = aStmt.ColumnInt64(1);
 
   515 //"RSqlStatement::ColumnReal()" OOM test
 
   516 void StmtColumnRealL(RSqlStatement& aStmt)
 
   518 	TReal val = aStmt.ColumnReal(2);
 
   519 	TEST(Abs(val - 100.001) < 0.000001);
 
   522 //"RSqlStatement::ColumnTextL()" OOM test
 
   523 void StmtColumnText1L(RSqlStatement& aStmt)
 
   525 	TPtrC val = aStmt.ColumnTextL(3);
 
   526 	TEST(val.Length() == KLongColumnSize);
 
   527 	for(TInt i=0;i<KLongColumnSize;++i)
 
   529 		TEST(val[i] == (TUint16)i);
 
   533 //"RSqlStatement::ColumnText()" OOM test
 
   534 void StmtColumnText2L(RSqlStatement& aStmt)
 
   537 	TInt err = aStmt.ColumnText(3, val);
 
   538 	User::LeaveIfError(err);
 
   539 	TEST(val.Length() == KLongColumnSize);
 
   540 	for(TInt i=0;i<KLongColumnSize;++i)
 
   542 		TEST(val[i] == (TUint16)i);
 
   546 //"RSqlStatement::ColumnText()" OOM test
 
   547 void StmtColumnText3L(RSqlStatement& aStmt)
 
   549 	TPtr val(TheTextColumnData, KLongColumnSize);
 
   550 	TInt err = aStmt.ColumnText(3, val);
 
   551 	User::LeaveIfError(err);
 
   552 	TEST(val.Length() == KLongColumnSize);
 
   553 	for(TInt i=0;i<KLongColumnSize;++i)
 
   555 		TEST(val[i] == (TUint16)i);
 
   559 //"RSqlStatement::ColumnBinaryL()" OOM test
 
   560 void StmtColumnBinary1L(RSqlStatement& aStmt)
 
   562 	TPtrC8 val = aStmt.ColumnBinaryL(4);
 
   563 	TEST(val.Length() == KLongColumnSize * sizeof(TUint16));
 
   564 	for(TInt i=0,j=0;i<KLongColumnSize;++i,j+=2)
 
   566 		TUint8 valLow = val[j];
 
   567 		TUint8 valHigh = val[j + 1];
 
   568 		TEST(valLow == (TUint8)(i & 0xFF));
 
   569 		TEST(valHigh == (TUint8)(((TUint)i >> 8) & 0xFF));
 
   573 //"RSqlStatement::ColumnBinary()" OOM test
 
   574 void StmtColumnBinary2L(RSqlStatement& aStmt)
 
   577 	TInt err = aStmt.ColumnBinary(4, val);
 
   578 	User::LeaveIfError(err);
 
   579 	TEST(val.Length() == KLongColumnSize * sizeof(TUint16));
 
   580 	for(TInt i=0,j=0;i<KLongColumnSize;++i,j+=2)
 
   582 		TUint8 valLow = val[j];
 
   583 		TUint8 valHigh = val[j + 1];
 
   584 		TEST(valLow == (TUint8)(i & 0xFF));
 
   585 		TEST(valHigh == (TUint8)(((TUint)i >> 8) & 0xFF));
 
   589 //"RSqlStatement::ColumnBinary()" OOM test
 
   590 void StmtColumnBinary3L(RSqlStatement& aStmt)
 
   592 	TPtr8 val(TheBinaryColumnData, KLongColumnSize * sizeof(TUint16));
 
   593 	TInt err = aStmt.ColumnBinary(4, val);
 
   594 	User::LeaveIfError(err);
 
   595 	TEST(val.Length() == KLongColumnSize * sizeof(TUint16));
 
   596 	for(TInt i=0,j=0;i<KLongColumnSize;++i,j+=2)
 
   598 		TUint8 valLow = val[j];
 
   599 		TUint8 valHigh = val[j + 1];
 
   600 		TEST(valLow == (TUint8)(i & 0xFF));
 
   601 		TEST(valHigh == (TUint8)(((TUint)i >> 8) & 0xFF));
 
   605 //"RSqlStatement::ColumnCount()" OOM test
 
   606 void StmtColumnCount(RSqlStatement& aStmt)
 
   608 	TInt cnt = aStmt.ColumnCount();
 
   612 //"RSqlStatement::DeclaredColumnType()" OOM test
 
   613 void StmtDeclaredColumnTypeL(RSqlStatement& aStmt)
 
   615 	TInt cnt = aStmt.ColumnCount();
 
   617 	const TSqlColumnType KColTypes[] = {ESqlInt, ESqlInt, ESqlReal, ESqlText, ESqlBinary};
 
   618 	for(TInt i=0;i<cnt;++i)
 
   620 		TSqlColumnType colType;
 
   621 		TInt err = aStmt.DeclaredColumnType(i, colType);
 
   622 		User::LeaveIfError(err);
 
   623 		TEST2(colType, KColTypes[i]);
 
   627 //"RSqlColumnReadStream::ColumnBinary()" OOM test
 
   628 void StmtColumnBinaryStreamL(RSqlStatement& aStmt)
 
   630 	RSqlColumnReadStream strm;
 
   631 	CleanupClosePushL(strm);
 
   632 	TInt err = strm.ColumnBinary(aStmt, 4);
 
   633 	User::LeaveIfError(err);
 
   634 	strm.ReadL(TheBinaryColumnData, KLongColumnSize * sizeof(TUint16));
 
   635 	CleanupStack::PopAndDestroy(&strm);
 
   636 	for(TInt i=0,j=0;i<KLongColumnSize;++i,j+=2)
 
   638 		TUint8 valLow = TheBinaryColumnData[j];
 
   639 		TUint8 valHigh = TheBinaryColumnData[j + 1];
 
   640 		TEST(valLow == (TUint8)(i & 0xFF));
 
   641 		TEST(valHigh == (TUint8)(((TUint)i >> 8) & 0xFF));
 
   645 //"RSqlColumnReadStream::ColumnText()" OOM test
 
   646 void StmtColumnTextStreamL(RSqlStatement& aStmt)
 
   648 	RSqlColumnReadStream strm;
 
   649 	CleanupClosePushL(strm);
 
   650 	TInt err = strm.ColumnText(aStmt, 3);
 
   651 	User::LeaveIfError(err);
 
   652 	strm.ReadL(TheTextColumnData, KLongColumnSize);
 
   653 	CleanupStack::PopAndDestroy(&strm);
 
   654 	for(TInt i=0;i<KLongColumnSize;++i)
 
   656 		TEST(TheTextColumnData[i] == (TUint16)i);
 
   660 //"RSqlParamWriteStream::BindBinary()" OOM test
 
   661 void StmtParamBinaryStreamL(RSqlStatement& aStmt)
 
   663 	for(TInt i=0;i<KLongParameterSize;++i)
 
   665 		TheTextColumnData[i] = (TUint16)i;
 
   668 	RSqlParamWriteStream strm;
 
   669 	CleanupClosePushL(strm);
 
   670 	TInt err = strm.BindBinary(aStmt, 3);
 
   671 	User::LeaveIfError(err);
 
   672 	strm.WriteL((TUint8*)TheTextColumnData, KLongColumnSize * sizeof(TUint16));
 
   673 	CleanupStack::PopAndDestroy(&strm);
 
   676 //"RSqlParamWriteStream::BindText()" OOM test
 
   677 void StmtParamTextStreamL(RSqlStatement& aStmt)
 
   679 	for(TInt i=0;i<KLongParameterSize;++i)
 
   681 		TheTextColumnData[i] = (TUint16)i;
 
   684 	RSqlParamWriteStream strm;
 
   685 	CleanupClosePushL(strm);
 
   686 	TInt err = strm.BindText(aStmt, 3);
 
   687 	User::LeaveIfError(err);
 
   688 	strm.WriteL(TheTextColumnData, KLongColumnSize);
 
   689 	CleanupStack::PopAndDestroy(&strm);
 
   693 @SYMTestCaseID			SYSLIB-SQL-CT-1618
 
   694 @SYMTestCaseDesc		RSqlStatement methods OOM tests
 
   695 						Precondition: the database exists, opened, some record(s) inserted.
 
   696 						The test calls the given as an argument function while simulating OOM failures
 
   697 						and checks that there are no memory and resource leaks.
 
   698 @SYMTestPriority		High
 
   699 @SYMTestActions			RSqlStatement methods OOM tests
 
   700 @SYMTestExpectedResults Test must not fail
 
   704 void DoStmtOomTestL(TStmtFuncPtrL aStmtPrepareFuncPtrL, TStmtFuncPtr2L aStmtTestFuncPtrL, const TDesC& aDbFileName, TDbType aDbType)
 
   706 	//This is not really an OOM test, because:
 
   707 	//(A) The test forces the server to simulate heap failure on determied allocation step
 
   708 	//(B) SQL server counts only the number of active statement and stream objects, the allocated memory cells
 
   710 	//    The reason that the allocated memory cells are not counted and in case of OOM failure - checked is
 
   711 	//    because the SQL server may make some per-connection persistent memory allocations (cache pages, etc.)
 
   712 	//    which will not be deallocated when the statement object is closed.
 
   714 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1618 RSqlStatement - OOM test"));
 
   715 	RSqlSecurityPolicy securityPolicy;
 
   716 	CreateTestSecurityPolicy(securityPolicy);
 
   717 	for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
 
   719 		RSqlDatabase::Delete(aDbFileName);
 
   721 		TInt err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
 
   722 		TEST2(err, KErrNone);
 
   723 		err = db.Exec(KSqlDbString);
 
   725 		err = db.Exec(KSqlDbString2);
 
   729 		const TInt KMaxAllocation = TheOomTestType[i] == EServerSideTest ? KStmtOomTestAllocLimitServer : KStmtOomTestAllocLimitClient;
 
   730 		TInt allocationNo = 0;
 
   731 		TInt failingAllocationNo = 0;//the real exit point of the OOM test. allocationNo is set KMaxAllocation times.
 
   732 		while(allocationNo < KMaxAllocation)
 
   735 			MarkAllocatedCells();
 
   740 			TRAP(err, (*aStmtPrepareFuncPtrL)(db, stmt));
 
   741 			TEST2(err, KErrNone);
 
   743 			SetHeapFailure(TheOomTestType[i], ++allocationNo);
 
   745 			TRAP(err, (*aStmtTestFuncPtrL)(stmt));
 
   747 			//ResetHeapFailure() has to be called before stmt.Close() because,
 
   748 			//otherwise it will panic the server (the server resource count, marked by
 
   749 			//SetHeapFailure() call, is 1 (there is one prepared statement))
 
   750 			ResetHeapFailure(TheOomTestType[i]);
 
   754 			if(err != KErrNoMemory)
 
   756 				TEST2(err, KErrNone);
 
   760 				failingAllocationNo = allocationNo;	
 
   765 			CheckAllocatedCells();
 
   770 		TEST2(err, KErrNone);
 
   771 		PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo);
 
   773 	//Delete the database file
 
   774 	RSqlDatabase::Delete(aDbFileName);
 
   775 	securityPolicy.Close();
 
   778 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
   779 //////////////////               RSqlBlobReadStream, RSqlBlobWriteStream - OOM tests          /////////////////////
 
   780 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
   782 //RSqlBlobReadStream, RSqlBlobWriteStream - OOM test preparation.
 
   783 void ExecInsertBlobL(RSqlDatabase& aDb)
 
   785 	_LIT8(KSqlString1, "CREATE TABLE BBB(Fld1 INTEGER, Fld2 BIGINT, Fld3 DOUBLE, Fld4 TEXT, Fld5 LONGBLOB)");
 
   786 	TInt err = aDb.Exec(KSqlString1);
 
   787 	User::LeaveIfError(err);
 
   788 	_LIT8(KSqlString2, "INSERT INTO BBB(fld1, fld2, fld3, fld4, fld5) VALUES(10, 100, 100.001, 'AAA', x'");
 
   789 	TheSqlBuf.Copy(KSqlString2);
 
   790 	for(TInt i=0;i<KBlobStrLen;++i)	
 
   792 		TheSqlBuf.Append(_L8("A5"));
 
   794 	TheSqlBuf.Append(_L8("')"));
 
   795 	err = aDb.Exec(TheSqlBuf);
 
   796 	User::LeaveIfError(err);
 
   799 //"RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::ReadL()" OOM test
 
   800 void BlobReadStreamOpenL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   802 	RSqlBlobReadStream strm;
 
   803 	CleanupClosePushL(strm);
 
   804 	if(aAttachDbName.Length() > 0)
 
   806 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
 
   810 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1);
 
   812 	const TInt KReadOpCnt = 8;
 
   813 	for(TInt j=0;j<KReadOpCnt;++j)
 
   815 		strm.ReadL(TheSqlBuf, KBlobLen / KReadOpCnt);
 
   816 		TEST2(TheSqlBuf.Length(), (KBlobLen / KReadOpCnt));
 
   817 		for(TInt i=0;i<(KBlobLen / KReadOpCnt);++i)
 
   819 			TUint8 val = TheSqlBuf[i];
 
   823 	CleanupStack::PopAndDestroy(&strm);
 
   826 //"RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::SizeL()" OOM test
 
   827 void BlobReadStreamSizeL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   829 	RSqlBlobReadStream strm;
 
   830 	CleanupClosePushL(strm);
 
   831 	if(aAttachDbName.Length() > 0)
 
   833 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
 
   837 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1);
 
   839 	TInt size = strm.SizeL();	
 
   840 	TEST2(size, KBlobLen);
 
   841 	CleanupStack::PopAndDestroy(&strm);
 
   844 //"RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::WriteL()" OOM test
 
   845 void BlobWriteStreamOpenL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   847 	RSqlBlobWriteStream strm;
 
   848 	CleanupClosePushL(strm);
 
   849 	if(aAttachDbName.Length() > 0)
 
   851 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
 
   855 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1);
 
   857 	const TInt KWriteOpCnt = 8;
 
   858 	TheSqlBuf.SetLength(KBlobLen / KWriteOpCnt);
 
   859 	TheSqlBuf.Fill(TChar('Z'));
 
   860 	for(TInt j=0;j<KWriteOpCnt;++j)
 
   862 		strm.WriteL(TheSqlBuf, KBlobLen / KWriteOpCnt);
 
   865 	CleanupStack::PopAndDestroy(&strm);
 
   868 //"RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::SizeL()" OOM test
 
   869 void BlobWriteStreamSizeL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   871 	RSqlBlobWriteStream strm;
 
   872 	CleanupClosePushL(strm);
 
   873 	if(aAttachDbName.Length() > 0)
 
   875 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
 
   879 		strm.OpenL(aDb, _L("BBB"), _L("fld5"), 1);
 
   881 	TInt size = strm.SizeL();	
 
   882 	TEST2(size, KBlobLen);
 
   883 	CleanupStack::PopAndDestroy(&strm);
 
   886 //"TSqlBlob::GetLC()" OOM test
 
   887 void BlobWholeGet1L(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   890 	if(aAttachDbName.Length() > 0)
 
   892 		buf = TSqlBlob::GetLC(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
 
   896 		buf = TSqlBlob::GetLC(aDb, _L("BBB"), _L("fld5"), 1);
 
   898 	TEST(buf->Length() == KBlobStrLen);
 
   899 	CleanupStack::PopAndDestroy(buf);
 
   902 //"TSqlBlob::Get()" OOM test
 
   903 void BlobWholeGet2L(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   905 	if(aAttachDbName.Length() > 0)
 
   907 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf2, 1, aAttachDbName);
 
   911 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf2, 1);
 
   915 //"TSqlBlob::SetL()" OOM test
 
   916 void BlobWholeSetL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
 
   918 	if(aAttachDbName.Length() > 0)
 
   920 		TSqlBlob::SetL(aDb, _L("BBB"), _L("fld5"), TheSqlBuf, 1, aAttachDbName);
 
   924 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf, 1);
 
   929 @SYMTestCaseID			SYSLIB-SQL-UT-4091
 
   930 @SYMTestCaseDesc		RSqlBlobReadStream, RSqlBlobWriteStream methods OOM tests
 
   931 						Precondition: the database exists, opened, some record(s) inserted.
 
   932 						The test calls the given as an argument function while simulating OOM failures
 
   933 						and checks that there are no memory and resource leaks.
 
   934 @SYMTestPriority		High
 
   935 @SYMTestActions			RSqlBlobReadStream, RSqlBlobWriteStream methods OOM tests
 
   936 @SYMTestExpectedResults Test must not fail
 
   942 void DoBlobOomTestL(TBlobPrepareFuncPtrL aBlobPrepareFuncPtrL, TBlobTestFuncPtrL aBlobTestFuncPtrL, 
 
   943 					const TDesC& aDbFileName, TDbType aDbType, TBool aAttachDb = EFalse)
 
   945 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4091 RSqlBlobReadStream, RSqlBlobWriteStream - OOM test"));
 
   946 	RSqlSecurityPolicy securityPolicy;
 
   947 	CreateTestSecurityPolicy(securityPolicy);
 
   948 	for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
 
   950 		RSqlDatabase::Delete(aDbFileName);
 
   952 		TInt err = aDbType == ESecureDb ? db.Create(aDbFileName, securityPolicy) : db.Create(aDbFileName);
 
   953 		TEST2(err, KErrNone);
 
   954 		TRAP(err, (*aBlobPrepareFuncPtrL)(db));
 
   955 		TEST2(err, KErrNone);
 
   956 		_LIT(KAttachDbName, "AttachDb");
 
   959 			err = db.Attach(aDbFileName, KAttachDbName);
 
   960 			TEST2(err, KErrNone);
 
   964 		const TInt KMaxAllocation = TheOomTestType[i] == EServerSideTest ? KBlobOomTestAllocLimitServer : KBlobOomTestAllocLimitClient;
 
   965 		TInt allocationNo = 0;
 
   966 		TInt failingAllocationNo = 0;//the real exit point of the OOM test. allocationNo is set KMaxAllocation times.
 
   967 		while(allocationNo < KMaxAllocation)
 
   970 			MarkAllocatedCells();
 
   974 			SetHeapFailure(TheOomTestType[i], ++allocationNo);
 
   977 				TRAP(err, (*aBlobTestFuncPtrL)(db, KAttachDbName));
 
   981 				TRAP(err, (*aBlobTestFuncPtrL)(db, KNullDesC));
 
   984 			ResetHeapFailure(TheOomTestType[i]);
 
   986 			if(err != KErrNoMemory)
 
   990 					TPtrC errmsg = db.LastErrorMessage();
 
   991 					if(errmsg.Length() > 0)
 
   993 						TheTest.Printf(_L("\r\n@@@ error %d, error message: %S\r\n"), err, &errmsg);	
 
   996 				TEST2(err, KErrNone);
 
  1000 				failingAllocationNo = allocationNo;
 
  1005 			CheckAllocatedCells();
 
  1008 		TEST2(err, KErrNone);
 
  1012 			(void)db.Detach(KAttachDbName);
 
  1016 		err = RSqlDatabase::Delete(aDbFileName);
 
  1017 		TEST2(err, KErrNone);
 
  1018 		PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo);
 
  1020 	securityPolicy.Close();
 
  1023 void ScalarFullSelectInt_8L(RSqlDatabase& aDb)
 
  1025 	TSqlScalarFullSelectQuery query(aDb);
 
  1026 	TInt val = query.SelectIntL(_L8("SELECT F1 FROM A WHERE F3 < 0"));
 
  1030 void ScalarFullSelectInt64_8L(RSqlDatabase& aDb)
 
  1032 	TSqlScalarFullSelectQuery query(aDb);
 
  1033 	TInt64 val = query.SelectInt64L(_L8("SELECT F2 FROM A WHERE F1 = 1"));
 
  1034 	TEST2(val, 10000000000LL);
 
  1037 void ScalarFullSelectReal_8L(RSqlDatabase& aDb)
 
  1039 	TSqlScalarFullSelectQuery query(aDb);
 
  1040 	TReal val = query.SelectRealL(_L8("SELECT F3 FROM A WHERE F1 = 1"));
 
  1041 	TEST(val > 2.0 && val < 3.0);
 
  1044 void ScalarFullSelectText_8L(RSqlDatabase& aDb)
 
  1046 	TSqlScalarFullSelectQuery query(aDb);
 
  1048 	TInt err = query.SelectTextL(_L8("SELECT F4 FROM A WHERE F1 = 1"), buf);
 
  1049 	TEST2(err, KErrNone);
 
  1050 	_LIT(KText, "NAME1234567890");
 
  1054 void ScalarFullSelectBinary_8L(RSqlDatabase& aDb)
 
  1056 	TSqlScalarFullSelectQuery query(aDb);
 
  1058 	TInt err = query.SelectBinaryL(_L8("SELECT F5 FROM A WHERE F1 = 1"), buf);
 
  1059 	TEST2(err, KErrNone);
 
  1060 	TEST(buf.Length() == 0);
 
  1063 void ScalarFullSelectInt_16L(RSqlDatabase& aDb)
 
  1065 	TSqlScalarFullSelectQuery query(aDb);
 
  1066 	TInt val = query.SelectIntL(_L16("SELECT F1 FROM A WHERE F3 < 0"));
 
  1070 void ScalarFullSelectInt64_16L(RSqlDatabase& aDb)
 
  1072 	TSqlScalarFullSelectQuery query(aDb);
 
  1073 	TInt64 val = query.SelectInt64L(_L16("SELECT F2 FROM A WHERE F1 = 1"));
 
  1074 	TEST2(val, 10000000000LL);
 
  1077 void ScalarFullSelectReal_16L(RSqlDatabase& aDb)
 
  1079 	TSqlScalarFullSelectQuery query(aDb);
 
  1080 	TReal val = query.SelectRealL(_L16("SELECT F3 FROM A WHERE F1 = 1"));
 
  1081 	TEST(val > 2.0 && val < 3.0);
 
  1084 void ScalarFullSelectText_16L(RSqlDatabase& aDb)
 
  1086 	TSqlScalarFullSelectQuery query(aDb);
 
  1088 	TInt err = query.SelectTextL(_L16("SELECT F4 FROM A WHERE F1 = 1"), buf);
 
  1089 	TEST2(err, KErrNone);
 
  1090 	_LIT(KText, "NAME1234567890");
 
  1094 void ScalarFullSelectBinary_16L(RSqlDatabase& aDb)
 
  1096 	TSqlScalarFullSelectQuery query(aDb);
 
  1098 	TInt err = query.SelectBinaryL(_L16("SELECT F5 FROM A WHERE F1 = 1"), buf);
 
  1099 	TEST2(err, KErrNone);
 
  1100 	TEST(buf.Length() == 0);
 
  1103 void ScalarFullSelectText2_8L(RSqlDatabase& aDb)
 
  1105 	TSqlScalarFullSelectQuery query(aDb);
 
  1106 	HBufC* buf = HBufC::NewLC(8);
 
  1107 	TPtr name = buf->Des();
 
  1108 	TInt rc = query.SelectTextL(_L8("SELECT F4 FROM A WHERE F1 = 1"), name);
 
  1109 	TEST(rc >= 0); //the function may return only non-negative values
 
  1112 		buf = buf->ReAllocL(rc);
 
  1113 		CleanupStack::Pop();
 
  1114 		CleanupStack::PushL(buf);
 
  1115 		name.Set(buf->Des());
 
  1116 		rc = query.SelectTextL(_L8("SELECT F4 FROM A WHERE F1 = 1"), name);
 
  1118 		_LIT(KText, "NAME1234567890");
 
  1119 		TEST(name == KText);
 
  1121 	CleanupStack::PopAndDestroy(buf);
 
  1125 @SYMTestCaseID			SYSLIB-SQL-CT-1811
 
  1126 @SYMTestCaseDesc		TSqlScalarFullSelectQuery functions OOM test
 
  1127 						Precondition: the database exists.
 
  1128 						The test simulates OOM failures while calling TSqlScalarFullSelectQuery functions
 
  1129 						and checks that there are no memory and resource leaks.
 
  1130 @SYMTestPriority		High
 
  1131 @SYMTestActions			TSqlScalarFullSelectQuery methods OOM tests
 
  1132 @SYMTestExpectedResults Test must not fail
 
  1136 void DoFullSelectOomTest(TScalarFullSelectFuncPtrL aTestFunctionPtrL)
 
  1138 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1811 TSqlScalarFullSelectQuery - OOM test"));
 
  1139 	//Create test database
 
  1141 	TInt err = db.Create(KTestDb);
 
  1142 	TEST2(err, KErrNone);
 
  1143 	err = db.Exec(_L("CREATE TABLE A(F1 INTEGER, F2 INTEGER, F3 FLOAT, F4 TEXT, F5 BLOB)"));
 
  1145 	err = db.Exec(_L("INSERT INTO A(F1, F2, F3, F4, F5) VALUES(1, 10000000000, 2.54, 'NAME1234567890', NULL)"));
 
  1147 	err = db.Exec(_L("INSERT INTO A(F1, F2, F3, F4) VALUES(2, 200, -1.11, 'ADDRESS')"));
 
  1151 	for(TInt i=0;i<(TInt)(sizeof(TheOomTestType)/sizeof(TheOomTestType[0]));++i)
 
  1154 		const TInt KMaxAllocation = TheOomTestType[i] == EServerSideTest ? KStmtOomTestAllocLimitServer : KStmtOomTestAllocLimitClient;
 
  1155 		TInt allocationNo = 0;
 
  1156 		TInt failingAllocationNo = 0;//the real exit point of the OOM test. allocationNo is set KMaxAllocation times.
 
  1157 		while(allocationNo < KMaxAllocation)
 
  1160 			MarkAllocatedCells();
 
  1164 			if(TheOomTestType[i] == EServerSideTest)
 
  1165 				{//We will delay the heap failure simulation, until the database is opened
 
  1166 				SetDbHeapFailure(TheOomTestType[i], ++allocationNo, ETrue);
 
  1169 			err = db.Open(KTestDb);
 
  1170 			TEST2(err, KErrNone);
 
  1172 			if(TheOomTestType[i] == EClientSideTest)
 
  1174 				SetDbHeapFailure(TheOomTestType[i], ++allocationNo);
 
  1177 			TRAP(err, (*aTestFunctionPtrL)(db));
 
  1179 			if(err != KErrNoMemory)
 
  1181 				TEST2(err, KErrNone);
 
  1185 				failingAllocationNo = allocationNo;	
 
  1188 			ResetDbHeapFailure(TheOomTestType[i]);
 
  1192 			CheckAllocatedCells();
 
  1195 		TEST2(err, KErrNone);
 
  1196 		PrintEndOfOomTest(TheOomTestType[i], failingAllocationNo);
 
  1198 	//Delete the database file
 
  1199 	RSqlDatabase::Delete(KTestDb);
 
  1202 //RSqlStatement OOM tests
 
  1203 void StmtOomTestsL()
 
  1205 	const TInt KTestCnt = 2;
 
  1206 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1207 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1209 	for(TInt i=0;i<KTestCnt;++i)
 
  1211 		TheTest.Printf(_L("===RSqlStatement::Prepare(), 8-bit SQL\r\n"));
 
  1212 		DoStmtPrepareOomTestL(&PrepareStmt8L, dbFileName[i], dbType[i]);
 
  1214 		TheTest.Printf(_L("===RSqlStatement::PrepareL(), 8-bit SQL\r\n"));
 
  1215 		DoStmtPrepareOomTestL(&PrepareStmt8_2L, dbFileName[i], dbType[i]);
 
  1217 		TheTest.Printf(_L("===RSqlStatement::Prepare(), 16-bit SQL\r\n"));
 
  1218 		DoStmtPrepareOomTestL(&PrepareStmt16L, dbFileName[i], dbType[i]);
 
  1220 		TheTest.Printf(_L("===RSqlStatement::PrepareL(), 16-bit SQL\r\n"));
 
  1221 		DoStmtPrepareOomTestL(&PrepareStmt16_2L, dbFileName[i], dbType[i]);
 
  1223 		TheTest.Printf(_L("===RSqlStatement::Reset(), 8-bit SQL\r\n"));
 
  1224 		DoStmtOomTestL(&PrepareStmt8L, &ResetStmtL, dbFileName[i], dbType[i]);
 
  1226 		TheTest.Printf(_L("===RSqlStatement::Reset(), 16-bit SQL\r\n"));
 
  1227 		DoStmtOomTestL(&PrepareStmt16L, &ResetStmtL, dbFileName[i], dbType[i]);
 
  1229 		TheTest.Printf(_L("===RSqlStatement::Exec(), 8-bit SQL\r\n"));
 
  1230 		DoStmtOomTestL(&PrepareInsertStmt8L, &ExecStmtL, dbFileName[i], dbType[i]);
 
  1232 		TheTest.Printf(_L("===RSqlStatement::Exec(), 16-bit SQL\r\n"));
 
  1233 		DoStmtOomTestL(&PrepareInsertStmt16L, &ExecStmtL, dbFileName[i], dbType[i]);
 
  1235 		TheTest.Printf(_L("===RSqlStatement::Next(), 8-bit SQL\r\n"));
 
  1236 		DoStmtOomTestL(&PrepareStmt8L, &NextStmtL, dbFileName[i], dbType[i]);
 
  1238 		TheTest.Printf(_L("===RSqlStatement::Next(), 16-bit SQL\r\n"));
 
  1239 		DoStmtOomTestL(&PrepareStmt16L, &NextStmtL, dbFileName[i], dbType[i]);
 
  1241 		TheTest.Printf(_L("===RSqlStatement::ParameterIndex(), 8-bit SQL\r\n"));
 
  1242 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtParameterIndexL, dbFileName[i], dbType[i]);
 
  1244 		TheTest.Printf(_L("===RSqlStatement::ParameterIndex(), 16-bit SQL\r\n"));
 
  1245 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtParameterIndexL, dbFileName[i], dbType[i]);
 
  1247 		TheTest.Printf(_L("===RSqlStatement::ParameterName(), 8-bit SQL\r\n"));
 
  1248 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtParameterNameL, dbFileName[i], dbType[i]);
 
  1250 		TheTest.Printf(_L("===RSqlStatement::ParameterName(), 16-bit SQL\r\n"));
 
  1251 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtParameterNameL, dbFileName[i], dbType[i]);
 
  1253 		TheTest.Printf(_L("===RSqlStatement::ParamName(), 8-bit SQL\r\n"));
 
  1254 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtParamNameL, dbFileName[i], dbType[i]);
 
  1256 		TheTest.Printf(_L("===RSqlStatement::ParamName(), 16-bit SQL\r\n"));
 
  1257 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtParamNameL, dbFileName[i], dbType[i]);
 
  1259 		TheTest.Printf(_L("===RSqlStatement::ColumnIndex(), 8-bit SQL\r\n"));
 
  1260 		DoStmtOomTestL(&PrepareStmt8L, &StmtColumnIndexL, dbFileName[i], dbType[i]);
 
  1262 		TheTest.Printf(_L("===RSqlStatement::ColumnIndex(), 16-bit SQL\r\n"));
 
  1263 		DoStmtOomTestL(&PrepareStmt16L, &StmtColumnIndexL, dbFileName[i], dbType[i]);
 
  1265 		TheTest.Printf(_L("===RSqlStatement::ColumnType(), 8-bit SQL\r\n"));
 
  1266 		DoStmtOomTestL(&PrepareMoveStmt8L, &StmtColumnTypeL, dbFileName[i], dbType[i]);
 
  1268 		TheTest.Printf(_L("===RSqlStatement::ColumnType(), 16-bit SQL\r\n"));
 
  1269 		DoStmtOomTestL(&PrepareMoveStmt16L, &StmtColumnTypeL, dbFileName[i], dbType[i]);
 
  1271 		TheTest.Printf(_L("===RSqlStatement::ColumnSize(), 8-bit SQL\r\n"));
 
  1272 		DoStmtOomTestL(&PrepareMoveStmt8L, &StmtColumnSizeL, dbFileName[i], dbType[i]);
 
  1274 		TheTest.Printf(_L("===RSqlStatement::ColumnSize(), 16-bit SQL\r\n"));
 
  1275 		DoStmtOomTestL(&PrepareMoveStmt16L, &StmtColumnSizeL, dbFileName[i], dbType[i]);
 
  1277 		TheTest.Printf(_L("===RSqlStatement::ColumnName(), 8-bit SQL\r\n"));
 
  1278 		DoStmtOomTestL(&PrepareMoveStmt8L, &StmtColumnNameL, dbFileName[i], dbType[i]);
 
  1280 		TheTest.Printf(_L("===RSqlStatement::ColumnName(), 16-bit SQL\r\n"));
 
  1281 		DoStmtOomTestL(&PrepareMoveStmt16L, &StmtColumnNameL, dbFileName[i], dbType[i]);
 
  1283 		TheTest.Printf(_L("===RSqlStatement::BindNull(), 8-bit SQL\r\n"));
 
  1284 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindNullL, dbFileName[i], dbType[i]);
 
  1286 		TheTest.Printf(_L("===RSqlStatement::BindNull(), 16-bit SQL\r\n"));
 
  1287 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindNullL, dbFileName[i], dbType[i]);
 
  1289 		TheTest.Printf(_L("===RSqlStatement::BindInt(), 8-bit SQL\r\n"));
 
  1290 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindIntL, dbFileName[i], dbType[i]);
 
  1292 		TheTest.Printf(_L("===RSqlStatement::BindInt(), 16-bit SQL\r\n"));
 
  1293 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindIntL, dbFileName[i], dbType[i]);
 
  1295 		TheTest.Printf(_L("===RSqlStatement::BindInt64(), 8-bit SQL\r\n"));
 
  1296 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindInt64L, dbFileName[i], dbType[i]);
 
  1298 		TheTest.Printf(_L("===RSqlStatement::BindInt64(), 16-bit SQL\r\n"));
 
  1299 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindInt64L, dbFileName[i], dbType[i]);
 
  1301 		TheTest.Printf(_L("===RSqlStatement::BindReal(), 8-bit SQL\r\n"));
 
  1302 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindRealL, dbFileName[i], dbType[i]);
 
  1304 		TheTest.Printf(_L("===RSqlStatement::BindReal(), 16-bit SQL\r\n"));
 
  1305 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindRealL, dbFileName[i], dbType[i]);
 
  1307 		TheTest.Printf(_L("===RSqlStatement::BindText(), 8-bit SQL\r\n"));
 
  1308 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindTextL, dbFileName[i], dbType[i]);
 
  1310 		TheTest.Printf(_L("===RSqlStatement::BindText(), 16-bit SQL\r\n"));
 
  1311 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindTextL, dbFileName[i], dbType[i]);
 
  1313 		TheTest.Printf(_L("===RSqlStatement::BindBinary(), 8-bit SQL\r\n"));
 
  1314 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindBinaryL, dbFileName[i], dbType[i]);
 
  1316 		TheTest.Printf(_L("===RSqlStatement::BindBinary(), 16-bit SQL\r\n"));
 
  1317 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindBinaryL, dbFileName[i], dbType[i]);
 
  1319 		TheTest.Printf(_L("===RSqlStatement::BindZeroBlob(), 8-bit SQL\r\n"));
 
  1320 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtBindZeroBlobL, dbFileName[i], dbType[i]);
 
  1322 		TheTest.Printf(_L("===RSqlStatement::BindZeroBlob(), 16-bit SQL\r\n"));
 
  1323 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtBindZeroBlobL, dbFileName[i], dbType[i]);
 
  1325 		TheTest.Printf(_L("===RSqlStatement::IsNull(), 8-bit SQL\r\n"));
 
  1326 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtIsNullColumnL, dbFileName[i], dbType[i]);
 
  1328 		TheTest.Printf(_L("===RSqlStatement::IsNull(), 16-bit SQL\r\n"));
 
  1329 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtIsNullColumnL, dbFileName[i], dbType[i]);
 
  1331 		TheTest.Printf(_L("===RSqlStatement::ColumnInt(), 8-bit SQL\r\n"));
 
  1332 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnIntL, dbFileName[i], dbType[i]);
 
  1334 		TheTest.Printf(_L("===RSqlStatement::ColumnInt(), 16-bit SQL\r\n"));
 
  1335 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnIntL, dbFileName[i], dbType[i]);
 
  1337 		TheTest.Printf(_L("===RSqlStatement::ColumnInt64(), 8-bit SQL\r\n"));
 
  1338 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnInt64L, dbFileName[i], dbType[i]);
 
  1340 		TheTest.Printf(_L("===RSqlStatement::ColumnInt64(), 16-bit SQL\r\n"));
 
  1341 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnInt64L, dbFileName[i], dbType[i]);
 
  1343 		TheTest.Printf(_L("===RSqlStatement::ColumnReal(), 8-bit SQL\r\n"));
 
  1344 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnRealL, dbFileName[i], dbType[i]);
 
  1346 		TheTest.Printf(_L("===RSqlStatement::ColumnReal(), 16-bit SQL\r\n"));
 
  1347 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnRealL, dbFileName[i], dbType[i]);
 
  1349 		TheTest.Printf(_L("===RSqlStatement::ColumnTextL(), 8-bit SQL\r\n"));
 
  1350 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnText1L, dbFileName[i], dbType[i]);
 
  1352 		TheTest.Printf(_L("===RSqlStatement::ColumnTextL(), 16-bit SQL\r\n"));
 
  1353 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnText1L, dbFileName[i], dbType[i]);
 
  1355 		TheTest.Printf(_L("===RSqlStatement::ColumnText()-1, 8-bit SQL\r\n"));
 
  1356 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnText2L, dbFileName[i], dbType[i]);
 
  1358 		TheTest.Printf(_L("===RSqlStatement::ColumnText()-1, 16-bit SQL\r\n"));
 
  1359 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnText2L, dbFileName[i], dbType[i]);
 
  1361 		TheTest.Printf(_L("===RSqlStatement::ColumnText()-2, 8-bit SQL\r\n"));
 
  1362 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnText3L, dbFileName[i], dbType[i]);
 
  1364 		TheTest.Printf(_L("===RSqlStatement::ColumnText()-2, 16-bit SQL\r\n"));
 
  1365 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnText3L, dbFileName[i], dbType[i]);
 
  1367 		TheTest.Printf(_L("===RSqlStatement::ColumnBinaryL(), 8-bit SQL\r\n"));
 
  1368 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnBinary1L, dbFileName[i], dbType[i]);
 
  1370 		TheTest.Printf(_L("===RSqlStatement::ColumnBinaryL(), 16-bit SQL\r\n"));
 
  1371 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnBinary1L, dbFileName[i], dbType[i]);
 
  1373 		TheTest.Printf(_L("===RSqlStatement::ColumnBinary()-1, 8-bit SQL\r\n"));
 
  1374 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnBinary2L, dbFileName[i], dbType[i]);
 
  1376 		TheTest.Printf(_L("===RSqlStatement::ColumnBinary()-1, 16-bit SQL\r\n"));
 
  1377 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnBinary2L, dbFileName[i], dbType[i]);
 
  1379 		TheTest.Printf(_L("===RSqlStatement::ColumnBinary()-2, 8-bit SQL\r\n"));
 
  1380 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnBinary3L, dbFileName[i], dbType[i]);
 
  1382 		TheTest.Printf(_L("===RSqlStatement::ColumnBinary()-2, 16-bit SQL\r\n"));
 
  1383 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnBinary3L, dbFileName[i], dbType[i]);
 
  1385 		TheTest.Printf(_L("===RSqlStatement::ColumnCount(), 8-bit SQL\r\n"));
 
  1386 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnCount, dbFileName[i], dbType[i]);
 
  1388 		TheTest.Printf(_L("===RSqlStatement::ColumnCount(), 16-bit SQL\r\n"));
 
  1389 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnCount, dbFileName[i], dbType[i]);
 
  1391 		TheTest.Printf(_L("===RSqlStatement::DeclaredColumnType(), 8-bit SQL\r\n"));
 
  1392 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtDeclaredColumnTypeL, dbFileName[i], dbType[i]);
 
  1394 		TheTest.Printf(_L("===RSqlStatement::DeclaredColumnType(), 16-bit SQL\r\n"));
 
  1395 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtDeclaredColumnTypeL, dbFileName[i], dbType[i]);
 
  1399 //RSqlStatement - negative OOM tests
 
  1400 void StmtOomNegativeTestsL()
 
  1402 	const TInt KTestCnt = 2;
 
  1403 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1404 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1406 	for(TInt i=0;i<KTestCnt;++i)
 
  1408 		TheTest.Printf(_L("===RSqlStatement::Prepare(), 8-bit SQL\r\n"));
 
  1409 		DoStmtPrepareOomTestL(&PrepareBadStmt8L, dbFileName[i], dbType[i], KSqlErrGeneral);
 
  1411 		TheTest.Printf(_L("===RSqlStatement::Prepare(), 16-bit SQL\r\n"));
 
  1412 		DoStmtPrepareOomTestL(&PrepareBadStmt16L, dbFileName[i], dbType[i], KSqlErrGeneral);
 
  1416 //RSqlColumnReadStream OOM tests
 
  1417 void ColumnReadStreamOomTestsL()
 
  1419 	const TInt KTestCnt = 2;
 
  1420 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1421 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1423 	for(TInt i=0;i<KTestCnt;++i)
 
  1425 		TheTest.Printf(_L("===RSqlColumnReadStream::ColumnBinary(), 8-bit SQL\r\n"));
 
  1426 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnBinaryStreamL, dbFileName[i], dbType[i]);
 
  1428 		TheTest.Printf(_L("===RSqlColumnReadStream::ColumnBinary(), 16-bit SQL\r\n"));
 
  1429 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnBinaryStreamL, dbFileName[i], dbType[i]);
 
  1431 		TheTest.Printf(_L("===RSqlColumnReadStream::ColumnText(), 8-bit SQL\r\n"));
 
  1432 		DoStmtOomTestL(&ExecInsertNextStmt8L, &StmtColumnTextStreamL, dbFileName[i], dbType[i]);
 
  1434 		TheTest.Printf(_L("===RSqlColumnReadStream::ColumnText(), 16-bit SQL\r\n"));
 
  1435 		DoStmtOomTestL(&ExecInsertNextStmt16L, &StmtColumnTextStreamL, dbFileName[i], dbType[i]);
 
  1439 //RSqlParamWriteStream OOM tests
 
  1440 void ParamWriteStreamOomTestsL()
 
  1442 	const TInt KTestCnt = 2;
 
  1443 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1444 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1446 	for(TInt i=0;i<KTestCnt;++i)
 
  1448 		TheTest.Printf(_L("===RSqlParamWriteStream::BindBinary(), 8-bit SQL\r\n"));
 
  1449 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtParamBinaryStreamL, dbFileName[i], dbType[i]);
 
  1451 		TheTest.Printf(_L("===RSqlParamWriteStream::BindBinary(), 16-bit SQL\r\n"));
 
  1452 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtParamBinaryStreamL, dbFileName[i], dbType[i]);
 
  1454 		TheTest.Printf(_L("===RSqlParamWriteStream::BindText(), 8-bit SQL\r\n"));
 
  1455 		DoStmtOomTestL(&PrepareInsertPrmStmt8L, &StmtParamTextStreamL, dbFileName[i], dbType[i]);
 
  1457 		TheTest.Printf(_L("===RSqlParamWriteStream::BindText(), 16-bit SQL\r\n"));
 
  1458 		DoStmtOomTestL(&PrepareInsertPrmStmt16L, &StmtParamTextStreamL, dbFileName[i], dbType[i]);
 
  1462 //TSqlScalarFullSelectQuery OOM tests
 
  1463 void ScalarFullSelectQueryOomTestsL()
 
  1465 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectIntL(), 8-bit SQL\r\n"));
 
  1466 	DoFullSelectOomTest(&ScalarFullSelectInt_8L);
 
  1468 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectInt64L(), 8-bit SQL\r\n"));
 
  1469 	DoFullSelectOomTest(&ScalarFullSelectInt64_8L);
 
  1471 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectRealL(), 8-bit SQL\r\n"));
 
  1472 	DoFullSelectOomTest(&ScalarFullSelectReal_8L);
 
  1474 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectTextL(), 8-bit SQL\r\n"));
 
  1475 	DoFullSelectOomTest(&ScalarFullSelectText_8L);
 
  1477 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectBinaryL(), 8-bit SQL\r\n"));
 
  1478 	DoFullSelectOomTest(&ScalarFullSelectBinary_8L);
 
  1480 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectIntL(), 16-bit SQL\r\n"));
 
  1481 	DoFullSelectOomTest(&ScalarFullSelectInt_16L);
 
  1483 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectInt64L(), 16-bit SQL\r\n"));
 
  1484 	DoFullSelectOomTest(&ScalarFullSelectInt64_16L);
 
  1486 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectRealL(), 16-bit SQL\r\n"));
 
  1487 	DoFullSelectOomTest(&ScalarFullSelectReal_16L);
 
  1489 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectTextL(), 16-bit SQL\r\n"));
 
  1490 	DoFullSelectOomTest(&ScalarFullSelectText_16L);
 
  1492 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectBinaryL(), 16-bit SQL\r\n"));
 
  1493 	DoFullSelectOomTest(&ScalarFullSelectBinary_16L);
 
  1495 	TheTest.Printf(_L("===TSqlScalarFullSelectQuery::SelectTextL(), 8-bit SQL, small buffer\r\n"));
 
  1496 	DoFullSelectOomTest(&ScalarFullSelectText2_8L);
 
  1499 void BlobReadStreamOomTestsL()
 
  1501 	const TInt KTestCnt = 2;
 
  1502 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1503 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1505 	for(TInt i=0;i<KTestCnt;++i)
 
  1507 		TheTest.Printf(_L("===RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::ReadL()\r\n"));
 
  1508 		DoBlobOomTestL(&ExecInsertBlobL, &BlobReadStreamOpenL, dbFileName[i], dbType[i]);
 
  1510 		TheTest.Printf(_L("===RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::ReadL() + attached database\r\n"));
 
  1511 		DoBlobOomTestL(&ExecInsertBlobL, &BlobReadStreamOpenL, dbFileName[i], dbType[i], ETrue);
 
  1513 		TheTest.Printf(_L("===RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::SizeL()\r\n"));
 
  1514 		DoBlobOomTestL(&ExecInsertBlobL, &BlobReadStreamSizeL, dbFileName[i], dbType[i]);
 
  1516 		TheTest.Printf(_L("===RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::SizeL() + attached database\r\n"));
 
  1517 		DoBlobOomTestL(&ExecInsertBlobL, &BlobReadStreamSizeL, dbFileName[i], dbType[i], ETrue);
 
  1521 void BlobWriteStreamOomTestsL()
 
  1523 	const TInt KTestCnt = 2;
 
  1524 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1525 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1527 	for(TInt i=0;i<KTestCnt;++i)
 
  1529 		TheTest.Printf(_L("===RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::WriteL()\r\n"));
 
  1530 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWriteStreamOpenL, dbFileName[i], dbType[i]);
 
  1532 		TheTest.Printf(_L("===RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::WriteL() + attached database\r\n"));
 
  1533 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWriteStreamOpenL, dbFileName[i], dbType[i], ETrue);
 
  1535 		TheTest.Printf(_L("===RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::SizeL()\r\n"));
 
  1536 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWriteStreamSizeL, dbFileName[i], dbType[i]);
 
  1538 		TheTest.Printf(_L("===RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::SizeL() + attached database\r\n"));
 
  1539 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWriteStreamSizeL, dbFileName[i], dbType[i], ETrue);
 
  1543 void BlobWholeOomTestsL()
 
  1545 	const TInt KTestCnt = 2;
 
  1546 	const TPtrC dbFileName[KTestCnt] = {KTestDb(), 	KSecureTestDb()};
 
  1547 	TDbType dbType[KTestCnt] = {ENonSecureDb, ESecureDb};
 
  1549 	for(TInt i=0;i<KTestCnt;++i)
 
  1551 		TheTest.Printf(_L("===TSqlBlob::GetLC()\r\n"));
 
  1552 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWholeGet1L, dbFileName[i], dbType[i]);
 
  1554 		TheTest.Printf(_L("===TSqlBlob::Get()\r\n"));
 
  1555 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWholeGet2L, dbFileName[i], dbType[i]);
 
  1557 		TheTest.Printf(_L("===TSqlBlob::SetL()\r\n"));
 
  1558 		DoBlobOomTestL(&ExecInsertBlobL, &BlobWholeSetL, dbFileName[i], dbType[i]);
 
  1564 	TheTest.Start(_L("SQL OOM tests - 2"));
 
  1568 	StmtOomNegativeTestsL();
 
  1570 	ColumnReadStreamOomTestsL();
 
  1572 	ParamWriteStreamOomTestsL();
 
  1574 	ScalarFullSelectQueryOomTestsL();
 
  1576 	BlobReadStreamOomTestsL();
 
  1578 	BlobWriteStreamOomTestsL();
 
  1580 	BlobWholeOomTestsL();
 
  1587 	CTrapCleanup* tc = CTrapCleanup::New();
 
  1594 	TRAPD(err, DoTestsL());
 
  1596 	TEST2(err, KErrNone);
 
  1605 	User::Heap().Check();