os/persistentdata/persistentstorage/sqlite3api/TEST/t_sqlitedb64.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
#include <e32test.h>
sl@0
    16
#include <bautils.h>
sl@0
    17
#include <f32file64.h>
sl@0
    18
#include <e32math.h>
sl@0
    19
#include <hal.h>
sl@0
    20
#include <sqlite3.h>
sl@0
    21
#include <string.h>
sl@0
    22
#include <stdio.h>
sl@0
    23
sl@0
    24
///////////////////////////////////////////////////////////////////////////////////////
sl@0
    25
sl@0
    26
RTest TheTest(_L("t_sqlitedb64 test"));
sl@0
    27
sl@0
    28
_LIT(KTestDbName,	"\\test\\t_sqlitedb64.db");
sl@0
    29
sl@0
    30
RFs TheFs;
sl@0
    31
sl@0
    32
sqlite3* TheDb = 0;
sl@0
    33
sqlite3_stmt* TheStmt = 0;
sl@0
    34
sl@0
    35
const TInt64 K1Mb = 1024LL * 1024LL;
sl@0
    36
const TInt64 K1Gb = 1024LL * K1Mb;
sl@0
    37
const TInt64 K4Gb = 4LL * K1Gb;
sl@0
    38
sl@0
    39
TInt64 TheLastInsertedRowid = -1LL;
sl@0
    40
sl@0
    41
struct TTestDriveInfo
sl@0
    42
	{
sl@0
    43
	TInt	iSizeMb;	
sl@0
    44
	TBool	iWritable;	
sl@0
    45
	};
sl@0
    46
	
sl@0
    47
TTestDriveInfo TheDriveInfo[KMaxDrives];
sl@0
    48
TInt   		   TheBiggestDriveNo = -1;
sl@0
    49
TFileName 	   TheDbName;
sl@0
    50
char		   TheDbName8[KMaxFileName];
sl@0
    51
sl@0
    52
///////////////////////////////////////////////////////////////////////////////////////
sl@0
    53
sl@0
    54
static void DeleteTestFiles()
sl@0
    55
	{
sl@0
    56
	if(TheStmt)
sl@0
    57
		{
sl@0
    58
		sqlite3_finalize(TheStmt);	
sl@0
    59
		TheStmt = 0;
sl@0
    60
		}
sl@0
    61
	if(TheDb)
sl@0
    62
		{
sl@0
    63
		(void)sqlite3_close(TheDb);
sl@0
    64
		TheDb = 0;
sl@0
    65
		}
sl@0
    66
	(void)TheFs.Delete(TheDbName);
sl@0
    67
	}
sl@0
    68
sl@0
    69
///////////////////////////////////////////////////////////////////////////////////////
sl@0
    70
static void PrintSqliteErrMsg()
sl@0
    71
	{
sl@0
    72
	if(TheDb)
sl@0
    73
		{
sl@0
    74
		const char* msg = sqlite3_errmsg(TheDb);
sl@0
    75
		TBuf<200> buf;
sl@0
    76
		buf.Copy(TPtrC8((const TUint8*)msg));
sl@0
    77
		TheTest.Printf(_L("*** SQLite error message: \"%S\"\r\n"), &buf);
sl@0
    78
		}
sl@0
    79
	}
sl@0
    80
sl@0
    81
//Test macros and functions
sl@0
    82
static void Check(TInt aValue, TInt aLine)
sl@0
    83
	{
sl@0
    84
	if(!aValue)
sl@0
    85
		{
sl@0
    86
		DeleteTestFiles();
sl@0
    87
		PrintSqliteErrMsg();
sl@0
    88
		TheTest(EFalse, aLine);
sl@0
    89
		}
sl@0
    90
	}
sl@0
    91
static void Check(TInt aValue, TInt aExpected, TInt aLine)
sl@0
    92
	{
sl@0
    93
	if(aValue != aExpected)
sl@0
    94
		{
sl@0
    95
		DeleteTestFiles();
sl@0
    96
		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
sl@0
    97
		PrintSqliteErrMsg();
sl@0
    98
		TheTest(EFalse, aLine);
sl@0
    99
		}
sl@0
   100
	}
sl@0
   101
#define TEST(arg) ::Check((arg), __LINE__)
sl@0
   102
#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
sl@0
   103
sl@0
   104
///////////////////////////////////////////////////////////////////////////////////////
sl@0
   105
sl@0
   106
