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