persistentstorage/sql/SRC/Server/SqlSrvMain.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
    23 #include "sqlite3.h"			//sqlite3_enable_shared_cache()
    23 #include "sqlite3.h"			//sqlite3_enable_shared_cache()
    24 #include "SqliteSymbian.h"		//sqlite3SymbianLibInit()
    24 #include "SqliteSymbian.h"		//sqlite3SymbianLibInit()
    25 #include "SqlCompact.h"
    25 #include "SqlCompact.h"
    26 #include "SqlCompactConn.h"
    26 #include "SqlCompactConn.h"
    27 #include "SqlSrvResourceProfiler.h"
    27 #include "SqlSrvResourceProfiler.h"
       
    28 #include "UTraceSql.h"
    28 #ifdef _DEBUG
    29 #ifdef _DEBUG
    29 #include <stdio.h>
    30 #include <stdio.h>
    30 #endif
    31 #endif
    31 #include "OstTraceDefinitions.h"
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 #include "SqlSrvMainTraces.h"
       
    34 #endif
       
    35 #include "SqlTraceDef.h"
       
    36 
    32 
    37 #ifndef SQLSRV_STARTUP_TEST
    33 #ifndef SQLSRV_STARTUP_TEST
    38 static  
    34 static  
    39 #endif
    35 #endif
    40 CSqlServer* TheServer = NULL;//The single CSqlServer instance
    36 CSqlServer* TheServer = NULL;//The single CSqlServer instance
    68 //
    64 //
    69 //The function will panic with panic code 7 in _DEBUG mode if the key part of aLeft or
    65 //The function will panic with panic code 7 in _DEBUG mode if the key part of aLeft or
    70 //aRight argument is NULL.
    66 //aRight argument is NULL.
    71 static TInt Compare(const TSqlSecurityPair& aLeft, const TSqlSecurityPair& aRight)
    67 static TInt Compare(const TSqlSecurityPair& aLeft, const TSqlSecurityPair& aRight)
    72 	{
    68 	{
    73 	__ASSERT_DEBUG(aLeft.iKey != NULL && aRight.iKey != NULL, __SQLPANIC2(ESqlPanicInternalError));
    69 	__SQLASSERT(aLeft.iKey != NULL && aRight.iKey != NULL, ESqlPanicInternalError);
    74 	return ::CompareNoCase8(TPtrC8(aLeft.iKey), TPtrC8(aRight.iKey));
    70 	return ::CompareNoCase8(TPtrC8(aLeft.iKey), TPtrC8(aRight.iKey));
    75 	}
    71 	}
    76 	
    72 	
    77 /**
    73 /**
    78 Returns a reference to the sql server instance.
    74 Returns a reference to the sql server instance.
    83 
    79 
    84 @internalComponent
    80 @internalComponent
    85 */
    81 */
    86 CSqlServer& SqlServer(void)
    82 CSqlServer& SqlServer(void)
    87 	{
    83 	{
    88 	__ASSERT_ALWAYS(TheServer != NULL, __SQLPANIC2(ESqlPanicInvalidObj));		
    84 	__SQLASSERT_ALWAYS(TheServer != NULL, ESqlPanicInvalidObj);		
    89 	return *TheServer;
    85 	return *TheServer;
    90 	}
    86 	}
    91 	
    87 	
    92 /**
    88 /**
    93 Creates new CSqlServer instance.
    89 Creates new CSqlServer instance.
    97 
    93 
    98 @leave KErrNoMemory, an out of memory condition has occured;
    94 @leave KErrNoMemory, an out of memory condition has occured;
    99 */
    95 */
   100 CSqlServer* CSqlServer::NewLC()
    96 CSqlServer* CSqlServer::NewLC()
   101 	{
    97 	{
   102 	SQL_TRACE_INTERNALS(OstTrace0(TRACE_INTERNALS, CSQLSERVER_NEWLC_ENTRY, "Entry;0;CSqlServer::NewLC"));
       
   103 	CSqlServer* self = new (ELeave) CSqlServer;
    98 	CSqlServer* self = new (ELeave) CSqlServer;
   104 	CleanupStack::PushL(self);
    99 	CleanupStack::PushL(self);
   105 	self->ConstructL();
   100 	self->ConstructL();
   106 	SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_NEWLC_EXIT, "Exit;0x%X;CSqlServer::NewLC", (TUint)self));
       
   107 	return self;
   101 	return self;
   108 	}
   102 	}
   109 	
   103 	
   110 /**
   104 /**
   111 Frees owned by CSqlServer memory and other resources.
   105 Frees owned by CSqlServer memory and other resources.
   112 */
   106 */
   113 CSqlServer::~CSqlServer()
   107 CSqlServer::~CSqlServer()
   114 	{
   108 	{
   115 	SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_CSQLSERVER2_ENTRY, "Entry;0x%x;CSqlServer::~CSqlServer", (TUint)this));
       
   116 	delete iCompactor;
   109 	delete iCompactor;
   117 	delete iBackupClient;
   110 	delete iBackupClient;
   118 	iDriveSpaceCol.ResetAndDestroy();
   111 	iDriveSpaceCol.ResetAndDestroy();
   119 	sqlite3_soft_heap_limit(0);//Set to 0 the soft heap limit
   112 	sqlite3_soft_heap_limit(0);//Set to 0 the soft heap limit
   120 	iSecurityMap.Close();
   113 	iSecurityMap.Close();
   122 	iFlatBuf.Close();
   115 	iFlatBuf.Close();
   123 	User::Free(iBuf);
   116 	User::Free(iBuf);
   124 	delete iDbConfigFiles;
   117 	delete iDbConfigFiles;
   125 	sqlite3SymbianLibFinalize();
   118 	sqlite3SymbianLibFinalize();
   126 	TheServer = NULL;
   119 	TheServer = NULL;
   127 	SQL_TRACE_INTERNALS(OstTrace1(TRACE_INTERNALS, CSQLSERVER_CSQLSERVER2_EXIT, "Exit;0x%x;CSqlServer::~CSqlServer", (TUint)this));
   120 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KSqlSrvClose));
       
   121     SQLPROFILER_SERVER_STOP();
   128 	}
   122 	}
   129 
   123 
   130 /**
   124 /**
   131 @param aMinLen Requested minimal byte size of the flat buffer
   125 @param aMinLen Requested minimal byte size of the flat buffer
   132 
   126 
   133 @return A reference to the server's general purpose flat bufer. The buffer cannot keep a state between calls.
   127 @return A reference to the server's general purpose flat bufer. The buffer cannot keep a state between calls.
   134 */
   128 */
   135 RSqlBufFlat& CSqlServer::GetFlatBufL(TInt aMinLen)
   129 RSqlBufFlat& CSqlServer::GetFlatBufL(TInt aMinLen)
   136 	{
   130 	{
   137 	__ASSERT_DEBUG(aMinLen >= 0, __SQLPANIC(ESqlPanicBadArgument));
   131 	__SQLASSERT(aMinLen >= 0, ESqlPanicBadArgument);
   138 	__SQLLEAVE_IF_ERROR(iFlatBuf.ReAlloc(aMinLen));
   132 	__SQLLEAVE_IF_ERROR(iFlatBuf.ReAlloc(aMinLen));
   139 	SQLPROFILER_REPORT_ALLOC(iFlatBuf.MaxSize());
   133 	SQLPROFILER_REPORT_ALLOC(iFlatBuf.MaxSize());
   140 	return iFlatBuf;
   134 	return iFlatBuf;
   141 	}
   135 	}
   142 
   136 
   148 
   142 
   149 @return TDes8 reference to the server's general purpose bufer. The buffer cannot keep a state between calls.
   143 @return TDes8 reference to the server's general purpose bufer. The buffer cannot keep a state between calls.
   150 */
   144 */
   151 TDes8& CSqlServer::GetBuf8L(TInt aMinLen)
   145 TDes8& CSqlServer::GetBuf8L(TInt aMinLen)
   152 	{
   146 	{
   153 	__ASSERT_DEBUG(aMinLen >= 0, __SQLPANIC(ESqlPanicBadArgument));
   147 	__SQLASSERT(aMinLen >= 0, ESqlPanicBadArgument);
   154 #ifdef _DEBUG
   148 #ifdef _DEBUG
   155 	TInt maxBufLen = iBufPtr8.MaxLength();
   149 TInt maxBufLen = iBufPtr8.MaxLength();
   156 	maxBufLen = maxBufLen;
   150 maxBufLen = maxBufLen;
   157 #endif
   151 #endif
   158 	if(iBufPtr8.MaxLength() < aMinLen)
   152 	if(iBufPtr8.MaxLength() < aMinLen)
   159 		{
   153 		{
   160 		__SQLLEAVE_IF_ERROR(ReAllocBuf(aMinLen));
   154 		__SQLLEAVE_IF_ERROR(ReAllocBuf(aMinLen));
   161 		}
   155 		}
   171 
   165 
   172 @return TDes16 reference to the server's general purpose bufer. The buffer cannot keep a state between calls.
   166 @return TDes16 reference to the server's general purpose bufer. The buffer cannot keep a state between calls.
   173 */
   167 */
   174 TDes16& CSqlServer::GetBuf16L(TInt aMinLen)
   168 TDes16& CSqlServer::GetBuf16L(TInt aMinLen)
   175 	{
   169 	{
   176 	__ASSERT_DEBUG(aMinLen >= 0, __SQLPANIC(ESqlPanicBadArgument));
   170 	__SQLASSERT(aMinLen >= 0, ESqlPanicBadArgument);
   177 #ifdef _DEBUG
   171 #ifdef _DEBUG
   178 	TInt maxBufLen = iBufPtr16.MaxLength();
   172 TInt maxBufLen = iBufPtr16.MaxLength();
   179 	maxBufLen = maxBufLen;
   173 maxBufLen = maxBufLen;
   180 #endif
   174 #endif
   181 	if(iBufPtr16.MaxLength() < aMinLen)
   175 	if(iBufPtr16.MaxLength() < aMinLen)
   182 		{
   176 		{
   183 		__SQLLEAVE_IF_ERROR(ReAllocBuf(aMinLen * sizeof(TUint16)));
   177 		__SQLLEAVE_IF_ERROR(ReAllocBuf(aMinLen * sizeof(TUint16)));
   184 		}
   178 		}
   200 	const TInt KBufLimit = 8 * 1024;
   194 	const TInt KBufLimit = 8 * 1024;
   201 #endif
   195 #endif
   202 	if(iBufPtr8.MaxSize() > KBufLimit)
   196 	if(iBufPtr8.MaxSize() > KBufLimit)
   203 		{
   197 		{
   204 		(void)ReAllocBuf(KBufLimit);
   198 		(void)ReAllocBuf(KBufLimit);
   205 		__ASSERT_DEBUG(oldBuf == iBuf, __SQLPANIC(ESqlPanicInternalError));
   199 		__SQLASSERT(oldBuf == iBuf, ESqlPanicInternalError);
   206 		}
   200 		}
   207 	}
   201 	}
   208 
   202 
   209 /**
   203 /**
   210 Reallocates iBuf. iBuf content is not preserved.
   204 Reallocates iBuf. iBuf content is not preserved.
   215 @return KErrNoMemory, an out of memory condition has occurred;
   209 @return KErrNoMemory, an out of memory condition has occurred;
   216 		KErrNone, the operation has completed successfully;
   210 		KErrNone, the operation has completed successfully;
   217 */
   211 */
   218 TInt CSqlServer::ReAllocBuf(TInt aNewBufSize)
   212 TInt CSqlServer::ReAllocBuf(TInt aNewBufSize)
   219 	{
   213 	{
   220 	__ASSERT_DEBUG(aNewBufSize >= 0, __SQLPANIC(ESqlPanicBadArgument));
   214 	__SQLASSERT(aNewBufSize >= 0, ESqlPanicBadArgument);
   221 #ifdef _DEBUG	
   215 #ifdef _DEBUG	
   222 	const TInt KMinBufSize = 8;
   216 	const TInt KMinBufSize = 8;
   223 #else
   217 #else
   224 	const TInt KMinBufSize = 2 * 1024;
   218 	const TInt KMinBufSize = 2 * 1024;
   225 #endif
   219 #endif
   305 	//the SQL server startup code.
   299 	//the SQL server startup code.
   306 	StartL(KSqlSrvName);
   300 	StartL(KSqlSrvName);
   307 #endif	
   301 #endif	
   308     SQLPROFILER_SERVER_START();
   302     SQLPROFILER_SERVER_START();
   309 	//Configure the SQLite library
   303 	//Configure the SQLite library
   310 	TInt sqliteErr = sqlite3_config(SQLITE_CONFIG_LOOKASIDE, KSqliteLookAsideCellSize, KSqliteLookAsideCellCount);
   304 	__SQLLEAVE_IF_ERROR(sqlite3_config(SQLITE_CONFIG_LOOKASIDE, KSqliteLookAsideCellSize, KSqliteLookAsideCellCount));
   311     __SQLLEAVE_IF_ERROR(::Sql2OsErrCode(sqliteErr, KErrArgument));
       
   312 	//Open SQLITE library - this must be the first call after StartL() (os_symbian.cpp, "TheAllocator" initialization rellated).
   305 	//Open SQLITE library - this must be the first call after StartL() (os_symbian.cpp, "TheAllocator" initialization rellated).
   313 	__SQLLEAVE_IF_ERROR(sqlite3SymbianLibInit());
   306 	__SQLLEAVE_IF_ERROR(sqlite3SymbianLibInit());
   314 	//Create buffers
   307 	//Create buffers
   315 	__SQLLEAVE_IF_ERROR(iFlatBuf.SetCount(0));
   308 	__SQLLEAVE_IF_ERROR(iFlatBuf.SetCount(0));
   316 	//Get collation dll name
   309 	//Get collation dll name
   319 	TInt sysDrive = static_cast<TInt>(RFs::GetSystemDrive());
   312 	TInt sysDrive = static_cast<TInt>(RFs::GetSystemDrive());
   320 	//Get the server private data path.
   313 	//Get the server private data path.
   321 	RFs& fs = sqlite3SymbianFs();
   314 	RFs& fs = sqlite3SymbianFs();
   322 	TFileName serverPrivatePath;
   315 	TFileName serverPrivatePath;
   323 	__SQLLEAVE_IF_ERROR(fs.PrivatePath(serverPrivatePath));
   316 	__SQLLEAVE_IF_ERROR(fs.PrivatePath(serverPrivatePath));
       
   317 
   324 	DeleteTempFilesL(sysDrive, serverPrivatePath);
   318 	DeleteTempFilesL(sysDrive, serverPrivatePath);
   325 	//Load config file parameter values (if config file exists) and initialize iFileData.
   319 	//Load config file parameter values (if config file exists) and initialize iFileData.
   326 	TParse parse;
   320 	TParse parse;
   327 	__SQLLEAVE_IF_ERROR(parse.Set(KSqlSrvDefaultConfigFile, &serverPrivatePath, NULL));
   321 	__SQLLEAVE_IF_ERROR(parse.Set(KSqlSrvDefaultConfigFile, &serverPrivatePath, NULL));
   328 	//Store the names of any existing database config files in memory
   322 	//Store the names of any existing database config files in memory
   332 		
   326 		
   333 	//Set the soft heap limit (iFileData.ConfigParams() returns now a reference to the config file params, including the soft heap limit, if set)
   327 	//Set the soft heap limit (iFileData.ConfigParams() returns now a reference to the config file params, including the soft heap limit, if set)
   334 	const TSqlSrvConfigParams& configParams = iFileData.ConfigParams();
   328 	const TSqlSrvConfigParams& configParams = iFileData.ConfigParams();
   335 	if(configParams.iSoftHeapLimitKb > 0)
   329 	if(configParams.iSoftHeapLimitKb > 0)
   336 		{
   330 		{
   337 		__ASSERT_DEBUG(configParams.iSoftHeapLimitKb >= TSqlSrvConfigParams::KMinSoftHeapLimitKb &&
   331 		__SQLASSERT(configParams.iSoftHeapLimitKb >= TSqlSrvConfigParams::KMinSoftHeapLimitKb &&
   338 		            configParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb, __SQLPANIC(ESqlPanicInternalError));
   332 		            configParams.iSoftHeapLimitKb <= TSqlSrvConfigParams::KMaxSoftHeapLimitKb, ESqlPanicInternalError);
   339 		sqlite3_soft_heap_limit(configParams.iSoftHeapLimitKb * 1024);
   333 		sqlite3_soft_heap_limit(configParams.iSoftHeapLimitKb * 1024);
   340 		}
   334 		}
   341 	//Enable shared cache
   335 	//Enable shared cache
   342 	(void)sqlite3SymbianLastOsError();//clear last OS error
   336 	(void)sqlite3SymbianLastOsError();//clear last OS error
   343 	TInt err = sqlite3_enable_shared_cache(static_cast <TInt> (EEnableSharedCache));
   337 	TInt err = sqlite3_enable_shared_cache(static_cast <TInt> (EEnableSharedCache));
   364  	char tmp[32]; 
   358  	char tmp[32]; 
   365  	sprintf(tmp, "%04X", KAnyNumber);
   359  	sprintf(tmp, "%04X", KAnyNumber);
   366     const TInt KGreatSize = 1024; 
   360     const TInt KGreatSize = 1024; 
   367  	__SQLLEAVE_IF_ERROR(ReAllocBuf(KGreatSize));
   361  	__SQLLEAVE_IF_ERROR(ReAllocBuf(KGreatSize));
   368     #endif //SQLSRV_STARTUP_TEST 	
   362     #endif //SQLSRV_STARTUP_TEST 	
   369 #endif //_DEBUG 	
   363 #endif //_DEBUG 
   370 	}
   364 	}
   371 
   365 
   372 /**
   366 /**
   373 Delete any temp files left the "temp" subdirectory in server's private directory.
   367 Delete any temp files left the "temp" subdirectory in server's private directory.
   374 
   368 
   419 		{
   413 		{
   420 		//only get the file name + extension 
   414 		//only get the file name + extension 
   421 		fileName.Set(fname, NULL, NULL);
   415 		fileName.Set(fname, NULL, NULL);
   422 		iCollationDllName = fileName.NameAndExt();
   416 		iCollationDllName = fileName.NameAndExt();
   423 		}
   417 		}
   424 	SQL_TRACE_INTERNALS(OstTraceExt3(TRACE_INTERNALS, CSQLSERVER_GETCOLLATIONDLLNAMEL, "0x%x;CSqlServer::GetCollationDllNameL;iCollationDllName=%S;err=%d", (TUint)this, __SQLPRNSTR(iCollationDllName), err));
       
   425 	}
   418 	}
   426 /**
   419 /**
   427 Finds and caches the name of each database configuration file 
   420 Finds and caches the name of each database configuration file 
   428 that exists in the server's private data cage on the Z: drive
   421 that exists in the server's private data cage on the Z: drive
   429 */
   422 */
   443 			iDbConfigFiles = CDbConfigFiles::NewL(*entryList);
   436 			iDbConfigFiles = CDbConfigFiles::NewL(*entryList);
   444 			}
   437 			}
   445 		}
   438 		}
   446 	else
   439 	else
   447 		{
   440 		{
   448 		SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_CACHEDDBCONFIGFILENAMESL, "0x%X;CSqlServer::CacheDbConfigFileNamesL;GetDir() failed with error code %d", (TUint)this, err));	
   441 		__SQLLOG_ERR(_L("SQLLOG: CSqlServer::CacheDbConfigFileNamesL() - GetDir() failed with error code %d"), err);	
   449 		}
   442 		}
   450 	CleanupStack::PopAndDestroy(); // entryList	
   443 	CleanupStack::PopAndDestroy(); // entryList	
   451 	}
   444 	}
   452 
   445 
   453 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
   446 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
   499 					 Note that the function may leave also with some other database specific or OS specific
   492 					 Note that the function may leave also with some other database specific or OS specific
   500 					 error codes.
   493 					 error codes.
   501 */
   494 */
   502 void CSqlServer::GetBackUpListL(TSecureId aUid, RArray<TParse>& aFileList)
   495 void CSqlServer::GetBackUpListL(TSecureId aUid, RArray<TParse>& aFileList)
   503 	{
   496 	{
   504 	SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_ENTRY, "Entry;0x%x;CSqlServer::GetBackUpListL;aUid=0x%X", (TUint)this, (TUint)aUid.iId));
       
   505 	aFileList.Reset();
   497 	aFileList.Reset();
   506 	TFindFile findFile(iFileData.Fs());
   498 	TFindFile findFile(iFileData.Fs());
   507 	CDir* fileNameCol = NULL;
   499 	CDir* fileNameCol = NULL;
   508 	TUidName uidName = (static_cast <TUid> (aUid)).Name();
   500 	TUidName uidName = (static_cast <TUid> (aUid)).Name();
   509 	TBuf<KMaxUidName + sizeof(KMatchAllDbFiles)> fileNameMask(uidName);
   501 	TBuf<KMaxUidName + sizeof(KMatchAllDbFiles)> fileNameMask(uidName);
   513 	if(err == KErrNone)
   505 	if(err == KErrNone)
   514 		{
   506 		{
   515 		//The first set of files, which name is matching "[aUid]*" pattern, is ready.
   507 		//The first set of files, which name is matching "[aUid]*" pattern, is ready.
   516 		do
   508 		do
   517 			{
   509 			{
   518 			__ASSERT_DEBUG(fileNameCol != NULL, __SQLPANIC(ESqlPanicInternalError));
   510 			__SQLASSERT(fileNameCol != NULL, ESqlPanicInternalError);
   519 			CleanupStack::PushL(fileNameCol);
   511 			CleanupStack::PushL(fileNameCol);
   520 			const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case.
   512 			const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case.
   521 			//Check that the drive, where the database files are, is not ROM drive
   513 			//Check that the drive, where the database files are, is not ROM drive
   522 			TParse parse;
   514 			TParse parse;
   523 			(void)parse.Set(file, NULL, NULL);//this call can't file, the file name comes from findFile call.
   515 			(void)parse.Set(file, NULL, NULL);//this call can't file, the file name comes from findFile call.
   524 			TPtrC driveName = parse.Drive();
   516 			TPtrC driveName = parse.Drive();
   525 			__ASSERT_DEBUG(driveName.Length() > 0, __SQLPANIC(ESqlPanicInternalError));
   517 			__SQLASSERT(driveName.Length() > 0, ESqlPanicInternalError);
   526 			TInt driveNumber = -1;
   518 			TInt driveNumber = -1;
   527 			__SQLLEAVE_IF_ERROR(RFs::CharToDrive(driveName[0], driveNumber));
   519 			__SQLLEAVE_IF_ERROR(RFs::CharToDrive(driveName[0], driveNumber));
   528 			TDriveInfo driveInfo;
   520 			TDriveInfo driveInfo;
   529 			__SQLLEAVE_IF_ERROR(iFileData.Fs().Drive(driveInfo, static_cast <TDriveNumber> (driveNumber)));
   521 			__SQLLEAVE_IF_ERROR(iFileData.Fs().Drive(driveInfo, static_cast <TDriveNumber> (driveNumber)));
   530 			//If current drive is not ROM drive then process the files
   522 			//If current drive is not ROM drive then process the files
   536 					{
   528 					{
   537 					const ::TEntry& entry = (*fileNameCol)[i];
   529 					const ::TEntry& entry = (*fileNameCol)[i];
   538 					if(!entry.IsDir())
   530 					if(!entry.IsDir())
   539 						{
   531 						{
   540 						(void)parse.Set(entry.iName, &file, NULL);//"parse" variable now contains the full file path
   532 						(void)parse.Set(entry.iName, &file, NULL);//"parse" variable now contains the full file path
   541 						__SQLTRACE_INTERNALSVAR(TPtrC fname = parse.FullName());
       
   542 						SQL_TRACE_INTERNALS(OstTraceExt2(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL, "0x%x;CSqlServer::GetBackUpListL;fname=%S", (TUint)this, __SQLPRNSTR(fname)));
       
   543 						__SQLLEAVE_IF_ERROR(aFileList.Append(parse));
   533 						__SQLLEAVE_IF_ERROR(aFileList.Append(parse));
   544 						}
   534 						}
   545 					}
   535 					}
   546 				}
   536 				}
   547 			CleanupStack::PopAndDestroy(fileNameCol);
   537 			CleanupStack::PopAndDestroy(fileNameCol);
   548 			fileNameCol = NULL;
   538 			fileNameCol = NULL;
   549 			} while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files
   539 			} while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files
   550 		}//end of "if(err == KErrNone)"
   540 		}//end of "if(err == KErrNone)"
   551 	__ASSERT_DEBUG(!fileNameCol, __SQLPANIC(ESqlPanicInternalError));
   541 	__SQLASSERT(!fileNameCol, ESqlPanicInternalError);
   552 	if(err != KErrNotFound && err != KErrNone)
   542 	if(err != KErrNotFound && err != KErrNone)
   553 		{
   543 		{
   554 		__SQLLEAVE(err);
   544 		__SQLLEAVE(err);
   555 		}
   545 		}
   556 	SQL_TRACE_INTERNALS(OstTraceExt3(TRACE_INTERNALS, CSQLSERVER_GETBACKUPLISTL_EXIT, "Exit;0x%x;CSqlServer::GetBackUpListL;file count=%d;err=%d", (TUint)this, aFileList.Count(), err));
       
   557 	}
   546 	}
   558 
   547 
   559 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
   548 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
   560 ////////////////////////////////////////   SQL server startup   //////////////////////////////////////////////
   549 ////////////////////////////////////////   SQL server startup   //////////////////////////////////////////////
   561 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
   550 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
   570 
   559 
   571 	// create and install the active scheduler we need
   560 	// create and install the active scheduler we need
   572 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
   561 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
   573 	CleanupStack::PushL(scheduler);
   562 	CleanupStack::PushL(scheduler);
   574 	CActiveScheduler::Install(scheduler);
   563 	CActiveScheduler::Install(scheduler);
       
   564 	SYMBIAN_TRACE_SQL_EVENTS_ONLY(UTF::Printf(UTF::TTraceContext(UTF::EInternals), KSqlSrvStart));
   575 	TheServer = CSqlServer::NewLC();
   565 	TheServer = CSqlServer::NewLC();
   576 	RProcess::Rendezvous(KErrNone);
   566 	RProcess::Rendezvous(KErrNone);
   577 	CActiveScheduler::Start();
   567 	CActiveScheduler::Start();
   578 
   568 
   579 	CleanupStack::PopAndDestroy(2, scheduler);//CSqlServer, scheduler
   569 	CleanupStack::PopAndDestroy(2, scheduler);//CSqlServer, scheduler