void SqlTimerPrint(const TDesC& aText, TUint32 aStartTicks, TUint32 aEndTicks)
sl@0
   107
	{
sl@0
   108
	static TInt freq = 0;
sl@0
   109
	if(freq == 0)
sl@0
   110
		{
sl@0
   111
		TEST2(HAL::Get(HAL::EFastCounterFrequency, freq), KErrNone);
sl@0
   112
		}
sl@0
   113
	TInt64 diffTicks = (TInt64)aEndTicks - (TInt64)aStartTicks;
sl@0
   114
	if(diffTicks < 0)
sl@0
   115
		{
sl@0
   116
		diffTicks = KMaxTUint32 + diffTicks + 1;
sl@0
   117
		}
sl@0
   118
	const TInt KMicroSecIn1Sec = 1000000;
sl@0
   119
	TInt32 us = (diffTicks * KMicroSecIn1Sec) / freq;
sl@0
   120
	TheTest.Printf(_L("#### %S. Execution time: %d us\r\n"), &aText, us);
sl@0
   121
	}
sl@0
   122
sl@0
   123
TUint32 SqlTimerTicks()
sl@0
   124
	{
sl@0
   125
	return User::FastCounter();
sl@0
   126
	}
sl@0
   127
sl@0
   128
void CollectDriveInfo()
sl@0
   129
	{
sl@0
   130
	TheTest.Printf(_L("==================\r\n"));
sl@0
   131
	_LIT(KType1, "Not present");
sl@0
   132
	_LIT(KType2, "Unknown");
sl@0
   133
	_LIT(KType3, "Floppy");
sl@0
   134
	_LIT(KType4, "Hard disk");
sl@0
   135
	_LIT(KType5, "CD ROM");
sl@0
   136
	_LIT(KType6, "RAM disk");
sl@0
   137
	_LIT(KType7, "Flash");
sl@0
   138
	_LIT(KType8, "ROM drive");
sl@0
   139
	_LIT(KType9, "Remote drive");
sl@0
   140
	_LIT(KType10,"NAND flash");
sl@0
   141
	_LIT(KType11,"Rotating media");
sl@0
   142
	
sl@0
   143
	Mem::FillZ(TheDriveInfo, sizeof(TheDriveInfo));
sl@0
   144
	TheBiggestDriveNo = 0;
sl@0
   145
	
sl@0
   146
	for(TInt drive=EDriveA;drive<=EDriveZ;++drive)
sl@0
   147
		{
sl@0
   148
		TDriveInfo driveInfo;
sl@0
   149
		TInt err = TheFs.Drive(driveInfo, drive);
sl@0
   150
		if(err == KErrNone)
sl@0
   151
			{
sl@0
   152
			TVolumeInfo vinfo;
sl@0
   153
			err = TheFs.Volume(vinfo, drive);
sl@0
   154
			if(err == KErrNone)
sl@0
   155
				{
sl@0
   156
				TVolumeIOParamInfo vparam;
sl@0
   157
				err = TheFs.VolumeIOParam(drive, vparam);
sl@0
   158
				TEST2(err, KErrNone);
sl@0
   159
				TBuf8<128> vinfoex8;
sl@0
   160
				err = TheFs.QueryVolumeInfoExt(drive, EFileSystemSubType, vinfoex8);
sl@0
   161
				TEST2(err, KErrNone);
sl@0
   162
				TPtrC vinfoex((const TUint16*)(vinfoex8.Ptr() + 8), vinfoex8[0]);
sl@0
   163
				TPtrC KMediaTypeNames[] = {KType1(), KType2(), KType3(), KType4(), KType5(), KType6(), KType7(), KType8(), KType9(), KType10(), KType11()};
sl@0
   164
				TInt sizeMb = vinfo.iSize / K1Mb;
sl@0
   165
				TheTest.Printf(_L("Drive: %C:, Type: %16.16S, File System: %8.8S, Size: %d Mb.\r\n"), 'A' + drive, &KMediaTypeNames[driveInfo.iType], &vinfoex, sizeMb);
sl@0
   166
				TheTest.Printf(_L("       Block size=%d, Cluster size=%d, Read buffer size=%d.\r\n"), vparam.iBlockSize, vparam.iClusterSize, vparam.iRecReadBufSize);
sl@0
   167
				TheDriveInfo[drive].iSizeMb = sizeMb;
sl@0
   168
				if(driveInfo.iType == EMediaRam || driveInfo.iType == EMediaHardDisk || driveInfo.iType == EMediaFlash || driveInfo.iType == EMediaNANDFlash)
sl@0
   169
				  	{
sl@0
   170
					TheDriveInfo[drive].iWritable = ETrue;
sl@0
   171
					if(sizeMb > TheDriveInfo[TheBiggestDriveNo].iSizeMb)
sl@0
   172
						{
sl@0
   173
						TheBiggestDriveNo = drive;
sl@0
   174
						}
sl@0
   175
					}
sl@0
   176
				}
sl@0
   177
			else
sl@0
   178
				{
sl@0
   179
				TheTest.Printf(_L("Drive %C. RFs::Volume() has failed with err=%d.\r\n"), 'A' + drive, err);	
sl@0
   180
				}
sl@0
   181
			}
sl@0
   182
		else
sl@0
   183
			{
sl@0
   184
			TheTest.Printf(_L("Drive %C. RFs::Drive() has failed with err=%d.\r\n"), 'A' + drive, err);	
sl@0
   185
			}
sl@0
   186
		}
sl@0
   187
		
sl@0
   188
	TheTest.Printf(_L("The biggest R/W drive is: %C, Size: %d Mb\r\n"), 'A' + TheBiggestDriveNo, TheDriveInfo[TheBiggestDriveNo].iSizeMb);
sl@0
   189
	TDriveUnit drvUnit(TheBiggestDriveNo);
sl@0
   190
	TDriveName drvName = drvUnit.Name();
sl@0
   191
	TParse parse;
sl@0
   192
	parse.Set(KTestDbName, &drvName, NULL);
sl@0
   193
	TheDbName.Copy(parse.FullName());
sl@0
   194
	TPtr8 p((TUint8*)TheDbName8, 0, KMaxFileName);
sl@0
   195
	p.Copy(TheDbName);
sl@0
   196
	p.Append(TChar(0));
sl@0
   197
sl@0
   198
	TRAPD(err, BaflUtils::EnsurePathExistsL(TheFs, TheDbName));
sl@0
   199
	TEST(err == KErrNone || err == KErrAlreadyExists);
sl@0
   200
sl@0
   201
	TheTest.Printf(_L("==================\r\n"));
sl@0
   202
	}
