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