sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
// Class RDbIndexes
|
sl@0
|
17 |
inline RDbIndexes::RDbIndexes()
|
sl@0
|
18 |
: iRep(_FOFF(CDbTableIndexDef,iLink))
|
sl@0
|
19 |
{}
|
sl@0
|
20 |
// Class HDbColumnSet
|
sl@0
|
21 |
inline HDbColumnSet::TIterator HDbColumnSet::ColumnL(const TDesC& aColumn)
|
sl@0
|
22 |
{return CONST_CAST(TIterator,((const HDbColumnSet*)this)->ColumnL(aColumn));}
|
sl@0
|
23 |
|
sl@0
|
24 |
// Class RDbTableSchema
|
sl@0
|
25 |
inline RDbTableSchema::RDbTableSchema()
|
sl@0
|
26 |
: iRep(_FOFF(CDbTableDef,iLink))
|
sl@0
|
27 |
{}
|
sl@0
|
28 |
inline void RDbTableSchema::Close()
|
sl@0
|
29 |
{Discard();}
|
sl@0
|
30 |
inline TBool RDbTableSchema::IsLoaded() const
|
sl@0
|
31 |
{return iLoaded;}
|
sl@0
|
32 |
inline void RDbTableSchema::Remove(CDbTableDef* aDef)
|
sl@0
|
33 |
{iRep.Remove(*aDef);}
|
sl@0
|
34 |
|
sl@0
|
35 |
// Class CDbTable
|
sl@0
|
36 |
inline void CDbTable::Discard()
|
sl@0
|
37 |
{__ASSERT(iRef==ECached);Release();}
|
sl@0
|
38 |
inline TBool CDbTable::IsIdle() const
|
sl@0
|
39 |
{return iRef==EIdle;}
|
sl@0
|
40 |
inline TBool CDbTable::InUse() const
|
sl@0
|
41 |
{return iRef>=0;}
|
sl@0
|
42 |
inline RDbCache& CDbTable::Cache()
|
sl@0
|
43 |
{return Database().iCache;}
|
sl@0
|
44 |
|
sl@0
|
45 |
// Class CDbTable::TValid
|
sl@0
|
46 |
inline CDbTable& CDbTable::TValid::Table() const
|
sl@0
|
47 |
{return iTable;}
|
sl@0
|
48 |
inline CDbTable::TValid::operator TAny*() const
|
sl@0
|
49 |
{return Table().iDatabase;}
|
sl@0
|
50 |
inline RDbTransaction& CDbTable::TValid::Transaction() const
|
sl@0
|
51 |
{return Table().Database().Transaction();}
|
sl@0
|
52 |
|
sl@0
|
53 |
// Class RDbTables
|
sl@0
|
54 |
inline RDbTables::RDbTables()
|
sl@0
|
55 |
: iRep(_FOFF(CDbTable,iLink))
|
sl@0
|
56 |
{}
|
sl@0
|
57 |
inline TBool RDbTables::IsEmpty() const
|
sl@0
|
58 |
{return iRep.IsEmpty();}
|
sl@0
|
59 |
inline void RDbTables::Add(CDbTable& aTable)
|
sl@0
|
60 |
{iRep.AddLast(aTable);}
|
sl@0
|
61 |
inline void RDbTables::Remove(CDbTable& aTable)
|
sl@0
|
62 |
{iRep.Remove(aTable);}
|
sl@0
|
63 |
inline RDbTables::operator TSglQueBase&()
|
sl@0
|
64 |
{return iRep;}
|
sl@0
|
65 |
|
sl@0
|
66 |
// Class RDbTransaction
|
sl@0
|
67 |
inline RDbTransaction::RDbTransaction()
|
sl@0
|
68 |
:iMaxLock(1)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
__ASSERT(iDatabase==0);
|
sl@0
|
71 |
__ASSERT(iAction==EDbReadLock);
|
sl@0
|
72 |
__ASSERT(iLockState==EDbReadLock);
|
sl@0
|
73 |
__ASSERT(iSharers==0);
|
sl@0
|
74 |
__ASSERT(iLockCount==0);
|
sl@0
|
75 |
__ASSERT(iUpdaters==0);
|
sl@0
|
76 |
__ASSERT(iNotifier==0);
|
sl@0
|
77 |
}
|
sl@0
|
78 |
inline void RDbTransaction::Open(CDbTableDatabase& aDatabase)
|
sl@0
|
79 |
{__ASSERT(!iDatabase);iDatabase=&aDatabase;}
|
sl@0
|
80 |
inline const TDbGeneration& RDbTransaction::RollbackGeneration() const
|
sl@0
|
81 |
{return iRollback;}
|
sl@0
|
82 |
inline TBool RDbTransaction::IsLocked() const
|
sl@0
|
83 |
{return iLockCount>0;}
|
sl@0
|
84 |
inline CDbTableDatabase& RDbTransaction::Database()
|
sl@0
|
85 |
{__ASSERT(iDatabase);return *iDatabase;}
|
sl@0
|
86 |
inline void RDbTransaction::ReadyL() const
|
sl@0
|
87 |
{if (iLockState&EFailed) __LEAVE(KErrDied);}
|
sl@0
|
88 |
|
sl@0
|
89 |
// Class CDbTableDatabase
|
sl@0
|
90 |
inline void CDbTableDatabase::Open()
|
sl@0
|
91 |
{++iRef;}
|
sl@0
|
92 |
inline void CDbTableDatabase::AddTable(CDbTable& aTable)
|
sl@0
|
93 |
{iTables.Add(aTable);}
|
sl@0
|
94 |
|
sl@0
|
95 |
// Class CDbTableSource
|
sl@0
|
96 |
inline void CDbTableSource::SetIterator(CDbRecordIter* anIter)
|
sl@0
|
97 |
{iIter=anIter;}
|
sl@0
|
98 |
inline CDbTable& CDbTableSource::Table()
|
sl@0
|
99 |
{return iRow.Table();}
|
sl@0
|
100 |
inline const RDbTableRow& CDbTableSource::Row()
|
sl@0
|
101 |
{return iRow;}
|
sl@0
|
102 |
|
sl@0
|
103 |
// Class CDbDataStage
|
sl@0
|
104 |
inline void CDbDataStage::SetSource(CDbDataSource* aSource)
|
sl@0
|
105 |
{__ASSERT(!iSource);iSource=aSource;}
|
sl@0
|
106 |
inline CDbDataSource& CDbDataStage::Source()
|
sl@0
|
107 |
{return *iSource;}
|
sl@0
|
108 |
inline const CDbDataSource& CDbDataStage::Source() const
|
sl@0
|
109 |
{return *iSource;}
|
sl@0
|
110 |
|
sl@0
|
111 |
// Class CDbRestrictStage
|
sl@0
|
112 |
inline void CDbRestrictStage::SetRestriction(CSqlSearchCondition* aRestriction)
|
sl@0
|
113 |
{__ASSERT(!iRestriction);iRestriction=aRestriction;}
|
sl@0
|
114 |
inline CSqlSearchCondition& CDbRestrictStage::Restriction() const
|
sl@0
|
115 |
{__ASSERT(iRestriction);return *iRestriction;}
|
sl@0
|
116 |
|
sl@0
|
117 |
// Class RDbAccessPlan
|
sl@0
|
118 |
inline RDbAccessPlan::RDbAccessPlan(CSqlQuery* aQuery,TDbTextComparison aComparison)
|
sl@0
|
119 |
:iPlans(EGranularity),iComparison(aComparison),iQuery(aQuery)
|
sl@0
|
120 |
{__DEBUG(iSource=NULL;iTable=NULL;)}
|
sl@0
|
121 |
inline RDbAccessPlan::RDbAccessPlan()
|
sl@0
|
122 |
:iPlans(EGranularity),iComparison(EDbCompareNormal)
|
sl@0
|
123 |
{__DEBUG(iSource=NULL;iTable=NULL;)}
|
sl@0
|
124 |
inline CDbTable& RDbAccessPlan::Table()
|
sl@0
|
125 |
{__ASSERT(iTable);return *iTable;}
|
sl@0
|
126 |
inline CDbDataSource& RDbAccessPlan::Source()
|
sl@0
|
127 |
{__ASSERT(iSource);return *iSource;}
|
sl@0
|
128 |
inline CDbDataSource* RDbAccessPlan::Adopt()
|
sl@0
|
129 |
{__ASSERT(iSource);CDbDataSource* s=iSource;iSource=NULL;return s;}
|
sl@0
|
130 |
|
sl@0
|
131 |
// Class RDbAccessPlan::TPlan
|
sl@0
|
132 |
inline RDbAccessPlan::TPlan::TPlan() :
|
sl@0
|
133 |
iFlags(0),
|
sl@0
|
134 |
iIndex(0),
|
sl@0
|
135 |
iLower(0),
|
sl@0
|
136 |
iUpper(0)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
inline TBool RDbAccessPlan::TPlan::operator!=(const TPlan& aPlan) const
|
sl@0
|
141 |
{return !(iFlags==aPlan.iFlags && iIndex==aPlan.iIndex && iUpper==aPlan.iUpper && iLower==aPlan.iLower);}
|
sl@0
|
142 |
|
sl@0
|
143 |
// Class RDbAccessPlan::CDbCompPredicateList
|
sl@0
|
144 |
inline RDbAccessPlan::CDbCompPredicateList::CDbCompPredicateList(const CDbTableDef& aTableDef,TDbTextComparison aComparison)
|
sl@0
|
145 |
: CArrayFixFlat<CSqlCompPredicate*>(EGranularity),iTableDef(aTableDef),iComparison(aComparison),iRestriction(EFalse)
|
sl@0
|
146 |
{}
|
sl@0
|
147 |
inline TBool RDbAccessPlan::CDbCompPredicateList::IsRestriction()
|
sl@0
|
148 |
{return iRestriction;}
|
sl@0
|
149 |
|
sl@0
|
150 |
// Class CDbTableCursor
|
sl@0
|
151 |
inline CDbBlobSpace& CDbTableCursor::BlobsL() const
|
sl@0
|
152 |
{CDbBlobSpace* b=iValid.Table().BlobsL();__ASSERT(b);return *b;}
|
sl@0
|
153 |
inline void CDbTableCursor::AddSink()
|
sl@0
|
154 |
{__ASSERT((iFlags&EWriteBuf)==0);iFlags|=EWriteBuf;}
|
sl@0
|
155 |
inline void CDbTableCursor::ReleaseSink()
|
sl@0
|
156 |
{__ASSERT(iFlags&EWriteBuf);iFlags&=~EWriteBuf;}
|
sl@0
|
157 |
inline void CDbTableCursor::AddSource()
|
sl@0
|
158 |
{__ASSERT(iReadBuf<EMaxReadBuf);++iReadBuf;}
|
sl@0
|
159 |
inline void CDbTableCursor::ReleaseSource()
|
sl@0
|
160 |
{__ASSERT(iReadBuf>0);--iReadBuf;}
|
sl@0
|
161 |
|
sl@0
|
162 |
// Class CDbTableCursor::HReadBuf
|
sl@0
|
163 |
inline void CDbTableCursor::HReadBuf::Set(MStreamBuf* aHost)
|
sl@0
|
164 |
{__ASSERT(!iHost);iHost=aHost;}
|
sl@0
|
165 |
|
sl@0
|
166 |
// Class CDbTableDatabase::CIncremental
|
sl@0
|
167 |
inline RDbTransaction& CDbTableDatabase::CIncremental::Transaction()
|
sl@0
|
168 |
{return iTransaction;}
|
sl@0
|
169 |
inline CDbTableDatabase& CDbTableDatabase::CIncremental::Database()
|
sl@0
|
170 |
{return Transaction().Database();}
|
sl@0
|
171 |
inline void CDbTableDatabase::CIncremental::Construct(CStepper* aStepper)
|
sl@0
|
172 |
{iStepper=aStepper;}
|
sl@0
|
173 |
inline TBool CDbTableDatabase::CIncremental::IsCommitted() const
|
sl@0
|
174 |
{return iState==ECommitted;}
|
sl@0
|
175 |
|
sl@0
|
176 |
// Class CDbTableDatabase::CCreateIndex
|
sl@0
|
177 |
inline CDbTableDatabase::CCreateIndex::CCreateIndex(RDbTransaction& aTransaction)
|
sl@0
|
178 |
: CIncrementalDDL(aTransaction)
|
sl@0
|
179 |
{}
|
sl@0
|
180 |
// Class CDbTableDatabase::CDropIndex
|
sl@0
|
181 |
inline CDbTableDatabase::CDropIndex::CDropIndex(RDbTransaction& aTransaction)
|
sl@0
|
182 |
: CIncrementalDDL(aTransaction)
|
sl@0
|
183 |
{}
|
sl@0
|
184 |
// Class CDbTableDatabase::CDropTable
|
sl@0
|
185 |
inline CDbTableDatabase::CDropTable::CDropTable(RDbTransaction& aTransaction)
|
sl@0
|
186 |
: CIncrementalDDL(aTransaction)
|
sl@0
|
187 |
{}
|
sl@0
|
188 |
// Class CDbTableDatabase::CAlterTable
|
sl@0
|
189 |
inline CDbTableDatabase::CAlterTable::CAlterTable(RDbTransaction& aTransaction,CDbTableDef& aDef)
|
sl@0
|
190 |
: CIncrementalDDL(aTransaction), iDef(aDef)
|
sl@0
|
191 |
{}
|
sl@0
|
192 |
// Class CDbIncrementalDML
|
sl@0
|
193 |
inline CDbIncrementalDML::CDbIncrementalDML(RDbAccessPlan& aPlan)
|
sl@0
|
194 |
:iTable(aPlan.Table()),iSource(aPlan.Adopt())
|
sl@0
|
195 |
{__ASSERT(iState==EInitialising);}
|
sl@0
|
196 |
inline RDbTransaction& CDbIncrementalDML::Transaction()
|
sl@0
|
197 |
{return iTable.Database().Transaction();}
|
sl@0
|
198 |
inline TBool CDbIncrementalDML::IsUpdate() const
|
sl@0
|
199 |
{return iValues!=NULL;}
|
sl@0
|
200 |
inline void CDbIncrementalDML::SetState(TState aState)
|
sl@0
|
201 |
{iState=aState;}
|
sl@0
|
202 |
|
sl@0
|
203 |
// Class CDbTableDatabase::CInterface
|
sl@0
|
204 |
inline CDbTableDatabase& CDbTableDatabase::CInterface::Database()
|
sl@0
|
205 |
{return iDatabase;}
|
sl@0
|
206 |
|
sl@0
|
207 |
// Class CDbTableDatabase::CSource
|
sl@0
|
208 |
inline CDbTableDatabase& CDbTableDatabase::CSource::Database()
|
sl@0
|
209 |
{return iDatabase;}
|