sl@0
   203
sl@0
   204
///////////////////////////////////////////////////////////////////////////////////////
sl@0
   205
sl@0
   206
/**
sl@0
   207
@SYMTestCaseID			PDS-SQLITE3-CT-4041
sl@0
   208
@SYMTestCaseDesc		Creation of a database bigger than 4Gb (KMaxTUint).
sl@0
   209
						The test creates a test database with a table and inserts records into the table
sl@0
   210
						until the database size gets bigger than 4Gb (KMaxTUint). The purpose of the test is to verify
sl@0
   211
						that it is possible to create and manipulate 64-bit SQLite databases.
sl@0
   212
@SYMTestActions			Creation of a database bigger than 4Gb (KMaxTUint).
sl@0
   213
@SYMTestExpectedResults Test must not fail
sl@0
   214
@SYMTestPriority 	    High
sl@0
   215
@SYMREQ					REQ12107
sl@0
   216
                        REQ12108
sl@0
   217
*/
sl@0
   218
void CreateBigDbTest(TInt64 aDbSize)
sl@0
   219
	{
sl@0
   220
	__ASSERT_ALWAYS(aDbSize > 0LL, User::Invariant());
sl@0
   221
	(void)TheFs.Delete(TheDbName);
sl@0
   222
sl@0
   223
	const char* ver = sqlite3_libversion();
sl@0
   224
	TBuf<20> buf;
sl@0
   225
	buf.Copy(TPtrC8((const TUint8*)ver));
sl@0
   226
	TheTest.Printf(_L("*** SQLite library version: \"%S\"\r\n"), &buf);
sl@0
   227
	
sl@0
   228
	TInt err = sqlite3_open(TheDbName8, &TheDb);
sl@0
   229
	TEST2(err, SQLITE_OK);
sl@0
   230
	
sl@0
   231
	//
sl@0
   232
	err = sqlite3_exec(TheDb, "CREATE TABLE A(Id INTEGER PRIMARY KEY AUTOINCREMENT, Data BLOB)", 0, 0, 0);
sl@0
   233
	TEST2(err, SQLITE_OK);
sl@0
   234
	TInt64 fsize = 0;
sl@0
   235
	TheTest.Printf(_L("==File size:"));
sl@0
   236
	while(fsize < aDbSize)
sl@0
   237
		{
sl@0
   238
		const TInt KRecCnt = 1000;
sl@0
   239
		//Insert KRecCnt records in a transaction
sl@0
   240
		err = sqlite3_exec(TheDb, "BEGIN", 0, 0, 0);	
sl@0
   241
		if(err != SQLITE_OK)
sl@0
   242
			{
sl@0
   243
			TheTest.Printf(_L("==='BEGIN' has failed with err %d\r\n"), err);
sl@0
   244
			}
sl@0
   245
		TEST2(err, SQLITE_OK);
sl@0
   246
		err = sqlite3_prepare(TheDb, "INSERT INTO A(Data) VALUES(zeroblob(32768))", -1, &TheStmt, 0);//32Kb big blob
sl@0
   247
		TEST2(err, SQLITE_OK);
sl@0
   248
		for(TInt i=0;i<KRecCnt;++i)
sl@0
   249
			{
sl@0
   250
			err = sqlite3_step(TheStmt);
sl@0
   251
			TEST2(err, SQLITE_DONE);
sl@0
   252
			err = sqlite3_reset(TheStmt);
sl@0
   253
			TEST2(err, SQLITE_OK);
sl@0
   254
			}
sl@0
   255
		err = sqlite3_finalize(TheStmt);
sl@0
   256
		TEST2(err, SQLITE_OK);
sl@0
   257
		TheStmt = 0;
sl@0
   258
		err = sqlite3_exec(TheDb, "COMMIT", 0, 0, 0);	
sl@0
   259
		if(err != SQLITE_OK)
sl@0
   260
			{
sl@0
   261
			TheTest.Printf(_L("==='COMMIT' has failed with err %d\r\n"), err);	
sl@0
   262
			}
sl@0
   263
		TEST2(err, SQLITE_OK);
sl@0
   264
		TheLastInsertedRowid = sqlite3_last_insert_rowid(TheDb);
sl@0
   265
		TEST(TheLastInsertedRowid > 0LL);
sl@0
   266
		//Check and print the file size
sl@0
   267
		sqlite3_close(TheDb);
sl@0
   268
		TheDb = 0;
sl@0
   269
		RFile64 file;
sl@0
   270
		err = file.Open(TheFs, TheDbName, EFileRead | EFileWrite);
sl@0
   271
		TEST2(err, KErrNone);
sl@0
   272
		err = file.Size(fsize);
sl@0
   273
		TEST2(err, KErrNone);
sl@0
   274
		file.Close();
sl@0
   275
		TheTest.Printf(_L(" %ldMb"), fsize / K1Mb);
sl@0
   276
		err = sqlite3_open(TheDbName8, &TheDb);
sl@0
   277
		TEST2(err, SQLITE_OK);
sl@0
   278
		}
sl@0
   279
	TheTest.Printf(_L("\r\n"));
sl@0
   280
	//
sl@0
   281
	sqlite3_close(TheDb);
sl@0
   282
	TheDb = 0;
sl@0
   283
	}
