sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: // Class RDbIndexes sl@0: inline RDbIndexes::RDbIndexes() sl@0: : iRep(_FOFF(CDbTableIndexDef,iLink)) sl@0: {} sl@0: // Class HDbColumnSet sl@0: inline HDbColumnSet::TIterator HDbColumnSet::ColumnL(const TDesC& aColumn) sl@0: {return CONST_CAST(TIterator,((const HDbColumnSet*)this)->ColumnL(aColumn));} sl@0: sl@0: // Class RDbTableSchema sl@0: inline RDbTableSchema::RDbTableSchema() sl@0: : iRep(_FOFF(CDbTableDef,iLink)) sl@0: {} sl@0: inline void RDbTableSchema::Close() sl@0: {Discard();} sl@0: inline TBool RDbTableSchema::IsLoaded() const sl@0: {return iLoaded;} sl@0: inline void RDbTableSchema::Remove(CDbTableDef* aDef) sl@0: {iRep.Remove(*aDef);} sl@0: sl@0: // Class CDbTable sl@0: inline void CDbTable::Discard() sl@0: {__ASSERT(iRef==ECached);Release();} sl@0: inline TBool CDbTable::IsIdle() const sl@0: {return iRef==EIdle;} sl@0: inline TBool CDbTable::InUse() const sl@0: {return iRef>=0;} sl@0: inline RDbCache& CDbTable::Cache() sl@0: {return Database().iCache;} sl@0: sl@0: // Class CDbTable::TValid sl@0: inline CDbTable& CDbTable::TValid::Table() const sl@0: {return iTable;} sl@0: inline CDbTable::TValid::operator TAny*() const sl@0: {return Table().iDatabase;} sl@0: inline RDbTransaction& CDbTable::TValid::Transaction() const sl@0: {return Table().Database().Transaction();} sl@0: sl@0: // Class RDbTables sl@0: inline RDbTables::RDbTables() sl@0: : iRep(_FOFF(CDbTable,iLink)) sl@0: {} sl@0: inline TBool RDbTables::IsEmpty() const sl@0: {return iRep.IsEmpty();} sl@0: inline void RDbTables::Add(CDbTable& aTable) sl@0: {iRep.AddLast(aTable);} sl@0: inline void RDbTables::Remove(CDbTable& aTable) sl@0: {iRep.Remove(aTable);} sl@0: inline RDbTables::operator TSglQueBase&() sl@0: {return iRep;} sl@0: sl@0: // Class RDbTransaction sl@0: inline RDbTransaction::RDbTransaction() sl@0: :iMaxLock(1) sl@0: { sl@0: __ASSERT(iDatabase==0); sl@0: __ASSERT(iAction==EDbReadLock); sl@0: __ASSERT(iLockState==EDbReadLock); sl@0: __ASSERT(iSharers==0); sl@0: __ASSERT(iLockCount==0); sl@0: __ASSERT(iUpdaters==0); sl@0: __ASSERT(iNotifier==0); sl@0: } sl@0: inline void RDbTransaction::Open(CDbTableDatabase& aDatabase) sl@0: {__ASSERT(!iDatabase);iDatabase=&aDatabase;} sl@0: inline const TDbGeneration& RDbTransaction::RollbackGeneration() const sl@0: {return iRollback;} sl@0: inline TBool RDbTransaction::IsLocked() const sl@0: {return iLockCount>0;} sl@0: inline CDbTableDatabase& RDbTransaction::Database() sl@0: {__ASSERT(iDatabase);return *iDatabase;} sl@0: inline void RDbTransaction::ReadyL() const sl@0: {if (iLockState&EFailed) __LEAVE(KErrDied);} sl@0: sl@0: // Class CDbTableDatabase sl@0: inline void CDbTableDatabase::Open() sl@0: {++iRef;} sl@0: inline void CDbTableDatabase::AddTable(CDbTable& aTable) sl@0: {iTables.Add(aTable);} sl@0: sl@0: // Class CDbTableSource sl@0: inline void CDbTableSource::SetIterator(CDbRecordIter* anIter) sl@0: {iIter=anIter;} sl@0: inline CDbTable& CDbTableSource::Table() sl@0: {return iRow.Table();} sl@0: inline const RDbTableRow& CDbTableSource::Row() sl@0: {return iRow;} sl@0: sl@0: // Class CDbDataStage sl@0: inline void CDbDataStage::SetSource(CDbDataSource* aSource) sl@0: {__ASSERT(!iSource);iSource=aSource;} sl@0: inline CDbDataSource& CDbDataStage::Source() sl@0: {return *iSource;} sl@0: inline const CDbDataSource& CDbDataStage::Source() const sl@0: {return *iSource;} sl@0: sl@0: // Class CDbRestrictStage sl@0: inline void CDbRestrictStage::SetRestriction(CSqlSearchCondition* aRestriction) sl@0: {__ASSERT(!iRestriction);iRestriction=aRestriction;} sl@0: inline CSqlSearchCondition& CDbRestrictStage::Restriction() const sl@0: {__ASSERT(iRestriction);return *iRestriction;} sl@0: sl@0: // Class RDbAccessPlan sl@0: inline RDbAccessPlan::RDbAccessPlan(CSqlQuery* aQuery,TDbTextComparison aComparison) sl@0: :iPlans(EGranularity),iComparison(aComparison),iQuery(aQuery) sl@0: {__DEBUG(iSource=NULL;iTable=NULL;)} sl@0: inline RDbAccessPlan::RDbAccessPlan() sl@0: :iPlans(EGranularity),iComparison(EDbCompareNormal) sl@0: {__DEBUG(iSource=NULL;iTable=NULL;)} sl@0: inline CDbTable& RDbAccessPlan::Table() sl@0: {__ASSERT(iTable);return *iTable;} sl@0: inline CDbDataSource& RDbAccessPlan::Source() sl@0: {__ASSERT(iSource);return *iSource;} sl@0: inline CDbDataSource* RDbAccessPlan::Adopt() sl@0: {__ASSERT(iSource);CDbDataSource* s=iSource;iSource=NULL;return s;} sl@0: sl@0: // Class RDbAccessPlan::TPlan sl@0: inline RDbAccessPlan::TPlan::TPlan() : sl@0: iFlags(0), sl@0: iIndex(0), sl@0: iLower(0), sl@0: iUpper(0) sl@0: { sl@0: } sl@0: sl@0: inline TBool RDbAccessPlan::TPlan::operator!=(const TPlan& aPlan) const sl@0: {return !(iFlags==aPlan.iFlags && iIndex==aPlan.iIndex && iUpper==aPlan.iUpper && iLower==aPlan.iLower);} sl@0: sl@0: // Class RDbAccessPlan::CDbCompPredicateList sl@0: inline RDbAccessPlan::CDbCompPredicateList::CDbCompPredicateList(const CDbTableDef& aTableDef,TDbTextComparison aComparison) sl@0: : CArrayFixFlat(EGranularity),iTableDef(aTableDef),iComparison(aComparison),iRestriction(EFalse) sl@0: {} sl@0: inline TBool RDbAccessPlan::CDbCompPredicateList::IsRestriction() sl@0: {return iRestriction;} sl@0: sl@0: // Class CDbTableCursor sl@0: inline CDbBlobSpace& CDbTableCursor::BlobsL() const sl@0: {CDbBlobSpace* b=iValid.Table().BlobsL();__ASSERT(b);return *b;} sl@0: inline void CDbTableCursor::AddSink() sl@0: {__ASSERT((iFlags&EWriteBuf)==0);iFlags|=EWriteBuf;} sl@0: inline void CDbTableCursor::ReleaseSink() sl@0: {__ASSERT(iFlags&EWriteBuf);iFlags&=~EWriteBuf;} sl@0: inline void CDbTableCursor::AddSource() sl@0: {__ASSERT(iReadBuf0);--iReadBuf;} sl@0: sl@0: // Class CDbTableCursor::HReadBuf sl@0: inline void CDbTableCursor::HReadBuf::Set(MStreamBuf* aHost) sl@0: {__ASSERT(!iHost);iHost=aHost;} sl@0: sl@0: // Class CDbTableDatabase::CIncremental sl@0: inline RDbTransaction& CDbTableDatabase::CIncremental::Transaction() sl@0: {return iTransaction;} sl@0: inline CDbTableDatabase& CDbTableDatabase::CIncremental::Database() sl@0: {return Transaction().Database();} sl@0: inline void CDbTableDatabase::CIncremental::Construct(CStepper* aStepper) sl@0: {iStepper=aStepper;} sl@0: inline TBool CDbTableDatabase::CIncremental::IsCommitted() const sl@0: {return iState==ECommitted;} sl@0: sl@0: // Class CDbTableDatabase::CCreateIndex sl@0: inline CDbTableDatabase::CCreateIndex::CCreateIndex(RDbTransaction& aTransaction) sl@0: : CIncrementalDDL(aTransaction) sl@0: {} sl@0: // Class CDbTableDatabase::CDropIndex sl@0: inline CDbTableDatabase::CDropIndex::CDropIndex(RDbTransaction& aTransaction) sl@0: : CIncrementalDDL(aTransaction) sl@0: {} sl@0: // Class CDbTableDatabase::CDropTable sl@0: inline CDbTableDatabase::CDropTable::CDropTable(RDbTransaction& aTransaction) sl@0: : CIncrementalDDL(aTransaction) sl@0: {} sl@0: // Class CDbTableDatabase::CAlterTable sl@0: inline CDbTableDatabase::CAlterTable::CAlterTable(RDbTransaction& aTransaction,CDbTableDef& aDef) sl@0: : CIncrementalDDL(aTransaction), iDef(aDef) sl@0: {} sl@0: // Class CDbIncrementalDML sl@0: inline CDbIncrementalDML::CDbIncrementalDML(RDbAccessPlan& aPlan) sl@0: :iTable(aPlan.Table()),iSource(aPlan.Adopt()) sl@0: {__ASSERT(iState==EInitialising);} sl@0: inline RDbTransaction& CDbIncrementalDML::Transaction() sl@0: {return iTable.Database().Transaction();} sl@0: inline TBool CDbIncrementalDML::IsUpdate() const sl@0: {return iValues!=NULL;} sl@0: inline void CDbIncrementalDML::SetState(TState aState) sl@0: {iState=aState;} sl@0: sl@0: // Class CDbTableDatabase::CInterface sl@0: inline CDbTableDatabase& CDbTableDatabase::CInterface::Database() sl@0: {return iDatabase;} sl@0: sl@0: // Class CDbTableDatabase::CSource sl@0: inline CDbTableDatabase& CDbTableDatabase::CSource::Database() sl@0: {return iDatabase;}