equal
deleted
inserted
replaced
96 switch (aMode) |
96 switch (aMode) |
97 { |
97 { |
98 default: |
98 default: |
99 __LEAVE(KErrNotSupported); |
99 __LEAVE(KErrNotSupported); |
100 case TDbFormat::ECreate: |
100 case TDbFormat::ECreate: |
101 store=CPermanentFileStore::CreateL(iFs,aName,EFileRead|EFileWrite); |
101 // When the file cache in file server is on, the order of file writing is not guaranteed which could cause data inconsistency in some circumstances, for example, when the power is lost in the middle of data transaction. Therefore, the file write cache is switched off here to maintain the file integrity . |
|
102 store=CPermanentFileStore::CreateL(iFs,aName,EFileRead|EFileWrite/EFileWriteDirectIO); |
102 break; |
103 break; |
103 case TDbFormat::EReplace: |
104 case TDbFormat::EReplace: |
104 store=CPermanentFileStore::ReplaceL(iFs,aName,EFileRead|EFileWrite); |
105 // When the file cache in file server is on, the order of file writing is not guaranteed which could cause data inconsistency in some circumstances, for example, when the power is lost in the middle of data transaction. Therefore, the file write cache is switched off here to maintain the file integrity . |
|
106 store=CPermanentFileStore::ReplaceL(iFs,aName,EFileRead|EFileWrite/EFileWriteDirectIO); |
105 break; |
107 break; |
106 }; |
108 }; |
107 iStore=store; |
109 iStore=store; |
108 iDelete=ETrue; // cleanup fully in case of failure |
110 iDelete=ETrue; // cleanup fully in case of failure |
109 store->SetTypeL(aType); |
111 store->SetTypeL(aType); |
141 EXPORT_C void CDbFileStoreDatabase::OpenL(const TDesC& aName,TDbFormat::TOpen aMode) |
143 EXPORT_C void CDbFileStoreDatabase::OpenL(const TDesC& aName,TDbFormat::TOpen aMode) |
142 { |
144 { |
143 __ASSERT(!iName); // check construction phase |
145 __ASSERT(!iName); // check construction phase |
144 // |
146 // |
145 iName=aName.AllocL(); |
147 iName=aName.AllocL(); |
146 const TUint mode=aMode==TDbFormat::EReadOnly ? EFileShareReadersOnly : EFileWrite; |
148 TUint mode=aMode==TDbFormat::EReadOnly ? EFileShareReadersOnly : EFileWrite; |
|
149 // When the file cache in file server is on, the order of file writing is not guaranteed which could cause data inconsistency in some circumstances, for example, when the power is lost in the middle of data transaction. Therefore, the file write cache is switched off here to maintain the file integrity . |
|
150 mode = mode|EFileWriteDirectIO; |
147 CFileStore* store=CPermanentFileStore::OpenL(iFs,*iName,mode); |
151 CFileStore* store=CPermanentFileStore::OpenL(iFs,*iName,mode); |
148 iStore=store; |
152 iStore=store; |
149 CDbStoreDatabase::RestoreL(DatabaseIdL(store->Root())); |
153 CDbStoreDatabase::RestoreL(DatabaseIdL(store->Root())); |
150 } |
154 } |
151 |
155 |