sl@0
   284
sl@0
   285
/**
sl@0
   286
@SYMTestCaseID			PDS-SQLITE3-CT-4042
sl@0
   287
@SYMTestCaseDesc		SQLite operations on a 64-bit database.
sl@0
   288
						The test uses the database created in test case PDS-SQLITE3-UT-4041.
sl@0
   289
						Simple INSERT, UPDATE, DELETE and SELECT statements are executed on the database.
sl@0
   290
						The data in the test SQL statements is such that the manipulated records are beyond the 4Gb
sl@0
   291
						file offset. Some other of the test SQL statements will perform sequential scan of the whole
sl@0
   292
						database from offset 0 to the end of the database file.
sl@0
   293
						The purpose of the test is to verify that there are no problem if the database offset is 64-bit.
sl@0
   294
@SYMTestActions			SQLite operations on a 64-bit database.
sl@0
   295
@SYMTestExpectedResults Test must not fail
sl@0
   296
@SYMTestPriority 	    High
sl@0
   297
@SYMREQ					REQ12107
sl@0
   298
                        REQ12108
sl@0
   299
*/
sl@0
   300
void SimpleDbOperationsTest()
sl@0
   301
	{
sl@0
   302
	__ASSERT_ALWAYS(TheLastInsertedRowid > 0LL, User::Invariant());
sl@0
   303
	TInt err = sqlite3_open(TheDbName8, &TheDb);
sl@0
   304
	TEST2(err, SQLITE_OK);
sl@0
   305
sl@0
   306
	//SELECT-1
sl@0
   307
	TUint32 start = SqlTimerTicks();
sl@0
   308
	err = sqlite3_prepare(TheDb, "SELECT Id FROM A WHERE ROWID = :Prm", -1, &TheStmt, 0);
sl@0
   309
	TEST2(err, SQLITE_OK);
sl@0
   310
	err = sqlite3_bind_int64(TheStmt, 1, TheLastInsertedRowid - 1LL);
sl@0
   311
	TEST2(err, SQLITE_OK);
sl@0
   312
	err = sqlite3_step(TheStmt);
sl@0
   313
	TEST2(err, SQLITE_ROW);
sl@0
   314
	TInt64 id = sqlite3_column_int64(TheStmt, 0);
sl@0
   315
	TheTest.Printf(_L("==Id=%ld\r\n"), id);
sl@0
   316
	sqlite3_finalize(TheStmt);
sl@0
   317
	TheStmt = 0;
sl@0
   318
	TUint32 end = SqlTimerTicks();
sl@0
   319
	SqlTimerPrint(_L("SELECT-1"), start, end);
sl@0
   320
sl@0
   321
	//INSERT
sl@0
   322
	start = SqlTimerTicks();
sl@0
   323
	err = sqlite3_exec(TheDb, "INSERT INTO A(Data) VALUES('123456')", 0, 0, 0);
sl@0
   324
	TEST2(err, SQLITE_OK);
sl@0
   325
	end = SqlTimerTicks();
sl@0
   326
	TInt cnt = sqlite3_changes(TheDb);
sl@0
   327
	TEST2(cnt, 1);
sl@0
   328
	SqlTimerPrint(_L("INSERT"), start, end);
sl@0
   329
	
sl@0
   330
	//UPDATE
sl@0
   331
	start = SqlTimerTicks();
sl@0
   332
	TBuf<100> sql;
sl@0
   333
	sql.Format(_L("UPDATE A SET Data='56789' WHERE Id=%ld"), id);
sl@0
   334
	TBuf8<100> sql8;
sl@0
   335
	sql8.Copy(sql);
sl@0
   336
	err = sqlite3_exec(TheDb, (const char*)sql8.PtrZ(), 0, 0, 0);
sl@0
   337
	TEST2(err, SQLITE_OK);
sl@0
   338
	end = SqlTimerTicks();
sl@0
   339
	cnt = sqlite3_changes(TheDb);
sl@0
   340
	TEST2(cnt, 1);
sl@0
   341
	SqlTimerPrint(_L("UPDATE"), start, end);
sl@0
   342
	
sl@0
   343
	//SELECT-2
sl@0
   344
	start = SqlTimerTicks();
sl@0
   345
	sql.Format(_L("SELECT Data FROM A WHERE ID = %ld"), id);
sl@0
   346
	sql8.Copy(sql);
sl@0
   347
	err = sqlite3_prepare(TheDb, (const char*)sql8.PtrZ(), -1, &TheStmt, 0);
sl@0
   348
	TEST2(err, SQLITE_OK);
sl@0
   349
	err = sqlite3_step(TheStmt);
sl@0
   350
	TEST2(err, SQLITE_ROW);
sl@0
   351
	const char* data = (const char*)sqlite3_column_text(TheStmt, 0);
sl@0
   352
	TEST(data != 0);
sl@0
   353
	err = strcmp(data, "56789");
sl@0
   354
	TEST2(err, 0);
sl@0
   355
	sqlite3_finalize(TheStmt);
sl@0
   356
	TheStmt = 0;
sl@0
   357
	end = SqlTimerTicks();
sl@0
   358
	SqlTimerPrint(_L("SELECT-2"), start, end);
sl@0
   359
	
sl@0
   360
	//SELECT-3
sl@0
   361
	start = SqlTimerTicks();
sl@0
   362
	err = sqlite3_prepare(TheDb, "SELECT COUNT(*) FROM A", -1, &TheStmt, 0);
sl@0
   363
	TEST2(err, SQLITE_OK);
sl@0
   364
	err = sqlite3_step(TheStmt);
sl@0
   365
	TEST2(err, SQLITE_ROW);
sl@0
   366
	TInt recCnt = sqlite3_column_int(TheStmt, 0);
sl@0
   367
	TheTest.Printf(_L("==Records count: %d\r\n"), recCnt);
sl@0
   368
	sqlite3_finalize(TheStmt);
sl@0
   369
	TheStmt = 0;
sl@0
   370
	end = SqlTimerTicks();
sl@0
   371
	SqlTimerPrint(_L("SELECT-3"), start, end);
sl@0
   372
	TEST(recCnt > 0);
sl@0
   373
sl@0
   374
	//SELECT-4
sl@0
   375
	start = SqlTimerTicks();
sl@0
   376
	err = sqlite3_prepare(TheDb, "SELECT MAX(ROWID) FROM A", -1, &TheStmt, 0);
sl@0
   377
	TEST2(err, SQLITE_OK);
sl@0
   378
	err = sqlite3_step(TheStmt);
sl@0
   379
	TEST2(err, SQLITE_ROW);
sl@0
   380
	TInt rowid = sqlite3_column_int(TheStmt, 0);
sl@0
   381
	TheTest.Printf(_L("==MAX(ROWID): %d\r\n"), recCnt);
sl@0
   382
	sqlite3_finalize(TheStmt);
sl@0
   383
	TheStmt = 0;
sl@0
   384
	end = SqlTimerTicks();
sl@0
   385
	SqlTimerPrint(_L("SELECT-4"), start, end);
sl@0
   386
	TEST(rowid > 0);
sl@0
   387
	
sl@0
   388
	//DELETE
sl@0
   389
	start = SqlTimerTicks();
sl@0
   390
	sql.Format(_L("DELETE FROM A WHERE ID = %ld"), id);
sl@0
   391
	sql8.Copy(sql);
sl@0
   392
	err = sqlite3_exec(TheDb, (const char*)sql8.PtrZ(), 0, 0, 0);
sl@0
   393
	TEST2(err, SQLITE_OK);
sl@0
   394
	end = SqlTimerTicks();
sl@0
   395
	cnt = sqlite3_changes(TheDb);
sl@0
   396
	TEST2(cnt, 1);
sl@0
   397
	SqlTimerPrint(_L("DELETE"), start, end);
sl@0
   398
	
sl@0
   399
	sqlite3_close(TheDb);
sl@0
   400
	TheDb = 0;
sl@0
   401
	}
