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.
28 // classes used in this header
32 // classes defined in this header
43 enum TDbPosition { EDbFirst=RDbRowSet::EFirst,EDbNext=RDbRowSet::ENext,EDbPrevious=RDbRowSet::EPrevious,EDbLast=RDbRowSet::ELast };
48 const TUint32 KDbNullRecordIdValue=0;
56 inline TDbRecordId(TUint32 aValue);
57 inline TDbRecordId& operator=(TUint32 aValue);
59 inline TBool operator==(TDbRecordId anId) const;
60 inline TBool operator!=(TDbRecordId anId) const;
62 inline TUint32 Value() const;
66 #if defined(__NO_CLASS_CONSTS__)
70 #define KDbNullRecordId TDbRecordId(KDbNullRecordIdValue)
75 const TDbRecordId KDbNullRecordId=TDbRecordId(KDbNullRecordIdValue);
78 class CDbRecordBase : public CBase
84 enum {EOpen=0x1,EModified=0x2,EBroken=0x4};
89 IMPORT_C void FlushL();
90 inline void Abandon();
91 inline TBool IsBroken() const;
93 static void DoFlushL(CDbRecordBase* aRec);
94 static void DoDelete(CDbRecordBase* aRec);
95 static void DoAbandon(CDbRecordBase* aRec);
97 IMPORT_C void TouchL();
98 inline void MarkIntact();
100 IMPORT_C TBool DoRestoreL();
101 IMPORT_C virtual TBool RestoreL();
102 IMPORT_C virtual void AboutToModifyL();
103 IMPORT_C virtual void SynchL();
108 class CDbRecordIter : public CBase
114 enum TDeleted {EAtRow,ENoRow,ENotSupported};
116 IMPORT_C CDbRecordIter(CDbRecordBase& aHost);
118 IMPORT_C ~CDbRecordIter();
119 inline CDbRecordBase& Host() const;
121 virtual TInt Count() const =0;
122 virtual TDbRecordId CurrentL() =0;
123 virtual TBool GotoL(TDbPosition aPosition) =0;
124 virtual TBool GotoL(TDbRecordId aRecordId,RDbTableRow& aBuffer) =0; // re-synchronise
125 virtual TBool SeekL(const TDbLookupKey& aKey,RDbTable::TComparison aComparison) =0;
126 inline TDeleted DeletedL(TDbPosition aPosition,TDbRecordId aRecordId); // goto next id
127 inline TDeleted DeletedL(TDbPosition aPosition,TDbRecordId aRecordId,const RDbTableRow& aRow); // goto next id
129 virtual TDeleted DoDeletedL(TDbPosition aPosition,TDbRecordId aRecordId,const RDbTableRow* aRow) =0;
131 CDbRecordBase& iHost;
134 class CDbRecordSpace : public CDbRecordBase
142 virtual TBool ExistsL(TDbRecordId aRecordId) =0;
143 virtual TPtrC8 ReadL(TDbRecordId aRecordId) const =0;
144 TUint8* ReplaceL(TDbRecordId aRecordId,TInt aRecordSize);
145 virtual TUint AutoIncrementL() =0;
146 TUint8* NewL(TInt aRecordSize);
147 virtual TDbRecordId AppendL() =0;
148 void EraseL(TDbRecordId aRecordId);
149 virtual CDbRecordIter* IteratorL() =0;
151 virtual TUint8* DoReplaceL(TDbRecordId aRecordId,TInt aRecordSize) =0;
152 virtual TUint8* DoNewL(TInt aRecordSize) =0;
153 virtual void DoEraseL(TDbRecordId aRecordId) =0;
156 class CDbBlobSpace : public CDbRecordBase
164 virtual MStreamBuf* ReadL(TDbBlobId aBlobId,TDbColType aType) const =0;
165 IMPORT_C MStreamBuf* ReadLC(TDbBlobId aBlobId,TDbColType aType) const;
166 IMPORT_C MStreamBuf* CreateL(TDbBlobId &aBlobId,TDbColType aType);
167 IMPORT_C TDbBlobId CreateL(TDbColType aType,const TAny* aBuf,TInt aLength);
168 IMPORT_C void DeleteL(TDbBlobId aBlobId);
169 IMPORT_C TInt Delete(TDbBlobId aBlobId);
170 inline TInt InlineLimit() const;
172 inline void SetInlineLimit(TInt anInlineLimit);
174 virtual MStreamBuf* DoCreateL(TDbBlobId &aBlobId,TDbColType aType) =0;
175 virtual void DoDeleteL(TDbBlobId aBlobId) =0;
180 class CDbRecordIndex : public CDbRecordBase
186 enum TFind {ENoMatch,EKeyMatch,EEntryMatch};
187 enum TInclusion {EIncludeLower=0x1,EIncludeUpper=0x2,EIncludeBoth=0x3};
191 virtual TFind FindL(TDbRecordId aRecordId,const RDbTableRow& aRow) =0;
192 TBool InsertL(TDbRecordId aRecordId,const RDbTableRow& aRow);
193 void DeleteL(TDbRecordId aRecordId,const RDbTableRow& aRow);
194 virtual CDbRecordIter* IteratorL(TUint aInclusion=0,const TDbLookupKey* aLowerBound=0,const TDbLookupKey* aUpperBound=0) =0;
196 virtual TBool DoInsertL(TDbRecordId aRecordId,const RDbTableRow& aRow) =0;
197 virtual void DoDeleteL(TDbRecordId aRecordId,const RDbTableRow& aRow) =0;
200 #include "D32REC.INL"