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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 inline TBool RSqlLiteral::IsNull() const
22 {return iType==ENull;}
23 inline TInt32 RSqlLiteral::Int32() const
24 {__ASSERT(iType==EInt32);return iVal.iInt32;}
25 inline TUint32 RSqlLiteral::Uint32() const
26 {__ASSERT(iType==EUint32);return iVal.iUint32;}
27 inline const TInt64& RSqlLiteral::Int64() const
28 {__ASSERT(iType==EInt64);return iVal.iInt64;}
29 inline const TReal32& RSqlLiteral::Real32() const
30 {__ASSERT(iType==EReal32);return iVal.iReal32;}
31 inline const TReal64& RSqlLiteral::Real64() const
32 {__ASSERT(iType==EReal64);return iVal.iReal64;}
33 inline const TTime& RSqlLiteral::Time() const
34 {__ASSERT(iType==ETime);return iVal.iTime;}
35 inline const TPtrC RSqlLiteral::DesC() const
36 {__ASSERT(iType==EPtr);return TPtrC(iVal.iPtr.iPtr,iVal.iPtr.iEnd-iVal.iPtr.iPtr);}
37 inline const TText* RSqlLiteral::Ptr() const
38 {__ASSERT(iType==EPtr);return iVal.iPtr.iPtr;}
39 inline const TText* RSqlLiteral::End() const
40 {__ASSERT(iType==EPtr);return iVal.iPtr.iEnd;}
41 inline const HBufC8& RSqlLiteral::Text8() const
42 {__ASSERT(iType==EBuf8);return *(const HBufC8*)iVal.iAlloc;}
43 inline const HBufC16& RSqlLiteral::Text16() const
44 {__ASSERT(iType==EBuf16);return *(const HBufC16*)iVal.iAlloc;}
45 inline const HMatcherPattern8& RSqlLiteral::Pattern8() const
46 {__ASSERT(iType==EPattern8);return *(const HMatcherPattern8*)iVal.iAlloc;}
47 inline const HMatcherPattern16& RSqlLiteral::Pattern16() const
48 {__ASSERT(iType==EPattern16);return *(const HMatcherPattern16*)iVal.iAlloc;}
49 inline const HBufC8& RSqlLiteral::Blob() const
50 {__ASSERT(iType==EBlob);return *(const HBufC8*)iVal.iAlloc;}
52 // Class RSqlColumnList
53 inline RSqlColumnList::RSqlColumnList()
54 :RArray<TPtrC>(EGranularity)
57 // Class CSqlSearchCondition
58 inline CSqlSearchCondition::TType CSqlSearchCondition::NodeType() const
60 inline CSqlMultiNode* CSqlSearchCondition::MultiNode()
61 {__ASSERT(iType==EAnd||iType==EOr);return STATIC_CAST(CSqlMultiNode*,this);}
62 inline CSqlNullPredicate* CSqlSearchCondition::NullPredicate()
63 {__ASSERT(iType==EIsNull||iType==EIsNotNull);return STATIC_CAST(CSqlNullPredicate*,this);}
64 inline CSqlCompPredicate* CSqlSearchCondition::CompPredicate()
65 {__ASSERT(iType==ELess||iType==ELessEqual||iType==EEqual||iType==EGreaterEqual||iType==EGreater||iType==ENotEqual);return STATIC_CAST(CSqlCompPredicate*,this);}
66 inline CSqlLikePredicate* CSqlSearchCondition::LikePredicate()
67 {__ASSERT(iType==ELike||iType==ENotLike);return STATIC_CAST(CSqlLikePredicate*,this);}
69 // Class CSqlMultiNode
70 inline TInt CSqlMultiNode::Count() const
71 {return iEnd-iLeaves;}
72 inline CSqlSearchCondition* CSqlMultiNode::SubNode(TInt aIndex) const
73 {__ASSERT(TUint(aIndex)<TUint(Count()));return iLeaves[aIndex];}
74 inline void CSqlMultiNode::SetSubNode(TInt aIndex,CSqlSearchCondition* aSearchCondition)
75 {__ASSERT(TUint(aIndex)<TUint(Count()));iLeaves[aIndex]=aSearchCondition;}
77 // Class CSqlBoundNode
78 inline TBool CSqlBoundNode::IsBound() const
80 inline TDbColNo CSqlBoundNode::ColNo() const
81 {__ASSERT(IsBound());return iColumn.iBound.iNumber;}
82 inline TDbColType CSqlBoundNode::ColType() const
83 {return iColumn.iBound.iType;}
85 // Class CSqlLiteralNode
86 inline const RSqlLiteral& CSqlLiteralNode::Value() const
88 inline RSqlLiteral& CSqlLiteralNode::Value()
92 inline const TDesC& CSqlQuery::Table() const
94 inline TBool CSqlQuery::HasColumnList() const
95 {return iColumns.Count()!=0;}
96 inline const RSqlColumnList& CSqlQuery::ColumnList() const
98 inline TBool CSqlQuery::HasSearchCondition() const
99 {return iSearchCondition!=0;}
100 inline CSqlSearchCondition& CSqlQuery::SearchCondition()
101 {__ASSERT(HasSearchCondition());return *iSearchCondition;}
102 inline CSqlSearchCondition* CSqlQuery::AdoptSearchCondition()
103 {__ASSERT(HasSearchCondition());CSqlSearchCondition* rr=iSearchCondition;iSearchCondition=0;return rr;}
104 inline TBool CSqlQuery::HasSortSpecification() const
105 {return iSortSpecification!=0;}
106 inline CDbKey& CSqlQuery::SortSpecification()
107 {__ASSERT(HasSortSpecification());return *iSortSpecification;}
109 // Class CSqlDMLStatement
110 inline CSqlQuery& CSqlDMLStatement::Query()
112 inline CSqlValues& CSqlDMLStatement::Values()
113 {__ASSERT(iValues);return *iValues;}
114 inline CSqlValues* CSqlDMLStatement::AdoptValues()
115 {__ASSERT(iValues);CSqlValues* v=iValues;iValues=NULL;return v;}
116 inline TBool CSqlDMLStatement::HasValues() const
117 {return iValues!=NULL;}
119 // Class CSqlModifyStatement
120 inline TBool CSqlModifyStatement::IsUpdate() const
121 {return HasValues();}
125 inline Sql::TStatementType TSqlParser2::StatementType() const
127 return iStatementType;
130 inline const TDesC& TSqlParser2::TableName() const
135 inline static void HexDecodeL(const TDesC& aHex, RBuf8& aOutput)
137 TUint len = (TUint)aHex.Length();
139 // allocate buffer for result
140 aOutput.CreateL(len / 2);
144 TLex extractor(aHex);
147 while (!extractor.Eos())
154 User::Leave(KErrArgument);
157 converter.Assign(extractor.MarkedToken());
158 TInt err = converter.Val(val, EHex);
159 User::LeaveIfError(err);
162 aOutput.Append(&val, 1);