persistentstorage/sql/TEST/t_sqlsecurity3.cpp
changeset 55 44f437012c90
parent 15 3eacc0623088
equal deleted inserted replaced
51:7d4490026038 55:44f437012c90
    65 void Check1(TInt aValue, TInt aLine)
    65 void Check1(TInt aValue, TInt aLine)
    66 	{
    66 	{
    67 	if(!aValue)
    67 	if(!aValue)
    68 		{
    68 		{
    69 		RestoreOriginalDb();
    69 		RestoreOriginalDb();
    70 		RDebug::Print(_L("*** Line %d\r\n"), aLine);
    70 		TheTest.Printf(_L("*** Line %d. Expression evaluated to false\r\n"), aLine);
    71 		TheTest(EFalse, aLine);
    71 		TheTest(EFalse, aLine);
    72 		}
    72 		}
    73 	}
    73 	}
    74 void Check2(TInt aValue, TInt aExpected, TInt aLine)
    74 void Check2(TInt aValue, TInt aExpected, TInt aLine)
    75 	{
    75 	{
    76 	if(aValue != aExpected)
    76 	if(aValue != aExpected)
    77 		{
    77 		{
    78 		RestoreOriginalDb();
    78 		RestoreOriginalDb();
    79 		RDebug::Print(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
    79 		TheTest.Printf(_L("*** Line %d, Expected error: %d, got: %d\r\n"), aLine, aExpected, aValue);
    80 		TheTest(EFalse, aLine);
    80 		TheTest(EFalse, aLine);
    81 		}
    81 		}
    82 	}
    82 	}
    83 #define TEST(arg) ::Check1((arg), __LINE__)
    83 #define TEST(arg) ::Check1((arg), __LINE__)
    84 #define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
    84 #define TEST2(aValue, aExpected) ::Check2(aValue, aExpected, __LINE__)
   147 	err = stmt.Next();
   147 	err = stmt.Next();
   148 	TEST2(err, KSqlAtRow);
   148 	TEST2(err, KSqlAtRow);
   149 	TPtrC p;
   149 	TPtrC p;
   150 	err = stmt.ColumnText(0, p);
   150 	err = stmt.ColumnText(0, p);
   151 	TEST2(err, KErrNone);
   151 	TEST2(err, KErrNone);
   152 	RDebug::Print(_L("Value=%S\r\n"), &p);
   152 	TheTest.Printf(_L("Value=%S\r\n"), &p);
   153 	stmt.Close();
   153 	stmt.Close();
   154 	
   154 	
   155 	TheDb.Close();
   155 	TheDb.Close();
   156 	}
   156 	}
   157 	
   157