persistentstorage/sql/TEST/t_sqldefect.cpp
branchRCL_3
changeset 11 211563e4b919
parent 8 fa9941cf3867
child 12 6b6fd149daa2
equal deleted inserted replaced
10:31a8f755b7fe 11:211563e4b919
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
       
    12 // NTT DOCOMO, INC - Fix for Bug 1915 "SQL server panics when using long column type strings"
    12 //
    13 //
    13 // Description:
    14 // Description:
    14 //
    15 //
    15 
    16 
    16 #include <e32test.h>
    17 #include <e32test.h>
  1630     err = TheDb.Open(KTestDatabase7);
  1631     err = TheDb.Open(KTestDatabase7);
  1631     TEST2(err, KErrNone);
  1632     TEST2(err, KErrNone);
  1632     TheDb.Close();
  1633     TheDb.Close();
  1633     }
  1634     }
  1634 
  1635 
       
  1636 /**
       
  1637 Test defect where calling RSQLStatement::DeclaredColumnType() on a table which contains long (> 20 characters) column type 
       
  1638 names results in a USER 11 panic.
       
  1639 This test should pass because these are valid SQL column types 
       
  1640 */
       
  1641 void LongColumnTypeTest()
       
  1642 	{
       
  1643 	(void)RSqlDatabase::Delete(KTestDatabase3);
       
  1644 	TInt err = TheDb.Create(KTestDatabase3);
       
  1645 	TEST2(err, KErrNone);
       
  1646 	
       
  1647 	_LIT8(KCreateStmt, "CREATE TABLE t(a CHARACTER VARYING(100000), b NCHAR VARYING(100000), c NATIONAL CHARACTER(100000), d NATIONAL CHARACTER VARYING(100000))");
       
  1648 	err = TheDb.Exec(KCreateStmt);
       
  1649 	TEST(err >= 0);
       
  1650 	
       
  1651 	//Select all columns (SELECT *)
       
  1652 	_LIT(KSelectStmt, "SELECT * FROM t");
       
  1653 	RSqlStatement stmt;
       
  1654 	err = stmt.Prepare(TheDb, KSelectStmt);
       
  1655 	TEST2(err, KErrNone);
       
  1656 	
       
  1657 	TSqlColumnType colType;
       
  1658 	err = stmt.DeclaredColumnType(0, colType);
       
  1659 	TEST2(err,KErrNone);
       
  1660 	TEST2(colType, ESqlText);
       
  1661 	
       
  1662 	err = stmt.DeclaredColumnType(1, colType);
       
  1663 	TEST2(err,KErrNone);
       
  1664 	TEST2(colType, ESqlText);
       
  1665 	
       
  1666 	err = stmt.DeclaredColumnType(2, colType);
       
  1667 	TEST2(err,KErrNone);
       
  1668 	TEST2(colType, ESqlText);
       
  1669 	
       
  1670 	err = stmt.DeclaredColumnType(3, colType);
       
  1671 	TEST2(err,KErrNone);
       
  1672 	TEST2(colType, ESqlText);
       
  1673 	
       
  1674 	stmt.Close();
       
  1675 
       
  1676 	TheDb.Close();
       
  1677 	(void)RSqlDatabase::Delete(KTestDatabase3); 
       
  1678 	}
       
  1679 
  1635 void DoTestsL()
  1680 void DoTestsL()
  1636 	{
  1681 	{
  1637 	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1763 \"SQL against a detached db\" test "));
  1682 	TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-SQL-CT-1763 \"SQL against a detached db\" test "));
  1638 	SqlDetachedDbTest();	
  1683 	SqlDetachedDbTest();	
  1639 
  1684 
  1640 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4034 Corrupted db file (file length too short)"));
  1685 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4034 Corrupted db file (file length too short)"));
  1641 	CorruptDbFileTest();	
  1686 	CorruptDbFileTest();	
  1642 	
  1687 	
  1643 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4035 Attempt to attach a file which name cannot be parsed"));
  1688 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4035 Attempt to attach a file which name cannot be parsed"));
  1644 	AttachBadDbFileNameTest();	
  1689 	AttachBadDbFileNameTest();	
  1645 	
  1690 
  1646 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4036 Attempt to attach a secure database. The client cannot pass the security checks"));
  1691 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4036 Attempt to attach a secure database. The client cannot pass the security checks"));
  1647 	AttachSecureDbTest();	
  1692 	AttachSecureDbTest();	
  1648 
  1693 
  1649 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4032 INC091579 - SQL Panic 7 when streaming BLOB fields"));
  1694 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SQL-UT-4032 INC091579 - SQL Panic 7 when streaming BLOB fields"));
  1650 	INC091579L();
  1695 	INC091579L();
  1715     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4157 PDEF143461 : CSqlSrvDatabase::LastErrorMessage() alignment problem"));
  1760     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4157 PDEF143461 : CSqlSrvDatabase::LastErrorMessage() alignment problem"));
  1716     PDEF143461L();
  1761     PDEF143461L();
  1717     
  1762     
  1718     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4166 DEF144027: SQL Open returns error if the reported and actual file size are different"));
  1763     TheTest.Next(_L(" @SYMTestCaseID:PDS-SQL-CT-4166 DEF144027: SQL Open returns error if the reported and actual file size are different"));
  1719     DEF144027();
  1764     DEF144027();
       
  1765     
       
  1766     TheTest.Next(_L("RSQLStatement::DeclaredColumnType() causes USER 11 panic when table contains long column type strings"));
       
  1767     LongColumnTypeTest();
       
  1768  
  1720 	}
  1769 	}
  1721 
  1770 
  1722 TInt E32Main()
  1771 TInt E32Main()
  1723 	{
  1772 	{
  1724 	TheTest.Title();
  1773 	TheTest.Title();