persistentstorage/sql/SRC/Server/SqlSrvFileData.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
child 11 211563e4b919
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   194 */
   194 */
   195 void TSqlSrvFileData::SetL(const RMessage2& aMessage, TInt aFileNameLen, TInt aFileNameArgNum, const TDesC8* aConfigStr)
   195 void TSqlSrvFileData::SetL(const RMessage2& aMessage, TInt aFileNameLen, TInt aFileNameArgNum, const TDesC8* aConfigStr)
   196 	{
   196 	{
   197 	__SQLASSERT((TUint)aFileNameArgNum < KMaxMessageArguments, ESqlPanicBadArgument);
   197 	__SQLASSERT((TUint)aFileNameArgNum < KMaxMessageArguments, ESqlPanicBadArgument);
   198 	__SQLASSERT(iSysDrivePrivatePath.DriveAndPath().Length() > 0, ESqlPanicInternalError);
   198 	__SQLASSERT(iSysDrivePrivatePath.DriveAndPath().Length() > 0, ESqlPanicInternalError);
   199 	
   199 		
   200 	if(aFileNameLen < 1 || aFileNameLen > KMaxFileName)
   200 	if(aFileNameLen < 1 || aFileNameLen > KMaxFileName)
   201 		{
   201 		{
   202 		__SQLLEAVE(KErrBadName);
   202 		__SQLLEAVE(KErrBadName);
   203 		}
   203 		}
       
   204 #ifdef SQLSRV_STARTUP_TEST
       
   205 	aMessage.Int0();//prevents compiler warning
       
   206 	aFileNameArgNum = aFileNameArgNum;//prevents compiler warning
       
   207 	iFileName.Copy(*(const TDesC*)aConfigStr);
       
   208 #else
   204 	aMessage.ReadL(aFileNameArgNum, iFileName);
   209 	aMessage.ReadL(aFileNameArgNum, iFileName);
       
   210 #endif	
   205 	SQLPROFILER_REPORT_IPC(ESqlIpcRead, (aFileNameLen * sizeof(TText)));
   211 	SQLPROFILER_REPORT_IPC(ESqlIpcRead, (aFileNameLen * sizeof(TText)));
   206 	TParse parsedFileName;
   212 	TParse parsedFileName;
   207 	__SQLLEAVE_IF_ERROR(parsedFileName.Set(iFileName, 0, 0));//prophylactic check, leave if the file name cannot be parsed
   213 	__SQLLEAVE_IF_ERROR(parsedFileName.Set(iFileName, 0, 0));//prophylactic check, leave if the file name cannot be parsed
   208 	::GetFileNamePropertiesL(iFileName, iSysDrivePrivatePath.Path(), iIsSecureFileNameFmt, iSecureUid);
   214 	::GetFileNamePropertiesL(iFileName, iSysDrivePrivatePath.Path(), iIsSecureFileNameFmt, iSecureUid);
   209 	::DoFullFileNameL(iFileName, iSysDrivePrivatePath.DriveAndPath(), iDrive);
   215 	::DoFullFileNameL(iFileName, iSysDrivePrivatePath.DriveAndPath(), iDrive);
   215 			__SQLLEAVE(KErrArgument);	
   221 			__SQLLEAVE(KErrArgument);	
   216 			}
   222 			}
   217 		::CreatePrivateDataPathL(iFs, iDrive);
   223 		::CreatePrivateDataPathL(iFs, iDrive);
   218 		}
   224 		}
   219 	iReadOnly = ::IsReadOnlyFileL(iFs, FileName());
   225 	iReadOnly = ::IsReadOnlyFileL(iFs, FileName());
       
   226 #ifndef SQLSRV_STARTUP_TEST
   220 	::ExtractConfigParamsL(aConfigStr, iConfigParams, iConfig);
   227 	::ExtractConfigParamsL(aConfigStr, iConfigParams, iConfig);
       
   228 #endif	
   221 	}
   229 	}
   222 
   230 
   223 /**
   231 /**
   224 1. Initializes iFileName with the database file name.
   232 1. Initializes iFileName with the database file name.
   225 2. Initializes iDrive.
   233 2. Initializes iDrive.