sl@0
   402
sl@0
   403
///////////////////////////////////////////////////////////////////////////////////////
sl@0
   404
sl@0
   405
static void DoTests()
sl@0
   406
	{
sl@0
   407
	TheTest.Start(_L("Collect drive information"));
sl@0
   408
	CollectDriveInfo();
sl@0
   409
	
sl@0
   410
	TInt64 maxDrvSize = TheDriveInfo[TheBiggestDriveNo].iSizeMb * K1Mb;
sl@0
   411
	if(maxDrvSize <= K4Gb)
sl@0
   412
		{
sl@0
   413
		TheTest.Printf(_L("There is no drive bigger than 4Gb. The tests won't be executed.\r\n"));
sl@0
   414
		return;	
sl@0
   415
		}
sl@0
   416
	
sl@0
   417
	TheTest.Next(_L(" @SYMTestCaseID:PDS-SQLITE3-CT-4041 Create database, bigger than 4Gb"));
sl@0
   418
	CreateBigDbTest(K4Gb + 64 * K1Mb);
sl@0
   419
sl@0
   420
	TheTest.Next (_L("  @SYMTestCaseID:PDS-SQLITE3-CT-4042 64-bit database - simple operations test"));
sl@0
   421
	SimpleDbOperationsTest();
sl@0
   422
sl@0
   423
	(void)TheFs.Delete(TheDbName);
sl@0
   424
	}
sl@0
   425
sl@0
   426
TInt E32Main()
sl@0
   427
	{
sl@0
   428
	TheTest.Title();
sl@0
   429
sl@0
   430
	CTrapCleanup* tc = CTrapCleanup::New();
sl@0
   431
	TheTest(tc != NULL);
sl@0
   432
sl@0
   433
	__UHEAP_MARK;
sl@0
   434
sl@0
   435
	TInt err = TheFs.Connect();
sl@0
   436
	TheTest(err == KErrNone);
sl@0
   437
sl@0
   438
	DeleteTestFiles();
sl@0
   439
	DoTests();
sl@0
   440
	DeleteTestFiles();
sl@0
   441
sl@0
   442
	__UHEAP_MARKEND;
sl@0
   443
sl@0
   444
	TheFs.Close();
sl@0
   445
	TheTest.End();
sl@0
   446
	TheTest.Close();
sl@0
   447
sl@0
   448
	delete tc;
sl@0
   449
sl@0
   450
	User::Heap().Check();
sl@0
   451
	return KErrNone;
sl@0
   452
	}