persistentstorage/sql/TEST/t_sqloom2.cpp
branchRCL_3
changeset 15 fcc16690f446
parent 11 211563e4b919
equal deleted inserted replaced
14:04ec7606545c 15:fcc16690f446
   795 	err = aDb.Exec(TheSqlBuf);
   795 	err = aDb.Exec(TheSqlBuf);
   796 	User::LeaveIfError(err);
   796 	User::LeaveIfError(err);
   797 	}
   797 	}
   798 
   798 
   799 //"RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::ReadL()" OOM test
   799 //"RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::ReadL()" OOM test
   800 void BlobReadStreamOpenL(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   800 void BlobReadStreamOpenL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   801 	{
   801 	{
   802 	RSqlBlobReadStream strm;
   802 	RSqlBlobReadStream strm;
   803 	CleanupClosePushL(strm);
   803 	CleanupClosePushL(strm);
   804 	if(aAttachDbName.Length() > 0)
   804 	if(aAttachDbName.Length() > 0)
   805 		{
   805 		{
   822 		}
   822 		}
   823 	CleanupStack::PopAndDestroy(&strm);
   823 	CleanupStack::PopAndDestroy(&strm);
   824 	}
   824 	}
   825 
   825 
   826 //"RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::SizeL()" OOM test
   826 //"RSqlBlobReadStream::OpenL()/RSqlBlobReadStream::SizeL()" OOM test
   827 void BlobReadStreamSizeL(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   827 void BlobReadStreamSizeL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   828 	{
   828 	{
   829 	RSqlBlobReadStream strm;
   829 	RSqlBlobReadStream strm;
   830 	CleanupClosePushL(strm);
   830 	CleanupClosePushL(strm);
   831 	if(aAttachDbName.Length() > 0)
   831 	if(aAttachDbName.Length() > 0)
   832 		{
   832 		{
   840 	TEST2(size, KBlobLen);
   840 	TEST2(size, KBlobLen);
   841 	CleanupStack::PopAndDestroy(&strm);
   841 	CleanupStack::PopAndDestroy(&strm);
   842 	}
   842 	}
   843 
   843 
   844 //"RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::WriteL()" OOM test
   844 //"RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::WriteL()" OOM test
   845 void BlobWriteStreamOpenL(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   845 void BlobWriteStreamOpenL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   846 	{
   846 	{
   847 	RSqlBlobWriteStream strm;
   847 	RSqlBlobWriteStream strm;
   848 	CleanupClosePushL(strm);
   848 	CleanupClosePushL(strm);
   849 	if(aAttachDbName.Length() > 0)
   849 	if(aAttachDbName.Length() > 0)
   850 		{
   850 		{
   864 	strm.CommitL();		
   864 	strm.CommitL();		
   865 	CleanupStack::PopAndDestroy(&strm);
   865 	CleanupStack::PopAndDestroy(&strm);
   866 	}
   866 	}
   867 
   867 
   868 //"RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::SizeL()" OOM test
   868 //"RSqlBlobWriteStream::OpenL()/RSqlBlobWriteStream::SizeL()" OOM test
   869 void BlobWriteStreamSizeL(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   869 void BlobWriteStreamSizeL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   870 	{
   870 	{
   871 	RSqlBlobWriteStream strm;
   871 	RSqlBlobWriteStream strm;
   872 	CleanupClosePushL(strm);
   872 	CleanupClosePushL(strm);
   873 	if(aAttachDbName.Length() > 0)
   873 	if(aAttachDbName.Length() > 0)
   874 		{
   874 		{
   882 	TEST2(size, KBlobLen);
   882 	TEST2(size, KBlobLen);
   883 	CleanupStack::PopAndDestroy(&strm);
   883 	CleanupStack::PopAndDestroy(&strm);
   884 	}
   884 	}
   885 	
   885 	
   886 //"TSqlBlob::GetLC()" OOM test
   886 //"TSqlBlob::GetLC()" OOM test
   887 void BlobWholeGet1L(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   887 void BlobWholeGet1L(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   888 	{
   888 	{
   889 	HBufC8* buf = NULL;
   889 	HBufC8* buf = NULL;
   890 	if(aAttachDbName.Length() > 0)
   890 	if(aAttachDbName.Length() > 0)
   891 		{
   891 		{
   892 		buf = TSqlBlob::GetLC(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
   892 		buf = TSqlBlob::GetLC(aDb, _L("BBB"), _L("fld5"), 1, aAttachDbName);
   898 	TEST(buf->Length() == KBlobStrLen);
   898 	TEST(buf->Length() == KBlobStrLen);
   899 	CleanupStack::PopAndDestroy(buf);
   899 	CleanupStack::PopAndDestroy(buf);
   900 	}
   900 	}
   901 	
   901 	
   902 //"TSqlBlob::Get()" OOM test
   902 //"TSqlBlob::Get()" OOM test
   903 void BlobWholeGet2L(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   903 void BlobWholeGet2L(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   904 	{
   904 	{
   905 	if(aAttachDbName.Length() > 0)
   905 	if(aAttachDbName.Length() > 0)
   906 		{
   906 		{
   907 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf2, 1, aAttachDbName);
   907 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf2, 1, aAttachDbName);
   908 		}
   908 		}
   911 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf2, 1);
   911 		TSqlBlob::Get(aDb, _L("BBB"), _L("fld5"), TheSqlBuf2, 1);
   912 		}
   912 		}
   913 	}
   913 	}
   914 
   914 
   915 //"TSqlBlob::SetL()" OOM test
   915 //"TSqlBlob::SetL()" OOM test
   916 void BlobWholeSetL(RSqlDatabase& aDb, const TDesC& aAttachDbName = KNullDesC)
   916 void BlobWholeSetL(RSqlDatabase& aDb, const TDesC& aAttachDbName)
   917 	{
   917 	{
   918 	if(aAttachDbName.Length() > 0)
   918 	if(aAttachDbName.Length() > 0)
   919 		{
   919 		{
   920 		TSqlBlob::SetL(aDb, _L("BBB"), _L("fld5"), TheSqlBuf, 1, aAttachDbName);
   920 		TSqlBlob::SetL(aDb, _L("BBB"), _L("fld5"), TheSqlBuf, 1, aAttachDbName);
   921 		}
   921 		}
   976 				{
   976 				{
   977 				TRAP(err, (*aBlobTestFuncPtrL)(db, KAttachDbName));
   977 				TRAP(err, (*aBlobTestFuncPtrL)(db, KAttachDbName));
   978 				}
   978 				}
   979 			else
   979 			else
   980 				{
   980 				{
   981 				TRAP(err, (*aBlobTestFuncPtrL)(db));
   981 				TRAP(err, (*aBlobTestFuncPtrL)(db, KNullDesC));
   982 				}
   982 				}
   983 
   983 
   984 			ResetHeapFailure(TheOomTestType[i]);
   984 			ResetHeapFailure(TheOomTestType[i]);
   985 
   985 
   986 			if(err != KErrNoMemory)
   986 			if(err != KErrNoMemory)