persistentstorage/store/UFILE/UF_STOR.CPP
changeset 51 7d4490026038
parent 0 08ec8eefde2f
equal deleted inserted replaced
40:b8bdbc8f59c7 51:7d4490026038
    25 EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode)
    25 EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode)
    26 /** Opens a file containing a store and constructs an appropriate file store object.
    26 /** Opens a file containing a store and constructs an appropriate file store object.
    27 
    27 
    28 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
    28 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
    29 or CPermanentFileStore. The specific type is determined from the layout information 
    29 or CPermanentFileStore. The specific type is determined from the layout information 
    30 held in the file store.
    30 held in the file store. Note that if the store object is CPermanentFileStore and the file is writable,
       
    31 it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that
       
    32 when the file server write caching is enabled, the order of file write operations is not guaranteed. 
       
    33 This could cause data inconsistency in some circumstances, for example, when the power  is lost in
       
    34  the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity.
       
    35 
    31 
    36 
    32 @param aFs Handle to a file server session.
    37 @param aFs Handle to a file server session.
    33 @param aName The full path name of the file containing the store.
    38 @param aName The full path name of the file containing the store.
    34 @param aFileMode The mode in which the file is to be accessed. The mode is 
    39 @param aFileMode The mode in which the file is to be accessed. The mode is 
    35 defined by the TFileMode type.
    40 defined by the TFileMode type.
    44 /** Opens a file containing a store, constructs an appropriate file store object 
    49 /** Opens a file containing a store, constructs an appropriate file store object 
    45 and places the pointer onto the cleanup stack.
    50 and places the pointer onto the cleanup stack.
    46 
    51 
    47 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
    52 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
    48 or CPermanentFileStore. The specific type is determined from the layout information 
    53 or CPermanentFileStore. The specific type is determined from the layout information 
    49 held in the file store.
    54 held in the file store. Note that if the store object is CPermanentFileStore and the file is writable,
       
    55 it is strongly recommended to set EFileWriteDirectIO bit when opening the file. This is because that
       
    56 when the file server write caching is enabled, the order of file write operations is not guaranteed. 
       
    57 This could cause data inconsistency in some circumstances, for example, when the power  is lost in
       
    58  the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity.
       
    59 
    50 
    60 
    51 @param aFs Handle to a file server session. 
    61 @param aFs Handle to a file server session. 
    52 @param aName The full path name of the file containing the store. 
    62 @param aName The full path name of the file containing the store. 
    53 @param aFileMode The mode in which the file is to be accessed. The mode is 
    63 @param aFileMode The mode in which the file is to be accessed. The mode is 
    54 defined by the TFileMode type. 
    64 defined by the TFileMode type. 
    96 @see CFileStore::Layout() */
   106 @see CFileStore::Layout() */
    97 	{
   107 	{
    98 	return FromLC(aFile,KDefaultFileStoreFactory);
   108 	return FromLC(aFile,KDefaultFileStoreFactory);
    99 	}
   109 	}
   100 
   110 
       
   111 /** Opens a file containing a store and constructs an appropriate file store object.
       
   112 
       
   113 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
       
   114 or CPermanentFileStore. The specific type is determined from the layout information 
       
   115 held in the file store. Note that if the store object is CPermanentFileStore and the file is writable,
       
   116 it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that
       
   117 when the file server write caching is enabled, the order of file write operations is not guaranteed. 
       
   118 This could cause data inconsistency in some circumstances, for example, when the power  is lost in
       
   119 the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity.
       
   120 
       
   121 
       
   122 @param aFs Handle to a file server session.
       
   123 @param aName The full path name of the file containing the store.
       
   124 @param aFileMode The mode in which the file is to be accessed. The mode is 
       
   125 defined by the TFileMode type.
       
   126 @param TFileStoreFactoryFunction An array of  file store factory function.
       
   127 @return A pointer to the new file store object. 
       
   128 @see TFileMode
       
   129 @see TFileStoreFactoryFunction
       
   130 */
   101 EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[])
   131 EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[])
   102 //
   132 //
   103 // Open a file store of any of the types supported by aFactory.
   133 // Open a file store of any of the types supported by aFactory.
   104 //
   134 //
   105 	{
   135 	{
   106 	RFile file;
   136 	RFile file;
   107 	__LEAVE_IF_ERROR(file.Open(aFs,aName,aFileMode));
   137 	__LEAVE_IF_ERROR(file.Open(aFs,aName,aFileMode));
   108 	return FromL(file,aFactory);
   138 	return FromL(file,aFactory);
   109 	}
   139 	}
   110 
   140 
       
   141 /** Opens a file containing a store and constructs an appropriate file store object.
       
   142 
       
   143 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
       
   144 or CPermanentFileStore. The specific type is determined from the layout information 
       
   145 held in the file store. Note that if the store object is CPermanentFileStore and the file is writable,
       
   146 it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that
       
   147 when the file server write caching is enabled, the order of file write operations is not guaranteed. 
       
   148 This could cause data inconsistency in some circumstances, for example, when the power  is lost in
       
   149 the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity.
       
   150 
       
   151 
       
   152 @param aFs Handle to a file server session.
       
   153 @param aName The full path name of the file containing the store.
       
   154 @param aFileMode The mode in which the file is to be accessed. The mode is 
       
   155 defined by the TFileMode type.
       
   156 @param TFileStoreFactoryFunction An array of file store factory function.
       
   157 @return A pointer to the new file store object. 
       
   158 @see TFileMode
       
   159 @see TFileStoreFactoryFunction
       
   160 */
   111 EXPORT_C CFileStore* CFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[])
   161 EXPORT_C CFileStore* CFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,const TFileStoreFactoryFunction aFactory[])
   112 //
   162 //
   113 // Open and leave on cleanup stack.
   163 // Open and leave on cleanup stack.
   114 //
   164 //
   115 	{
   165 	{
   208 	{
   258 	{
   209 	Destruct();
   259 	Destruct();
   210 	iBuf.Close();
   260 	iBuf.Close();
   211 	}
   261 	}
   212 
   262 
       
   263 /** Opens a file containing a store and constructs an appropriate file store object.
       
   264 
       
   265 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
       
   266 or CPermanentFileStore. The specific type is determined from the layout information 
       
   267 held in the file store. Note that if the store object is CPermanentFileStore and the file is writable,
       
   268 it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that
       
   269 when the file server write caching is enabled, the order of file write operations is not guaranteed. 
       
   270 This could cause data inconsistency in some circumstances, for example, when the power  is lost in
       
   271 the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity.
       
   272 
       
   273 
       
   274 @param aFs Handle to a file server session.
       
   275 @param aName The full path name of the file containing the store.
       
   276 @param aFileMode The mode in which the file is to be accessed. The mode is 
       
   277 defined by the TFileMode type.
       
   278 @param TFileStoreFactoryFunction A file store factory function.
       
   279 @return A pointer to the new file store object. 
       
   280 @see TFileMode
       
   281 @see TFileStoreFactoryFunction
       
   282 */
   213 EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction)
   283 EXPORT_C CFileStore* CFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction)
   214 //
   284 //
   215 // Open a file store using aFunction.
   285 // Open a file store using aFunction.
   216 //
   286 //
   217 	{
   287 	{
   218 	RFile file;
   288 	RFile file;
   219 	__LEAVE_IF_ERROR(file.Open(aFs,aName,aFileMode));
   289 	__LEAVE_IF_ERROR(file.Open(aFs,aName,aFileMode));
   220 	return FromL(file,aFunction);
   290 	return FromL(file,aFunction);
   221 	}
   291 	}
   222 
   292 
       
   293 /** Opens a file containing a store and constructs an appropriate file store object.
       
   294 
       
   295 The resulting file store object is of concrete type, i.e. either CDirectFileStore 
       
   296 or CPermanentFileStore. The specific type is determined from the layout information 
       
   297 held in the file store. Note that if the store object is CPermanentFileStore and the file is writable,
       
   298 it is strongly recommended to set EFileWriteDirectIO bit in aFileMode. This is because that
       
   299 when the file server write caching is enabled, the order of file write operations is not guaranteed. 
       
   300 This could cause data inconsistency in some circumstances, for example, when the power  is lost in
       
   301 the middle of database transaction. Therefore, the file write caching should be switched off to maintain integrity.
       
   302 
       
   303 
       
   304 @param aFs Handle to a file server session.
       
   305 @param aName The full path name of the file containing the store.
       
   306 @param aFileMode The mode in which the file is to be accessed. The mode is 
       
   307 defined by the TFileMode type.
       
   308 @param TFileStoreFactoryFunction A file store factory function.
       
   309 @return A pointer to the new file store object. 
       
   310 @see TFileMode
       
   311 @see TFileStoreFactoryFunction
       
   312 */
   223 EXPORT_C CFileStore* CFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction)
   313 EXPORT_C CFileStore* CFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode,TFileStoreFactoryFunction aFunction)
   224 //
   314 //
   225 // Open and leave on cleanup stack.
   315 // Open and leave on cleanup stack.
   226 //
   316 //
   227 	{
   317 	{