First public contribution.
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.
17 inline RDbIndexes::RDbIndexes()
18 : iRep(_FOFF(CDbTableIndexDef,iLink))
21 inline HDbColumnSet::TIterator HDbColumnSet::ColumnL(const TDesC& aColumn)
22 {return CONST_CAST(TIterator,((const HDbColumnSet*)this)->ColumnL(aColumn));}
24 // Class RDbTableSchema
25 inline RDbTableSchema::RDbTableSchema()
26 : iRep(_FOFF(CDbTableDef,iLink))
28 inline void RDbTableSchema::Close()
30 inline TBool RDbTableSchema::IsLoaded() const
32 inline void RDbTableSchema::Remove(CDbTableDef* aDef)
36 inline void CDbTable::Discard()
37 {__ASSERT(iRef==ECached);Release();}
38 inline TBool CDbTable::IsIdle() const
40 inline TBool CDbTable::InUse() const
42 inline RDbCache& CDbTable::Cache()
43 {return Database().iCache;}
45 // Class CDbTable::TValid
46 inline CDbTable& CDbTable::TValid::Table() const
48 inline CDbTable::TValid::operator TAny*() const
49 {return Table().iDatabase;}
50 inline RDbTransaction& CDbTable::TValid::Transaction() const
51 {return Table().Database().Transaction();}
54 inline RDbTables::RDbTables()
55 : iRep(_FOFF(CDbTable,iLink))
57 inline TBool RDbTables::IsEmpty() const
58 {return iRep.IsEmpty();}
59 inline void RDbTables::Add(CDbTable& aTable)
60 {iRep.AddLast(aTable);}
61 inline void RDbTables::Remove(CDbTable& aTable)
62 {iRep.Remove(aTable);}
63 inline RDbTables::operator TSglQueBase&()
66 // Class RDbTransaction
67 inline RDbTransaction::RDbTransaction()
70 __ASSERT(iDatabase==0);
71 __ASSERT(iAction==EDbReadLock);
72 __ASSERT(iLockState==EDbReadLock);
73 __ASSERT(iSharers==0);
74 __ASSERT(iLockCount==0);
75 __ASSERT(iUpdaters==0);
76 __ASSERT(iNotifier==0);
78 inline void RDbTransaction::Open(CDbTableDatabase& aDatabase)
79 {__ASSERT(!iDatabase);iDatabase=&aDatabase;}
80 inline const TDbGeneration& RDbTransaction::RollbackGeneration() const
82 inline TBool RDbTransaction::IsLocked() const
83 {return iLockCount>0;}
84 inline CDbTableDatabase& RDbTransaction::Database()
85 {__ASSERT(iDatabase);return *iDatabase;}
86 inline void RDbTransaction::ReadyL() const
87 {if (iLockState&EFailed) __LEAVE(KErrDied);}
89 // Class CDbTableDatabase
90 inline void CDbTableDatabase::Open()
92 inline void CDbTableDatabase::AddTable(CDbTable& aTable)
93 {iTables.Add(aTable);}
95 // Class CDbTableSource
96 inline void CDbTableSource::SetIterator(CDbRecordIter* anIter)
98 inline CDbTable& CDbTableSource::Table()
99 {return iRow.Table();}
100 inline const RDbTableRow& CDbTableSource::Row()
103 // Class CDbDataStage
104 inline void CDbDataStage::SetSource(CDbDataSource* aSource)
105 {__ASSERT(!iSource);iSource=aSource;}
106 inline CDbDataSource& CDbDataStage::Source()
108 inline const CDbDataSource& CDbDataStage::Source() const
111 // Class CDbRestrictStage
112 inline void CDbRestrictStage::SetRestriction(CSqlSearchCondition* aRestriction)
113 {__ASSERT(!iRestriction);iRestriction=aRestriction;}
114 inline CSqlSearchCondition& CDbRestrictStage::Restriction() const
115 {__ASSERT(iRestriction);return *iRestriction;}
117 // Class RDbAccessPlan
118 inline RDbAccessPlan::RDbAccessPlan(CSqlQuery* aQuery,TDbTextComparison aComparison)
119 :iPlans(EGranularity),iComparison(aComparison),iQuery(aQuery)
120 {__DEBUG(iSource=NULL;iTable=NULL;)}
121 inline RDbAccessPlan::RDbAccessPlan()
122 :iPlans(EGranularity),iComparison(EDbCompareNormal)
123 {__DEBUG(iSource=NULL;iTable=NULL;)}
124 inline CDbTable& RDbAccessPlan::Table()
125 {__ASSERT(iTable);return *iTable;}
126 inline CDbDataSource& RDbAccessPlan::Source()
127 {__ASSERT(iSource);return *iSource;}
128 inline CDbDataSource* RDbAccessPlan::Adopt()
129 {__ASSERT(iSource);CDbDataSource* s=iSource;iSource=NULL;return s;}
131 // Class RDbAccessPlan::TPlan
132 inline RDbAccessPlan::TPlan::TPlan() :
140 inline TBool RDbAccessPlan::TPlan::operator!=(const TPlan& aPlan) const
141 {return !(iFlags==aPlan.iFlags && iIndex==aPlan.iIndex && iUpper==aPlan.iUpper && iLower==aPlan.iLower);}
143 // Class RDbAccessPlan::CDbCompPredicateList
144 inline RDbAccessPlan::CDbCompPredicateList::CDbCompPredicateList(const CDbTableDef& aTableDef,TDbTextComparison aComparison)
145 : CArrayFixFlat<CSqlCompPredicate*>(EGranularity),iTableDef(aTableDef),iComparison(aComparison),iRestriction(EFalse)
147 inline TBool RDbAccessPlan::CDbCompPredicateList::IsRestriction()
148 {return iRestriction;}
150 // Class CDbTableCursor
151 inline CDbBlobSpace& CDbTableCursor::BlobsL() const
152 {CDbBlobSpace* b=iValid.Table().BlobsL();__ASSERT(b);return *b;}
153 inline void CDbTableCursor::AddSink()
154 {__ASSERT((iFlags&EWriteBuf)==0);iFlags|=EWriteBuf;}
155 inline void CDbTableCursor::ReleaseSink()
156 {__ASSERT(iFlags&EWriteBuf);iFlags&=~EWriteBuf;}
157 inline void CDbTableCursor::AddSource()
158 {__ASSERT(iReadBuf<EMaxReadBuf);++iReadBuf;}
159 inline void CDbTableCursor::ReleaseSource()
160 {__ASSERT(iReadBuf>0);--iReadBuf;}
162 // Class CDbTableCursor::HReadBuf
163 inline void CDbTableCursor::HReadBuf::Set(MStreamBuf* aHost)
164 {__ASSERT(!iHost);iHost=aHost;}
166 // Class CDbTableDatabase::CIncremental
167 inline RDbTransaction& CDbTableDatabase::CIncremental::Transaction()
168 {return iTransaction;}
169 inline CDbTableDatabase& CDbTableDatabase::CIncremental::Database()
170 {return Transaction().Database();}
171 inline void CDbTableDatabase::CIncremental::Construct(CStepper* aStepper)
173 inline TBool CDbTableDatabase::CIncremental::IsCommitted() const
174 {return iState==ECommitted;}
176 // Class CDbTableDatabase::CCreateIndex
177 inline CDbTableDatabase::CCreateIndex::CCreateIndex(RDbTransaction& aTransaction)
178 : CIncrementalDDL(aTransaction)
180 // Class CDbTableDatabase::CDropIndex
181 inline CDbTableDatabase::CDropIndex::CDropIndex(RDbTransaction& aTransaction)
182 : CIncrementalDDL(aTransaction)
184 // Class CDbTableDatabase::CDropTable
185 inline CDbTableDatabase::CDropTable::CDropTable(RDbTransaction& aTransaction)
186 : CIncrementalDDL(aTransaction)
188 // Class CDbTableDatabase::CAlterTable
189 inline CDbTableDatabase::CAlterTable::CAlterTable(RDbTransaction& aTransaction,CDbTableDef& aDef)
190 : CIncrementalDDL(aTransaction), iDef(aDef)
192 // Class CDbIncrementalDML
193 inline CDbIncrementalDML::CDbIncrementalDML(RDbAccessPlan& aPlan)
194 :iTable(aPlan.Table()),iSource(aPlan.Adopt())
195 {__ASSERT(iState==EInitialising);}
196 inline RDbTransaction& CDbIncrementalDML::Transaction()
197 {return iTable.Database().Transaction();}
198 inline TBool CDbIncrementalDML::IsUpdate() const
199 {return iValues!=NULL;}
200 inline void CDbIncrementalDML::SetState(TState aState)
203 // Class CDbTableDatabase::CInterface
204 inline CDbTableDatabase& CDbTableDatabase::CInterface::Database()
207 // Class CDbTableDatabase::CSource
208 inline CDbTableDatabase& CDbTableDatabase::CSource::Database()