/** @SYMTestCaseID PDS-SQL-UT-4152 @SYMTestCaseDesc Test for DEF142305 - RSqlDatabase::Attach does not use cache_size configuration parameters. The test verifies that when a database is attached, the attached database cache size will be set based on the page size, soft heap limit and default cache size. @SYMTestPriority High @SYMTestActions Test for DEF142305 - RSqlDatabase::Attach does not use cache_size configuration parameters. @SYMTestExpectedResults The test must not fail. @SYMDEF INC106788 */ void DEF142305() { _LIT8(KConfig, "cache_size=500"); //Create main db TInt err = TheDb.Create(KTestDbName, &KConfig); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, 500, KDefaultPageSize, KDefaultEncoding); TheDb.Close(); //Create non-secure db that will be attached err = TheDb.Create(KTestDbName2, &KConfig); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, 500, KDefaultPageSize, KDefaultEncoding); TheDb.Close(); //Create private db that will be attached _LIT8(KConfig2, "page_size=2048"); err = TheDb.Create(KTestDbName4, &KConfig2); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, (TSqlSrvConfigParams::KDefaultSoftHeapLimitKb * 1024) / 2048, 2048, KDefaultEncoding);//2048? - see KConfig2 string TheDb.Close(); _LIT(KAttachDbName, "Attached"); //Attach non-secure db err = TheDb.Open(KTestDbName, &KConfig); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, 500, KDefaultPageSize, KDefaultEncoding); err = TheDb.Attach(KTestDbName2, KAttachDbName); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, KDefaultCacheSize, KDefaultPageSize, KDefaultEncoding, KAttachDbName); err = TheDb.Detach(KAttachDbName); TEST2(err, KErrNone); TheDb.Close(); //Attach private db err = TheDb.Open(KTestDbName, &KConfig); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, 500, KDefaultPageSize, KDefaultEncoding); err = TheDb.Attach(KTestDbName4, KAttachDbName); TEST2(err, KErrNone); AssertConfigPrmValues(TheDb, (TSqlSrvConfigParams::KDefaultSoftHeapLimitKb * 1024) / 2048, 2048, KDefaultEncoding, KAttachDbName);//2048? - see KConfig2 string err = TheDb.Detach(KAttachDbName); TEST2(err, KErrNone); TheDb.Close(); (void)RSqlDatabase::Delete(KTestDbName4); (void)RSqlDatabase::Delete(KTestDbName2); (void)RSqlDatabase::Delete(KTestDbName); }
/** @SYMTestCaseID SYSLIB-SQL-UT-4063 @SYMTestCaseDesc Compaction configuration test - attached database. The test creates a database with an auto compaction mode. Then the test attaches the same database. The test verifies that the compaction mode of the main and the attached database is the same - auto. @SYMTestPriority Medium @SYMTestActions Compaction configuration test - attached database. @SYMTestExpectedResults Test must not fail @SYMREQ REQ10273 REQ10274 REQ10400 */ void CompactConfigTest8L() { //Create a test database with "auto" compaction mode _LIT8(KConfigStr1, "; ;; ; compaction = auto; "); TInt err = TheDb.Create(KTestDbName1, &KConfigStr1); TEST2(err, KErrNone); //Attach a database err = TheDb.Attach(KTestDbName1, _L("db2")); TEST2(err, KErrNone); //Check compact for both main and attached database TSqlScalarFullSelectQuery scalarQuery(TheDb); TInt compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); TEST2(compact, KAutoVacuum); compact = scalarQuery.SelectIntL(_L("PRAGMA db2.auto_vacuum")); TEST2(compact, KAutoVacuum); //Detach err = TheDb.Detach(_L("db2")); TEST2(err, KErrNone); //Check compact again compact = scalarQuery.SelectIntL(_L("PRAGMA auto_vacuum")); TEST2(compact, KAutoVacuum); // TheDb.Close(); err = RSqlDatabase::Delete(KTestDbName1); TEST2(err, KErrNone); }
/** @SYMTestCaseID SYSLIB-SQL-CT-1643 @SYMTestCaseDesc SQL server private path in database file name test. Verify that SQL API returns appropriate error, if an attempt is made to create, open or delete a secure database, with the full path specified in the database file name. @SYMTestPriority High @SYMTestActions SQL server private path in database file name test. @SYMTestExpectedResults Test must not fail @SYMREQ REQ5792 REQ5793 */ void PrivatePathTest() { RSqlSecurityPolicy securityPolicy; CreateTestSecurityPolicy(securityPolicy); RSqlDatabase db; TInt err = db.Create(_L("C:\\PrIVATE\\10281E17\\[98765432]A.DB"), securityPolicy); TEST2(err, KErrArgument); err = db.Create(_L("C:\\PRIVATE\\10281E17\\[98765432]A.DB")); TEST2(err, KErrArgument); err = db.Open(_L("C:\\PRIVATE\\10281E17\\[98765432]A.DB")); TEST2(err, KErrArgument); err = db.Open(_L("C:\\PRIvaTe\\10281E17\\[98765432]A.DB")); TEST2(err, KErrArgument); err = db.Create(KTestDbName2); TEST2(err, KErrNone); err = db.Attach(_L("C:\\PRIVATe\\10281E17\\[98765432]A.DB"), _L("Db")); TEST2(err, KErrArgument); err = db.Attach(_L("C:\\PRIVAtE\\10281E17\\[98765432]A.DB"), _L("Db")); TEST2(err, KErrArgument); //This is an attempt to attach a database from the application's private data cage err = db.Attach(KTestDbName4, _L("Db")); TEST2(err, KErrNotFound);//There is no "Db" database file in the application's private data cage db.Close(); err = RSqlDatabase::Delete(_L("C:\\pRIVATE\\10281E17\\[98765432]A.DB")); TEST2(err, KErrArgument); err = RSqlDatabase::Delete(_L("C:\\PRIvATE\\10281E17\\[98765432]A.DB")); TEST2(err, KErrArgument); //This is an attempt to create a database in the application's private data cage err = db.Create(KTestDbName4); TEST2(err, KErrNone); db.Close(); err = RSqlDatabase::Delete(KTestDbName4); TEST2(err, KErrNone); err = db.Create(KTestDbName5); TEST2(err, KErrArgument); securityPolicy.Close(); }