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.
16 #include "D32Assert.h"
19 inline RDbIndexes::RDbIndexes()
20 : iRep(_FOFF(CDbTableIndexDef,iLink))
23 inline HDbColumnSet::TIterator HDbColumnSet::ColumnL(const TDesC& aColumn)
24 {return CONST_CAST(TIterator,((const HDbColumnSet*)this)->ColumnL(aColumn));}
26 // Class RDbTableSchema
27 inline RDbTableSchema::RDbTableSchema()
28 : iRep(_FOFF(CDbTableDef,iLink))
30 inline void RDbTableSchema::Close()
32 inline TBool RDbTableSchema::IsLoaded() const
34 inline void RDbTableSchema::Remove(CDbTableDef* aDef)
38 inline void CDbTable::Discard()
39 {__ASSERT(iRef==ECached);Release();}
40 inline TBool CDbTable::IsIdle() const
42 inline TBool CDbTable::InUse() const
44 inline RDbCache& CDbTable::Cache()
45 {return Database().iCache;}
47 // Class CDbTable::TValid
48 inline CDbTable& CDbTable::TValid::Table() const
50 inline CDbTable::TValid::operator TAny*() const
51 {return Table().iDatabase;}
52 inline RDbTransaction& CDbTable::TValid::Transaction() const
53 {return Table().Database().Transaction();}
56 inline RDbTables::RDbTables()
57 : iRep(_FOFF(CDbTable,iLink))
59 inline TBool RDbTables::IsEmpty() const
60 {return iRep.IsEmpty();}
61 inline void RDbTables::Add(CDbTable& aTable)
62 {iRep.AddLast(aTable);}
63 inline void RDbTables::Remove(CDbTable& aTable)
64 {iRep.Remove(aTable);}
65 inline RDbTables::operator TSglQueBase&()
68 // Class RDbTransaction
69 inline RDbTransaction::RDbTransaction()
72 __ASSERT(iDatabase==0);
73 __ASSERT(iAction==EDbReadLock);
74 __ASSERT(iLockState==EDbReadLock);
75 __ASSERT(iSharers==0);
76 __ASSERT(iLockCount==0);
77 __ASSERT(iUpdaters==0);
78 __ASSERT(iNotifier==0);
80 inline void RDbTransaction::Open(CDbTableDatabase& aDatabase)
81 {__ASSERT(!iDatabase);iDatabase=&aDatabase;}
82 inline const TDbGeneration& RDbTransaction::RollbackGeneration() const
84 inline TBool RDbTransaction::IsLocked() const
85 {return iLockCount>0;}
86 inline CDbTableDatabase& RDbTransaction::Database()
87 {__ASSERT(iDatabase);return *iDatabase;}
88 inline void RDbTransaction::ReadyL() const
89 {if (iLockState&EFailed) __LEAVE(KErrDied);}
91 // Class CDbTableDatabase
92 inline void CDbTableDatabase::Open()
94 inline void CDbTableDatabase::AddTable(CDbTable& aTable)
95 {iTables.Add(aTable);}
97 // Class CDbTableSource
98 inline void CDbTableSource::SetIterator(CDbRecordIter* anIter)
100 inline CDbTable& CDbTableSource::Table()
101 {return iRow.Table();}
102 inline const RDbTableRow& CDbTableSource::Row()
105 // Class CDbDataStage
106 inline void CDbDataStage::SetSource(CDbDataSource* aSource)
107 {__ASSERT(!iSource);iSource=aSource;}
108 inline CDbDataSource& CDbDataStage::Source()
110 inline const CDbDataSource& CDbDataStage::Source() const
113 // Class CDbRestrictStage
114 inline void CDbRestrictStage::SetRestriction(CSqlSearchCondition* aRestriction)
115 {__ASSERT(!iRestriction);iRestriction=aRestriction;}
116 inline CSqlSearchCondition& CDbRestrictStage::Restriction() const
117 {__ASSERT(iRestriction);return *iRestriction;}
119 // Class RDbAccessPlan
120 inline RDbAccessPlan::RDbAccessPlan(CSqlQuery* aQuery,TDbTextComparison aComparison)
121 :iPlans(EGranularity),iComparison(aComparison),iQuery(aQuery)
122 {__DEBUG(iSource=NULL;iTable=NULL;)}
123 inline RDbAccessPlan::RDbAccessPlan()
124 :iPlans(EGranularity),iComparison(EDbCompareNormal)
125 {__DEBUG(iSource=NULL;iTable=NULL;)}
126 inline CDbTable& RDbAccessPlan::Table()
127 {__ASSERT(iTable);return *iTable;}
128 inline CDbDataSource& RDbAccessPlan::Source()
129 {__ASSERT(iSource);return *iSource;}
130 inline CDbDataSource* RDbAccessPlan::Adopt()
131 {__ASSERT(iSource);CDbDataSource* s=iSource;iSource=NULL;return s;}
133 // Class RDbAccessPlan::TPlan
134 inline RDbAccessPlan::TPlan::TPlan()
135 :iFlags(0),iLower(0),iUpper(0)
137 inline TBool RDbAccessPlan::TPlan::operator!=(const TPlan& aPlan) const
138 {return !(iFlags==aPlan.iFlags && iIndex==aPlan.iIndex && iUpper==aPlan.iUpper && iLower==aPlan.iLower);}
140 // Class RDbAccessPlan::CDbCompPredicateList
141 inline RDbAccessPlan::CDbCompPredicateList::CDbCompPredicateList(const CDbTableDef& aTableDef,TDbTextComparison aComparison)
142 : CArrayFixFlat<CSqlCompPredicate*>(EGranularity),iTableDef(aTableDef),iComparison(aComparison),iRestriction(EFalse)
144 inline TBool RDbAccessPlan::CDbCompPredicateList::IsRestriction()
145 {return iRestriction;}
147 // Class CDbTableCursor
148 inline CDbBlobSpace& CDbTableCursor::BlobsL() const
149 {CDbBlobSpace* b=iValid.Table().BlobsL();__ASSERT(b);return *b;}
150 inline void CDbTableCursor::AddSink()
151 {__ASSERT((iFlags&EWriteBuf)==0);iFlags|=EWriteBuf;}
152 inline void CDbTableCursor::ReleaseSink()
153 {__ASSERT(iFlags&EWriteBuf);iFlags&=~EWriteBuf;}
154 inline void CDbTableCursor::AddSource()
155 {__ASSERT(iReadBuf<EMaxReadBuf);++iReadBuf;}
156 inline void CDbTableCursor::ReleaseSource()
157 {__ASSERT(iReadBuf>0);--iReadBuf;}
159 // Class CDbTableCursor::HReadBuf
160 inline void CDbTableCursor::HReadBuf::Set(MStreamBuf* aHost)
161 {__ASSERT(!iHost);iHost=aHost;}
163 // Class CDbTableDatabase::CIncremental
164 inline RDbTransaction& CDbTableDatabase::CIncremental::Transaction()
165 {return iTransaction;}
166 inline CDbTableDatabase& CDbTableDatabase::CIncremental::Database()
167 {return Transaction().Database();}
168 inline void CDbTableDatabase::CIncremental::Construct(CStepper* aStepper)
170 inline TBool CDbTableDatabase::CIncremental::IsCommitted() const
171 {return iState==ECommitted;}
173 // Class CDbTableDatabase::CCreateIndex
174 inline CDbTableDatabase::CCreateIndex::CCreateIndex(RDbTransaction& aTransaction)
175 : CIncrementalDDL(aTransaction)
177 // Class CDbTableDatabase::CDropIndex
178 inline CDbTableDatabase::CDropIndex::CDropIndex(RDbTransaction& aTransaction)
179 : CIncrementalDDL(aTransaction)
181 // Class CDbTableDatabase::CDropTable
182 inline CDbTableDatabase::CDropTable::CDropTable(RDbTransaction& aTransaction)
183 : CIncrementalDDL(aTransaction)
185 // Class CDbTableDatabase::CAlterTable
186 inline CDbTableDatabase::CAlterTable::CAlterTable(RDbTransaction& aTransaction,CDbTableDef& aDef)
187 : CIncrementalDDL(aTransaction), iDef(aDef)
189 // Class CDbIncrementalDML
190 inline CDbIncrementalDML::CDbIncrementalDML(RDbAccessPlan& aPlan)
191 :iTable(aPlan.Table()),iSource(aPlan.Adopt())
192 {__ASSERT(iState==EInitialising);}
193 inline RDbTransaction& CDbIncrementalDML::Transaction()
194 {return iTable.Database().Transaction();}
195 inline TBool CDbIncrementalDML::IsUpdate() const
196 {return iValues!=NULL;}
197 inline void CDbIncrementalDML::SetState(TState aState)
200 // Class CDbTableDatabase::CInterface
201 inline CDbTableDatabase& CDbTableDatabase::CInterface::Database()
204 // Class CDbTableDatabase::CSource
205 inline CDbTableDatabase& CDbTableDatabase::CSource::Database()