persistentstorage/sql/TEST/t_sqlperformance4.cpp
changeset 55 44f437012c90
parent 40 b8bdbc8f59c7
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
    23 ///////////////////////////////////////////////////////////////////////////////////////
    23 ///////////////////////////////////////////////////////////////////////////////////////
    24 
    24 
    25 RTest			TheTest(_L("t_sqlperformance4 test"));
    25 RTest			TheTest(_L("t_sqlperformance4 test"));
    26 RSqlDatabase 	TheDbC;
    26 RSqlDatabase 	TheDbC;
    27 RFs				TheFs;
    27 RFs				TheFs;
       
    28 RFile 			TheLogFile; 
    28 
    29 
    29 _LIT(KCDriveDatabase, "c:[a000017f]t_sqlperformance4.db");
    30 _LIT(KCDriveDatabase, "c:[a000017f]t_sqlperformance4.db");
    30 
    31 
    31 TFileName		TheDbFileName;
    32 TFileName		TheDbFileName;
    32 TBuf<200> TheTestTitle;
    33 TBuf<200> TheTestTitle;
   127 
   128 
   128 ///////////////////////////////////////////////////////////////////////////////////////
   129 ///////////////////////////////////////////////////////////////////////////////////////
   129 
   130 
   130 void TestEnvDestroy()
   131 void TestEnvDestroy()
   131 	{
   132 	{
       
   133 	if(TheCmdLineParams.iLogFileName.Length() > 0)
       
   134 		{
       
   135 		(void)TheLogFile.Flush();
       
   136 		TheLogFile.Close();
       
   137 		}
   132 	TheDbC.Close();
   138 	TheDbC.Close();
   133 	(void)RSqlDatabase::Delete(TheDbFileName);
   139 	(void)RSqlDatabase::Delete(TheDbFileName);
   134 	TheFs.Close();
   140 	TheFs.Close();
   135 	}
   141 	}
   136 
   142 
   237 	
   243 	
   238 	//Create database files
   244 	//Create database files
   239 	TRAP(err,CreateDatabaseL(TheDbFileName));
   245 	TRAP(err,CreateDatabaseL(TheDbFileName));
   240 	TEST2(err, KErrNone);
   246 	TEST2(err, KErrNone);
   241 	
   247 	
       
   248 	if(TheCmdLineParams.iLogFileName.Length() > 0)
       
   249 		{
       
   250 		err = TheLogFile.Replace(TheFs, TheCmdLineParams.iLogFileName, EFileRead | EFileWrite);
       
   251 		TEST2(err, KErrNone);
       
   252 		LogConfig(TheLogFile, TheCmdLineParams);
       
   253 		}
   242 	}
   254 	}
   243 	
   255 	
   244 		
   256 		
   245 ///////////////////////////////////////////////////////////////////////////////////////
   257 ///////////////////////////////////////////////////////////////////////////////////////
   246 /**
   258 /**
   362 		}
   374 		}
   363 	delete sqlBuf;
   375 	delete sqlBuf;
   364 	
   376 	
   365 	TheDbC.Close();
   377 	TheDbC.Close();
   366 	
   378 	
   367 	TheTest.Printf(_L("Total time to process Songs: %d us\n"), totalTime);
   379 	TheTest.Printf(_L("Total time to process Songs: %d us\r\n"), totalTime);
   368 	TheTest.Printf(_L("Transactions count: %d, \"INSERT\" count: %d, \"UPDATE\" count: %d, \"SELECT\" count: %d\n"), 
   380 	TheTest.Printf(_L("Transactions count: %d\r\n"), trnCnt);
   369 			               trnCnt, insertCnt, updateCnt, selectCnt);
   381 	TheTest.Printf(_L("\"INSERT\" count: %d\r\n"), insertCnt);
       
   382 	TheTest.Printf(_L("\"UPDATE\" count: %d\r\n"), updateCnt);
       
   383 	TheTest.Printf(_L("\"SELECT\" count: %d\r\n"), selectCnt);
       
   384 	if(TheCmdLineParams.iLogFileName.Length() > 0)
       
   385 		{
       
   386 		TBuf8<200> buf;
       
   387 		buf.Format(_L8("Total time to process Songs¬%d¬us\r\n"), totalTime);
       
   388 		(void)TheLogFile.Write(buf);
       
   389 		buf.Format(_L8("Transactions count¬%d\r\n"), trnCnt);
       
   390 		(void)TheLogFile.Write(buf);
       
   391 		buf.Format(_L8("\"INSERT\" count¬%d\r\n"), insertCnt);
       
   392 		(void)TheLogFile.Write(buf);
       
   393 		buf.Format(_L8("\"UPDATE\" count¬%d\r\n"), updateCnt);
       
   394 		(void)TheLogFile.Write(buf);
       
   395 		buf.Format(_L8("\"SELECT\" count¬%d\r\n"), selectCnt);
       
   396 		(void)TheLogFile.Write(buf);
       
   397 		}
   370 	TEST2(recordCount, KRecordCount);
   398 	TEST2(recordCount, KRecordCount);
   371 	}
   399 	}
   372 ///////////////////////////////////////////////////////////////////////////////////
   400 ///////////////////////////////////////////////////////////////////////////////////
   373 ///////////////////////////////////////////////////////////////////////////////////
   401 ///////////////////////////////////////////////////////////////////////////////////
   374 
   402