persistentstorage/sql/TEST/t_sqldefect2.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
   375 	TInt tmpFileCount2 = TempFilesCount();
   375 	TInt tmpFileCount2 = TempFilesCount();
   376 	TEST(tmpFileCount2 > tmpFileCount);
   376 	TEST(tmpFileCount2 > tmpFileCount);
   377     //
   377     //
   378     TheDb1.Close();
   378     TheDb1.Close();
   379     err = RSqlDatabase::Delete(KTestDatabase1);
   379     err = RSqlDatabase::Delete(KTestDatabase1);
   380     TEST2(err, KErrNone);
   380     TEST2(err, KErrNone);    
   381 	}
   381 	}
       
   382 
       
   383 /**
       
   384 @SYMTestCaseID          PDS-SQL-CT-4214
       
   385 @SYMTestCaseDesc        Test for the change "After *#7370# Java apps are not preinstalled again" 
       
   386 @SYMTestPriority        High
       
   387 @SYMTestActions         The test makes sure there are no issues if the temp folder is removed after the server 
       
   388                         has already started. The test performs the following actions - 
       
   389                         1. Delete the 'temp' directory.
       
   390                         2. Create a transaction which creates temp files.
       
   391                         3. Check 'temp' folder exists at the end
       
   392 @SYMTestExpectedResults Test must not fail
       
   393 */
       
   394 void DeleteTempFolder()
       
   395     {
       
   396     //1. Delete 'temp' folder
       
   397     TInt err = TheFs.RmDir(KServerTempDir);
       
   398     TEST2(err, KErrNone);
       
   399 	
       
   400     //2. Create a transaction which creates temp files.
       
   401     (void)RSqlDatabase::Delete(KTestDatabase1);
       
   402     err = TheDb1.Create(KTestDatabase1);
       
   403     TEST2(err, KErrNone);
       
   404     
       
   405     err = TheDb1.Exec(_L("CREATE TABLE t1(x UNIQUE); INSERT INTO t1 VALUES(1)"));
       
   406     TEST(err >= 0);
       
   407     err = TheDb1.Exec(_L("BEGIN; UPDATE t1 SET x = 2; UPDATE t1 SET x = 3; COMMIT"));
       
   408     TEST(err >= 0);
       
   409     
       
   410     TheDb1.Close();
       
   411     err = RSqlDatabase::Delete(KTestDatabase1);
       
   412     TEST2(err, KErrNone);
       
   413     
       
   414     //3. Check 'temp' folder exists
       
   415     err = TheFs.MkDir(KServerTempDir);
       
   416     TEST2(err, KErrAlreadyExists);
       
   417     }
   382 
   418 
   383 /**
   419 /**
   384 @SYMTestCaseID          PDS-SQL-CT-4213
   420 @SYMTestCaseID          PDS-SQL-CT-4213
   385 @SYMTestCaseDesc        Tests the ability of the SQL server to store empty strings and retrieve them as 
   421 @SYMTestCaseDesc        Tests the ability of the SQL server to store empty strings and retrieve them as 
   386 						text column values, not NULLs.
   422 						text column values, not NULLs.
   465 	    err = RSqlDatabase::Delete(KTestDatabase1);
   501 	    err = RSqlDatabase::Delete(KTestDatabase1);
   466 	    TEST2(err, KErrNone);
   502 	    TEST2(err, KErrNone);
   467 		}
   503 		}
   468 	}
   504 	}
   469 
   505 
   470 /**
       
   471 @SYMTestCaseID          PDS-SQL-CT-4214
       
   472 @SYMTestCaseDesc        Test for the change "After *#7370# Java apps are not preinstalled again" 
       
   473 @SYMTestPriority        High
       
   474 @SYMTestActions         The test makes sure there are no issues if the temp folder is removed after the server 
       
   475                         has already started. The test performs the following actions - 
       
   476                         1. Delete the 'temp' directory.
       
   477                         2. Create a transaction which creates temp files.
       
   478                         3. Check 'temp' folder exists at the end
       
   479 @SYMTestExpectedResults Test must not fail
       
   480 */
       
   481 void DeleteTempFolder()
       
   482     {
       
   483     //1. Delete 'temp' folder
       
   484     TInt err = TheFs.RmDir(KServerTempDir);
       
   485     TEST2(err, KErrNone);
       
   486 	
       
   487     //2. Create a transaction which creates temp files.
       
   488     (void)RSqlDatabase::Delete(KTestDatabase1);
       
   489     err = TheDb1.Create(KTestDatabase1);
       
   490     TEST2(err, KErrNone);
       
   491     
       
   492     err = TheDb1.Exec(_L("CREATE TABLE t1(x UNIQUE); INSERT INTO t1 VALUES(1)"));
       
   493     TEST(err >= 0);
       
   494     err = TheDb1.Exec(_L("BEGIN; UPDATE t1 SET x = 2; UPDATE t1 SET x = 3; COMMIT"));
       
   495     TEST(err >= 0);
       
   496     
       
   497     TheDb1.Close();
       
   498     err = RSqlDatabase::Delete(KTestDatabase1);
       
   499     TEST2(err, KErrNone);
       
   500     
       
   501     //3. Check 'temp' folder exists
       
   502     err = TheFs.MkDir(KServerTempDir);
       
   503     TEST2(err, KErrAlreadyExists);
       
   504     }	
       
   505 	
       
   506 void DoTestsL()
   506 void DoTestsL()
   507 	{
   507 	{
   508 	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4154 DEF143062: SQL, \"CREATE INDEX\" sql crashes SQL server"));
   508 	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4154 DEF143062: SQL, \"CREATE INDEX\" sql crashes SQL server"));
   509 	DEF143062();
   509 	DEF143062();
   510 
   510 
   512     DEF143061();
   512     DEF143061();
   513 
   513 
   514     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4156 DEF143150: SQL, strftime() returns incorrect result"));
   514     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4156 DEF143150: SQL, strftime() returns incorrect result"));
   515     DEF143150();
   515     DEF143150();
   516     
   516     
   517     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4210 Temp files created during sql operations are not deleted after rebooting the phone - 1"));
   517     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4210 Temp files created during sql operations are not deleted after rebooting the phone - 1"));
   518     DeleteTempFile();
   518     DeleteTempFile();
   519     
   519     
   520     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4211 Temp files created during sql operations are not deleted after rebooting the phone - 2"));
   520     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4211 Temp files created during sql operations are not deleted after rebooting the phone - 2"));
   521     TempFileTest();
   521     TempFileTest();
   522     
   522     
   523     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4213 No support to store an empty string in symbian's sqlite."));
   523     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4213 No support to store an empty string in symbian's sqlite."));
   524     EmptyTextColumnTest();
   524     EmptyTextColumnTest();
   525 	
   525 
   526 	TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4214 After *#7370# Java apps are not preinstalled again"));
   526     TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-4214 After *#7370# Java apps are not preinstalled again"));
   527     DeleteTempFolder();
   527     DeleteTempFolder();
   528 	}
   528 	}
   529 
   529 
   530 TInt E32Main()
   530 TInt E32Main()
   531 	{
   531 	{