diff -r 28839de615b4 -r 26645d81f48d persistentstorage/sql/SRC/Server/SqlSrvMain.cpp --- a/persistentstorage/sql/SRC/Server/SqlSrvMain.cpp Thu Aug 19 11:36:21 2010 +0300 +++ b/persistentstorage/sql/SRC/Server/SqlSrvMain.cpp Tue Aug 31 16:57:14 2010 +0300 @@ -25,10 +25,14 @@ #include "SqlCompact.h" #include "SqlCompactConn.h" #include "SqlSrvResourceProfiler.h" -#include "UTraceSql.h" #ifdef _DEBUG #include #endif +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "SqlSrvMainTraces.h" +#endif +#include "SqlTraceDef.h" #ifndef SQLSRV_STARTUP_TEST static @@ -66,7 +70,7 @@ //aRight argument is NULL. static TInt Compare(const TSqlSecurityPair& aLeft, const TSqlSecurityPair& aRight) { - __SQLASSERT(aLeft.iKey != NULL && aRight.iKey != NULL, ESqlPanicInternalError); + __ASSERT_DEBUG(aLeft.iKey != NULL && aRight.iKey != NULL, __SQLPANIC2(ESqlPanicInternalError)); return ::CompareNoCase8(TPtrC8(aLeft.iKey), TPtrC8(aRight.iKey)); } @@ -81,7 +85,7 @@ */ CSqlServer& SqlServer(void) { - __SQLASSERT_ALWAYS(TheServer != NULL, ESqlPanicInvalidObj); + __ASSERT_ALWAYS(TheServer != NULL, __SQLPANIC2(ESqlPanicInvalidObj)); return *TheServer; } @@ -95,9 +99,11 @@ */ CSqlServer* CSqlServer::NewLC() { + SQL_TRACE_INTERNALS(OstTrace0(TRACE_INTERNALS, CSQLSERVER_NEWLC_ENTRY, "Entry;0;CSqlServer::NewLC")); CSqlServer* self = new (ELeave) CSqlServer; CleanupStack::PushL(self); self->ConstructL(); + SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_NEWLC_EXIT, "Exit;0x%X;CSqlServer::NewLC", (TUint)self)); return self; } @@ -106,6 +112,7 @@ */ CSqlServer::~CSqlServer() { + SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_CSQLSERVER2_ENTRY, "Entry;0x%x;CSqlServer::~CSqlServer", (TUint)this)); delete iCompactor; delete iBackupClient; iDriveSpaceCol.ResetAndDestroy(); @@ -117,8 +124,7 @@ delete iDbConfigFiles; sqlite3SymbianLibFinalize(); TheServer = NULL; - SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KSqlSrvClose)); - SQLPROFILER_SERVER_STOP(); + SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_CSQLSERVER2_EXIT, "Exit;0x%x;CSqlServer::~CSqlServer", (TUint)this)); } /** @@ -128,7 +134,7 @@ */ RSqlBufFlat& CSqlServer::GetFlatBufL(TInt aMinLen) { - __SQLASSERT(aMinLen >= 0, ESqlPanicBadArgument); + __ASSERT_DEBUG(aMinLen >= 0, __SQLPANIC(ESqlPanicBadArgument)); __SQLLEAVE_IF_ERROR(iFlatBuf.ReAlloc(aMinLen)); SQLPROFILER_REPORT_ALLOC(iFlatBuf.MaxSize()); return iFlatBuf; @@ -144,10 +150,10 @@ */ TDes8& CSqlServer::GetBuf8L(TInt aMinLen) { - __SQLASSERT(aMinLen >= 0, ESqlPanicBadArgument); + __ASSERT_DEBUG(aMinLen >= 0, __SQLPANIC(ESqlPanicBadArgument)); #ifdef _DEBUG -TInt maxBufLen = iBufPtr8.MaxLength(); -maxBufLen = maxBufLen; + TInt maxBufLen = iBufPtr8.MaxLength(); + maxBufLen = maxBufLen; #endif if(iBufPtr8.MaxLength() < aMinLen) { @@ -167,10 +173,10 @@ */ TDes16& CSqlServer::GetBuf16L(TInt aMinLen) { - __SQLASSERT(aMinLen >= 0, ESqlPanicBadArgument); + __ASSERT_DEBUG(aMinLen >= 0, __SQLPANIC(ESqlPanicBadArgument)); #ifdef _DEBUG -TInt maxBufLen = iBufPtr16.MaxLength(); -maxBufLen = maxBufLen; + TInt maxBufLen = iBufPtr16.MaxLength(); + maxBufLen = maxBufLen; #endif if(iBufPtr16.MaxLength() < aMinLen) { @@ -196,7 +202,7 @@ if(iBufPtr8.MaxSize() > KBufLimit) { (void)ReAllocBuf(KBufLimit); - __SQLASSERT(oldBuf == iBuf, ESqlPanicInternalError); + __ASSERT_DEBUG(oldBuf == iBuf, __SQLPANIC(ESqlPanicInternalError)); } } @@ -211,7 +217,7 @@ */ TInt CSqlServer::ReAllocBuf(TInt aNewBufSize) { - __SQLASSERT(aNewBufSize >= 0, ESqlPanicBadArgument); + __ASSERT_DEBUG(aNewBufSize >= 0, __SQLPANIC(ESqlPanicBadArgument)); #ifdef _DEBUG const TInt KMinBufSize = 8; #else @@ -301,7 +307,8 @@ #endif SQLPROFILER_SERVER_START(); //Configure the SQLite library - __SQLLEAVE_IF_ERROR(sqlite3_config(SQLITE_CONFIG_LOOKASIDE, KSqliteLookAsideCellSize, KSqliteLookAsideCellCount)); + TInt sqliteErr = sqlite3_config(SQLITE_CONFIG_LOOKASIDE, KSqliteLookAsideCellSize, KSqliteLookAsideCellCount); + __SQLLEAVE_IF_ERROR(::Sql2OsErrCode(sqliteErr, KErrArgument)); //Open SQLITE library - this must be the first call after StartL() (os_symbian.cpp, "TheAllocator" initialization rellated). __SQLLEAVE_IF_ERROR(sqlite3SymbianLibInit()); //Create buffers @@ -314,7 +321,6 @@ RFs& fs = sqlite3SymbianFs(); TFileName serverPrivatePath; __SQLLEAVE_IF_ERROR(fs.PrivatePath(serverPrivatePath)); - DeleteTempFilesL(sysDrive, serverPrivatePath); //Load config file parameter values (if config file exists) and initialize iFileData. TParse parse; @@ -328,8 +334,8 @@ const TSqlSrvConfigParams& configParams = iFileData.ConfigParams(); if(configParams.iSoftHeapLimitKb > 0) { - __SQLASSERT(configParams.iSoftHeapLimitKb >= TSqlSrvConfigParams::KMinSoftHeapLimitKb && - configParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb, ESqlPanicInternalError); + __ASSERT_DEBUG(configParams.iSoftHeapLimitKb >= TSqlSrvConfigParams::KMinSoftHeapLimitKb && + configParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb, __SQLPANIC(ESqlPanicInternalError)); sqlite3_soft_heap_limit(configParams.iSoftHeapLimitKb * 1024); } //Enable shared cache @@ -360,7 +366,7 @@ const TInt KGreatSize = 1024; __SQLLEAVE_IF_ERROR(ReAllocBuf(KGreatSize)); #endif //SQLSRV_STARTUP_TEST -#endif //_DEBUG +#endif //_DEBUG } /** @@ -415,6 +421,7 @@ fileName.Set(fname, NULL, NULL); iCollationDllName = fileName.NameAndExt(); } + SQL_TRACE_INTERNALS(OstTraceExt3(TRACE_INTERNALS, CSQLSERVER_GETCOLLATIONDLLNAMEL, "0x%x;CSqlServer::GetCollationDllNameL;iCollationDllName=%S;err=%d", (TUint)this, __SQLPRNSTR(iCollationDllName), err)); } /** Finds and caches the name of each database configuration file @@ -438,7 +445,7 @@ } else { - __SQLLOG_ERR(_L("SQLLOG: CSqlServer::CacheDbConfigFileNamesL() - GetDir() failed with error code %d"), err); + SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_CACHEDDBCONFIGFILENAMESL, "0x%X;CSqlServer::CacheDbConfigFileNamesL;GetDir() failed with error code %d", (TUint)this, err)); } CleanupStack::PopAndDestroy(); // entryList } @@ -494,6 +501,7 @@ */ void CSqlServer::GetBackUpListL(TSecureId aUid, RArray& aFileList) { + SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_ENTRY, "Entry;0x%x;CSqlServer::GetBackUpListL;aUid=0x%X", (TUint)this, (TUint)aUid.iId)); aFileList.Reset(); TFindFile findFile(iFileData.Fs()); CDir* fileNameCol = NULL; @@ -507,14 +515,14 @@ //The first set of files, which name is matching "[aUid]*" pattern, is ready. do { - __SQLASSERT(fileNameCol != NULL, ESqlPanicInternalError); + __ASSERT_DEBUG(fileNameCol != NULL, __SQLPANIC(ESqlPanicInternalError)); CleanupStack::PushL(fileNameCol); const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case. //Check that the drive, where the database files are, is not ROM drive TParse parse; (void)parse.Set(file, NULL, NULL);//this call can't file, the file name comes from findFile call. TPtrC driveName = parse.Drive(); - __SQLASSERT(driveName.Length() > 0, ESqlPanicInternalError); + __ASSERT_DEBUG(driveName.Length() > 0, __SQLPANIC(ESqlPanicInternalError)); TInt driveNumber = -1; __SQLLEAVE_IF_ERROR(RFs::CharToDrive(driveName[0], driveNumber)); TDriveInfo driveInfo; @@ -530,6 +538,8 @@ if(!entry.IsDir()) { (void)parse.Set(entry.iName, &file, NULL);//"parse" variable now contains the full file path + __SQLTRACE_INTERNALSVAR(TPtrC fname = parse.FullName()); + SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL, "0x%x;CSqlServer::GetBackUpListL;fname=%S", (TUint)this, __SQLPRNSTR(fname))); __SQLLEAVE_IF_ERROR(aFileList.Append(parse)); } } @@ -538,11 +548,12 @@ fileNameCol = NULL; } while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files }//end of "if(err == KErrNone)" - __SQLASSERT(!fileNameCol, ESqlPanicInternalError); + __ASSERT_DEBUG(!fileNameCol, __SQLPANIC(ESqlPanicInternalError)); if(err != KErrNotFound && err != KErrNone) { __SQLLEAVE(err); } + SQL_TRACE_INTERNALS(OstTraceExt3(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_EXIT, "Exit;0x%x;CSqlServer::GetBackUpListL;file count=%d;err=%d", (TUint)this, aFileList.Count(), err)); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -561,7 +572,6 @@ CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); - SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KSqlSrvStart)); TheServer = CSqlServer::NewLC(); RProcess::Rendezvous(KErrNone); CActiveScheduler::Start();