persistentstorage/dbms/inc/D32SQL.INL
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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 RSqlLiteral
       
    17 inline TBool RSqlLiteral::IsNull() const
       
    18 	{return iType==ENull;}
       
    19 inline TInt32 RSqlLiteral::Int32() const
       
    20 	{__ASSERT(iType==EInt32);return iVal.iInt32;}
       
    21 inline TUint32 RSqlLiteral::Uint32() const
       
    22 	{__ASSERT(iType==EUint32);return iVal.iUint32;}
       
    23 inline const TInt64& RSqlLiteral::Int64() const
       
    24 	{__ASSERT(iType==EInt64);return iVal.iInt64;}
       
    25 inline const TReal32& RSqlLiteral::Real32() const
       
    26 	{__ASSERT(iType==EReal32);return iVal.iReal32;}
       
    27 inline const TReal64& RSqlLiteral::Real64() const
       
    28 	{__ASSERT(iType==EReal64);return iVal.iReal64;}
       
    29 inline const TTime& RSqlLiteral::Time() const
       
    30 	{__ASSERT(iType==ETime);return iVal.iTime;}
       
    31 inline const TPtrC RSqlLiteral::DesC() const
       
    32 	{__ASSERT(iType==EPtr);return TPtrC(iVal.iPtr.iPtr,iVal.iPtr.iEnd-iVal.iPtr.iPtr);}
       
    33 inline const TText* RSqlLiteral::Ptr() const
       
    34 	{__ASSERT(iType==EPtr);return iVal.iPtr.iPtr;}
       
    35 inline const TText* RSqlLiteral::End() const
       
    36 	{__ASSERT(iType==EPtr);return iVal.iPtr.iEnd;}
       
    37 inline const HBufC8& RSqlLiteral::Text8() const
       
    38 	{__ASSERT(iType==EBuf8);return *(const HBufC8*)iVal.iAlloc;}
       
    39 inline const HBufC16& RSqlLiteral::Text16() const
       
    40 	{__ASSERT(iType==EBuf16);return *(const HBufC16*)iVal.iAlloc;}
       
    41 inline const HMatcherPattern8& RSqlLiteral::Pattern8() const
       
    42 	{__ASSERT(iType==EPattern8);return *(const HMatcherPattern8*)iVal.iAlloc;}
       
    43 inline const HMatcherPattern16& RSqlLiteral::Pattern16() const
       
    44 	{__ASSERT(iType==EPattern16);return *(const HMatcherPattern16*)iVal.iAlloc;}
       
    45 
       
    46 // Class RSqlColumnList
       
    47 inline RSqlColumnList::RSqlColumnList()
       
    48 	:RArray<TPtrC>(EGranularity)
       
    49 	{}
       
    50 
       
    51 // Class CSqlSearchCondition
       
    52 inline CSqlSearchCondition::TType CSqlSearchCondition::NodeType() const
       
    53 	{return iType;}
       
    54 inline CSqlMultiNode* CSqlSearchCondition::MultiNode()
       
    55 	{__ASSERT(iType==EAnd||iType==EOr);return STATIC_CAST(CSqlMultiNode*,this);}
       
    56 inline CSqlNullPredicate* CSqlSearchCondition::NullPredicate()
       
    57 	{__ASSERT(iType==EIsNull||iType==EIsNotNull);return STATIC_CAST(CSqlNullPredicate*,this);}
       
    58 inline CSqlCompPredicate* CSqlSearchCondition::CompPredicate()
       
    59 	{__ASSERT(iType==ELess||iType==ELessEqual||iType==EEqual||iType==EGreaterEqual||iType==EGreater||iType==ENotEqual);return STATIC_CAST(CSqlCompPredicate*,this);}
       
    60 inline CSqlLikePredicate* CSqlSearchCondition::LikePredicate()
       
    61 	{__ASSERT(iType==ELike||iType==ENotLike);return STATIC_CAST(CSqlLikePredicate*,this);}
       
    62 
       
    63 // Class CSqlMultiNode
       
    64 inline TInt CSqlMultiNode::Count() const
       
    65 	{return iEnd-iLeaves;}
       
    66 inline CSqlSearchCondition* CSqlMultiNode::SubNode(TInt aIndex) const
       
    67 	{__ASSERT(TUint(aIndex)<TUint(Count()));return iLeaves[aIndex];}
       
    68 inline void CSqlMultiNode::SetSubNode(TInt aIndex,CSqlSearchCondition* aSearchCondition) 
       
    69 	{__ASSERT(TUint(aIndex)<TUint(Count()));iLeaves[aIndex]=aSearchCondition;}
       
    70 
       
    71 // Class CSqlBoundNode
       
    72 inline TBool CSqlBoundNode::IsBound() const
       
    73 	{return iSource!=0;}
       
    74 inline TDbColNo CSqlBoundNode::ColNo() const
       
    75 	{__ASSERT(IsBound());return iColumn.iBound.iNumber;}
       
    76 inline TDbColType CSqlBoundNode::ColType() const
       
    77 	{return iColumn.iBound.iType;}
       
    78 
       
    79 // Class CSqlLiteralNode 
       
    80 inline const RSqlLiteral& CSqlLiteralNode::Value() const
       
    81 	{return iLiteral;}
       
    82 inline RSqlLiteral& CSqlLiteralNode::Value()
       
    83 	{return iLiteral;}
       
    84 
       
    85 // Class CSqlQuery
       
    86 inline const TDesC& CSqlQuery::Table() const
       
    87 	{return iTable;}
       
    88 inline TBool CSqlQuery::HasColumnList() const
       
    89 	{return iColumns.Count()!=0;}
       
    90 inline const RSqlColumnList& CSqlQuery::ColumnList() const
       
    91 	{return iColumns;}
       
    92 inline TBool CSqlQuery::HasSearchCondition() const
       
    93 	{return iSearchCondition!=0;}
       
    94 inline CSqlSearchCondition& CSqlQuery::SearchCondition()
       
    95 	{__ASSERT(HasSearchCondition());return *iSearchCondition;}
       
    96 inline CSqlSearchCondition* CSqlQuery::AdoptSearchCondition()
       
    97 	{__ASSERT(HasSearchCondition());CSqlSearchCondition* rr=iSearchCondition;iSearchCondition=0;return rr;}
       
    98 inline TBool CSqlQuery::HasSortSpecification() const
       
    99 	{return iSortSpecification!=0;}
       
   100 inline CDbKey& CSqlQuery::SortSpecification()
       
   101 	{__ASSERT(HasSortSpecification());return *iSortSpecification;}
       
   102 
       
   103 // Class CSqlDMLStatement
       
   104 inline CSqlQuery& CSqlDMLStatement::Query()
       
   105 	{return iQuery;}
       
   106 inline CSqlValues& CSqlDMLStatement::Values()
       
   107 	{__ASSERT(iValues);return *iValues;}
       
   108 inline CSqlValues* CSqlDMLStatement::AdoptValues()
       
   109 	{__ASSERT(iValues);CSqlValues* v=iValues;iValues=NULL;return v;}
       
   110 inline TBool CSqlDMLStatement::HasValues() const
       
   111 	{return iValues!=NULL;}
       
   112 
       
   113 // Class CSqlModifyStatement
       
   114 inline TBool CSqlModifyStatement::IsUpdate() const
       
   115 	{return HasValues();}
       
   116 
       
   117 //class TSqlParser2
       
   118 
       
   119 inline Sql::TStatementType TSqlParser2::StatementType() const
       
   120 	{
       
   121 	return iStatementType;
       
   122 	}
       
   123 
       
   124 inline const TDesC& TSqlParser2::TableName() const
       
   125 	{
       
   126 	return iTableName;
       
   127 	}