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