Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 // Class CDbRecordBase
20 EXPORT_C TBool CDbRecordBase::DoRestoreL()
22 // If we haven't been opened, then try to restore the state
25 TBool broken=RestoreL();
26 iFlags|=broken ? EBroken : EOpen;
30 EXPORT_C void CDbRecordBase::TouchL()
32 // if we are not modified then mark
33 // Can touch a broken object, will not invoke AboutToModifyL()
36 __ASSERT(iFlags&(EOpen|EBroken));
37 if (!(iFlags&EModified))
39 if (!(iFlags&EBroken))
45 EXPORT_C void CDbRecordBase::FlushL()
47 // If we are open, modified and not broken then flush
48 // Must allow un-opened Flush during framework cleanup on failed open
51 if (iFlags==(EOpen|EModified))
58 void CDbRecordBase::DoAbandon(CDbRecordBase* aRec)
63 void CDbRecordBase::DoFlushL(CDbRecordBase* aRec)
68 void CDbRecordBase::DoDelete(CDbRecordBase* aRec)
73 EXPORT_C TBool CDbRecordBase::RestoreL()
75 // default to do nothing
81 EXPORT_C void CDbRecordBase::AboutToModifyL()
83 // default to do nothing
87 EXPORT_C void CDbRecordBase::SynchL()
89 // default to do nothing
94 // Class CDbRecordIter
96 EXPORT_C CDbRecordIter::CDbRecordIter(CDbRecordBase& aHost)
100 EXPORT_C CDbRecordIter::~CDbRecordIter()
104 // Class CDbRecordSpace
106 TUint8* CDbRecordSpace::ReplaceL(TDbRecordId aRecordId,TInt aRecordSize)
108 __ASSERT(!IsBroken());
110 return DoReplaceL(aRecordId,aRecordSize);
113 TUint8* CDbRecordSpace::NewL(TInt aRecordSize)
115 __ASSERT(!IsBroken());
117 return DoNewL(aRecordSize);
120 void CDbRecordSpace::EraseL(TDbRecordId aRecordId)
122 __ASSERT(!IsBroken());
127 // Class CDbBlobSpace
129 EXPORT_C MStreamBuf* CDbBlobSpace::ReadLC(TDbBlobId aBlobId,TDbColType aType) const
131 MStreamBuf* buf=ReadL(aBlobId,aType);
136 EXPORT_C MStreamBuf* CDbBlobSpace::CreateL(TDbBlobId &aBlobId,TDbColType aType)
138 __ASSERT(!IsBroken());
140 return DoCreateL(aBlobId,aType);
143 EXPORT_C TDbBlobId CDbBlobSpace::CreateL(TDbColType aType,const TAny* aData,TInt aLength)
145 // Create a blob containing the data buffer
149 MStreamBuf* buf=CreateL(id,aType);
151 buf->WriteL(aData,aLength);
153 CleanupStack::PopAndDestroy();
157 EXPORT_C void CDbBlobSpace::DeleteL(TDbBlobId aBlobId)
159 if (aBlobId!=KDbNullBlobId)
161 __ASSERT(!IsBroken());
167 EXPORT_C TInt CDbBlobSpace::Delete(TDbBlobId aBlobId)
169 TRAPD(r,DeleteL(aBlobId));
173 // Class CDbRecordIndex
175 TBool CDbRecordIndex::InsertL(TDbRecordId aRecordId,const RDbTableRow& aRow)
177 __ASSERT(!IsBroken());
179 return DoInsertL(aRecordId,aRow);
182 void CDbRecordIndex::DeleteL(TDbRecordId aRecordId,const RDbTableRow& aRow)
184 __ASSERT(!IsBroken());
186 DoDeleteL(aRecordId,aRow);