equal
deleted
inserted
replaced
152 TInt64 seed; |
152 TInt64 seed; |
153 const TUidType type(KPermanentFileStoreLayoutUid,KUidDictionaryFile,aFileId); |
153 const TUidType type(KPermanentFileStoreLayoutUid,KUidDictionaryFile,aFileId); |
154 for (TInt wait=KLockoutLimit;;) |
154 for (TInt wait=KLockoutLimit;;) |
155 { |
155 { |
156 RFile file; |
156 RFile file; |
157 TInt r=file.Open(aFs,aName,EFileShareExclusive|EFileWrite); |
157 // When the file server write caching is enabled, the order of file write operations is not guaranteed. |
|
158 // This could cause data inconsistency in some circumstances,for example, when the power is lost in the |
|
159 // middle of a database transaction.Therefore, the file write caching is disabled for this file to maintain integrity. |
|
160 |
|
161 TInt r=file.Open(aFs,aName,EFileShareExclusive|EFileWrite|EFileWriteDirectIO); |
158 switch (r) |
162 switch (r) |
159 { |
163 { |
160 case KErrNone: |
164 case KErrNone: |
161 { |
165 { |
162 TInt size; |
166 TInt size; |
174 r=KErrCorrupt; |
178 r=KErrCorrupt; |
175 } |
179 } |
176 if (r==KErrCorrupt) |
180 if (r==KErrCorrupt) |
177 { |
181 { |
178 // silently replace the entire file if it is corrupt |
182 // silently replace the entire file if it is corrupt |
179 r=file.Replace(aFs,aName,EFileShareExclusive|EFileWrite); |
183 // When the file server write caching is enabled, the order of file write operations is not guaranteed. |
|
184 // This could cause data inconsistency in some circumstances,for example, when the power is lost in the |
|
185 // middle of a database transaction.Therefore, the file write caching is disabled for this file to maintain integrity. |
|
186 |
|
187 r=file.Replace(aFs,aName,EFileShareExclusive|EFileWrite|EFileWriteDirectIO); |
180 if (r==KErrInUse) |
188 if (r==KErrInUse) |
181 break; // try again later... |
189 break; // try again later... |
182 if (r==KErrNone) |
190 if (r==KErrNone) |
183 { |
191 { |
184 CreateStoreL(file,type); |
192 CreateStoreL(file,type); |
195 else |
203 else |
196 CreateStoreL(file,type); |
204 CreateStoreL(file,type); |
197 return; |
205 return; |
198 } |
206 } |
199 case KErrNotFound: |
207 case KErrNotFound: |
200 r=file.Create(aFs,aName,EFileShareExclusive|EFileWrite); |
208 // When the file server write caching is enabled, the order of file write operations is not guaranteed. |
|
209 // This could cause data inconsistency in some circumstances,for example, when the power is lost in the |
|
210 // middle of a database transaction.Therefore, the file write caching is disabled for this file to maintain integrity. |
|
211 |
|
212 r=file.Create(aFs,aName,EFileShareExclusive|EFileWrite|EFileWriteDirectIO); |
201 if (r==KErrNone) |
213 if (r==KErrNone) |
202 { |
214 { |
203 CreateStoreL(file,type); |
215 CreateStoreL(file,type); |
204 return; |
216 return; |
205 } |
217 } |