diff -r 3da531bb4329 -r 28839de615b4 persistentstorage/sql/SRC/Server/SqlSrvDatabase.cpp --- a/persistentstorage/sql/SRC/Server/SqlSrvDatabase.cpp Mon Jun 21 17:37:53 2010 +0300 +++ b/persistentstorage/sql/SRC/Server/SqlSrvDatabase.cpp Thu Aug 19 11:36:21 2010 +0300 @@ -66,6 +66,7 @@ _LIT(KAutoVacuumPragma, "PRAGMA \"%S\".auto_vacuum=%d\x0"); //_LIT(KPersist, "persist"); //_LIT(KPersistentJournalPragma, "PRAGMA \"%S\".journal_mode=%S\x0"); +_LIT(KJournalSizeLimitPragma, "PRAGMA \"%S\".journal_size_limit=%d\x0"); //////////////////////////////////////////////////////// //"LIKE" - user defined function name _LIT8(KStrLikeFuncName, "LIKE\x0"); @@ -232,6 +233,24 @@ return err; } +//The journal size limit is set to be at lest 16 pages and no less than 64 Kb. +static void SetJournalSizeLimitL(sqlite3* aDbHandle, TBool& aAuthorizerDisabled, TInt aPageSize, const TDesC& aDbName = KMainDb16) + { + __SQLASSERT(aDbHandle != NULL, ESqlPanicBadArgument); + if(aPageSize == TSqlSrvConfigParams::KConfigPrmValueNotSet) + { + __SQLLEAVE_IF_ERROR(DbPageSize(aDbHandle, aDbName, aPageSize)); + } + const TInt KPageMultiplier = 16; + const TInt KDefaultJournalSizeLimit = 64 * 1024; + const TInt KMaxJournalSizeLimit = 512 * 1024; + const TInt KJournalSizeLimit = Min((aPageSize * KPageMultiplier), KMaxJournalSizeLimit); + if(KJournalSizeLimit > KDefaultJournalSizeLimit) + { + __SQLLEAVE_IF_ERROR(::ExecPragma(aDbHandle, aAuthorizerDisabled, KJournalSizeLimitPragma, KJournalSizeLimit)); + } + } + ////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// CSqlSrvDatabase class ///////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1251,6 +1270,8 @@ } const TDesC& logicalDbName = aLogicalDbName.Length() > 0 ? aLogicalDbName : KMainDb16; + + ::SetJournalSizeLimitL(iDbHandle, iAuthorizerDisabled, aConfigParams.iPageSize, logicalDbName); //Setting the cache size. //Step 1: Check if aConfigParams.iCacheSize value is set. If it is set, then use it.