os/persistentdata/persistentstorage/dbms/utable/UT_STD.INL
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 // Class RDbIndexes
    17 inline RDbIndexes::RDbIndexes()
    18 	: iRep(_FOFF(CDbTableIndexDef,iLink))
    19 	{}
    20 // Class HDbColumnSet
    21 inline HDbColumnSet::TIterator HDbColumnSet::ColumnL(const TDesC& aColumn)
    22 	{return CONST_CAST(TIterator,((const HDbColumnSet*)this)->ColumnL(aColumn));}
    23 
    24 // Class RDbTableSchema
    25 inline RDbTableSchema::RDbTableSchema()
    26 	: iRep(_FOFF(CDbTableDef,iLink))
    27 	{}
    28 inline void RDbTableSchema::Close()
    29 	{Discard();}
    30 inline TBool RDbTableSchema::IsLoaded() const
    31 	{return iLoaded;}
    32 inline void RDbTableSchema::Remove(CDbTableDef* aDef)
    33 	{iRep.Remove(*aDef);}
    34 
    35 // Class CDbTable
    36 inline void CDbTable::Discard()
    37 	{__ASSERT(iRef==ECached);Release();}
    38 inline TBool CDbTable::IsIdle() const
    39 	{return iRef==EIdle;}
    40 inline TBool CDbTable::InUse() const
    41 	{return iRef>=0;}
    42 inline RDbCache& CDbTable::Cache()
    43 	{return Database().iCache;}
    44 
    45 // Class CDbTable::TValid
    46 inline CDbTable& CDbTable::TValid::Table() const
    47 	{return iTable;}
    48 inline CDbTable::TValid::operator TAny*() const
    49 	{return Table().iDatabase;}
    50 inline RDbTransaction& CDbTable::TValid::Transaction() const
    51 	{return Table().Database().Transaction();}
    52 
    53 // Class RDbTables
    54 inline RDbTables::RDbTables()
    55 	: iRep(_FOFF(CDbTable,iLink))
    56 	{}
    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&()
    64 	{return iRep;}
    65 
    66 // Class RDbTransaction
    67 inline RDbTransaction::RDbTransaction()
    68 	:iMaxLock(1)
    69 	{
    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);
    77 	}
    78 inline void RDbTransaction::Open(CDbTableDatabase& aDatabase)
    79 	{__ASSERT(!iDatabase);iDatabase=&aDatabase;}
    80 inline const TDbGeneration& RDbTransaction::RollbackGeneration() const
    81 	{return iRollback;}
    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);}
    88 
    89 // Class CDbTableDatabase
    90 inline void CDbTableDatabase::Open()
    91 	{++iRef;}
    92 inline void CDbTableDatabase::AddTable(CDbTable& aTable)
    93 	{iTables.Add(aTable);}
    94 
    95 // Class CDbTableSource
    96 inline void CDbTableSource::SetIterator(CDbRecordIter* anIter)
    97 	{iIter=anIter;}
    98 inline CDbTable& CDbTableSource::Table()
    99 	{return iRow.Table();}
   100 inline const RDbTableRow& CDbTableSource::Row()
   101 	{return iRow;}
   102 
   103 // Class CDbDataStage
   104 inline void CDbDataStage::SetSource(CDbDataSource* aSource)
   105 	{__ASSERT(!iSource);iSource=aSource;}
   106 inline CDbDataSource& CDbDataStage::Source()
   107 	{return *iSource;}
   108 inline const CDbDataSource& CDbDataStage::Source() const
   109 	{return *iSource;}
   110 
   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;}
   116 
   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;}
   130 
   131 // Class RDbAccessPlan::TPlan
   132 inline RDbAccessPlan::TPlan::TPlan() :
   133 	iFlags(0),
   134 	iIndex(0),
   135 	iLower(0),
   136 	iUpper(0)
   137 	{
   138 	}
   139 
   140 inline TBool RDbAccessPlan::TPlan::operator!=(const TPlan& aPlan) const
   141 	{return !(iFlags==aPlan.iFlags && iIndex==aPlan.iIndex && iUpper==aPlan.iUpper && iLower==aPlan.iLower);}
   142 
   143 // Class RDbAccessPlan::CDbCompPredicateList
   144 inline RDbAccessPlan::CDbCompPredicateList::CDbCompPredicateList(const CDbTableDef& aTableDef,TDbTextComparison aComparison)
   145 	: CArrayFixFlat<CSqlCompPredicate*>(EGranularity),iTableDef(aTableDef),iComparison(aComparison),iRestriction(EFalse)
   146 	{}
   147 inline TBool RDbAccessPlan::CDbCompPredicateList::IsRestriction()
   148 	{return iRestriction;}
   149 
   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;}
   161 
   162 // Class CDbTableCursor::HReadBuf
   163 inline void CDbTableCursor::HReadBuf::Set(MStreamBuf* aHost)
   164 	{__ASSERT(!iHost);iHost=aHost;}
   165 
   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)
   172 	{iStepper=aStepper;}
   173 inline TBool CDbTableDatabase::CIncremental::IsCommitted() const
   174 	{return iState==ECommitted;}
   175 
   176 // Class CDbTableDatabase::CCreateIndex
   177 inline CDbTableDatabase::CCreateIndex::CCreateIndex(RDbTransaction& aTransaction)
   178 	: CIncrementalDDL(aTransaction)
   179 	{}
   180 // Class CDbTableDatabase::CDropIndex
   181 inline CDbTableDatabase::CDropIndex::CDropIndex(RDbTransaction& aTransaction)
   182 	: CIncrementalDDL(aTransaction)
   183 	{}
   184 // Class CDbTableDatabase::CDropTable
   185 inline CDbTableDatabase::CDropTable::CDropTable(RDbTransaction& aTransaction)
   186 	: CIncrementalDDL(aTransaction)
   187 	{}
   188 // Class CDbTableDatabase::CAlterTable
   189 inline CDbTableDatabase::CAlterTable::CAlterTable(RDbTransaction& aTransaction,CDbTableDef& aDef)
   190 	: CIncrementalDDL(aTransaction), iDef(aDef)
   191 	{}
   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)
   201 	{iState=aState;}
   202 
   203 // Class CDbTableDatabase::CInterface
   204 inline CDbTableDatabase& CDbTableDatabase::CInterface::Database()
   205 	{return iDatabase;}
   206 
   207 // Class CDbTableDatabase::CSource
   208 inline CDbTableDatabase& CDbTableDatabase::CSource::Database()
   209 	{return iDatabase;}