|
1 // Copyright (c) 2002-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 #ifndef __LOGFILTQ__ |
|
17 #define __LOGFILTQ__ |
|
18 |
|
19 #include <badesca.h> |
|
20 #include <logwrap.h> |
|
21 #include "LogDynBuf.h" |
|
22 #include "LogCliServShared.h" |
|
23 |
|
24 // Classes referenced |
|
25 class CLogFilter; |
|
26 class CLogFilterList; |
|
27 class MLogServDatabaseTransactionInterface; |
|
28 |
|
29 /** |
|
30 This class provides only one public method (apart from constructor) - BuildExprLC(). |
|
31 BuildExprLC() accepts as an input parameter a list with view filters and constructs from them |
|
32 a "WHERE" SQL expression that is returned to the caller into the RLogDynBuf output parameter. |
|
33 |
|
34 @see CLogFilterList |
|
35 @see RLogDynBuf |
|
36 @see MLogServDatabaseTransactionInterface |
|
37 @internalComponent |
|
38 */ |
|
39 class TLogFilterExprBuilder |
|
40 { |
|
41 public: |
|
42 TLogFilterExprBuilder(MLogServDatabaseTransactionInterface& aDatabase); |
|
43 void BuildExprLC(RLogDynBuf& aExpr, const CLogFilterList& aFilterList, const TDesC& aInitial, |
|
44 TLogFilterConstructionType aType = ELogFilterConstructFilterByFilterFieldByField); |
|
45 |
|
46 private: |
|
47 void DoNextProcessFilterByFilterFieldByFieldL(RLogDynBuf& aExpr); |
|
48 void DoNextProcessFieldByFieldFilterByFilterL(RLogDynBuf& aExpr); |
|
49 void MakePredicatesL(); |
|
50 void MakeConditionL(RLogDynBuf& aExpr); |
|
51 void MakeFlagPredicatesL(); |
|
52 const TDesC& ColumnName() const; |
|
53 void MakeNullPredicate(TDes& aDes); |
|
54 void MakePredicateL(TDes& aDes, const CLogFilter& aFilter); |
|
55 TBool IsDuplicateNullField() const; |
|
56 TBool IsDuplicateField(const CLogFilter& aFilter) const; |
|
57 TBool IsFieldEmpty(const CLogFilter& aFilter) const; |
|
58 TBool IsDuplicate(const CLogFilter& aFilter1, const CLogFilter& aFilter2) const; |
|
59 void Invariant() const; |
|
60 |
|
61 private: |
|
62 MLogServDatabaseTransactionInterface& iDatabase; |
|
63 const CLogFilterList* iFilterList; |
|
64 const TDesC* iInitial; |
|
65 TLogFilterConstructionType iConstructionType; |
|
66 TInt iFilterIndex; |
|
67 TUint16 iField; //It must be 16-bit. The iField value is read from a resource file. |
|
68 //See CLogServRecentCondition::ConstructL() implementation. |
|
69 //The iField type width then restricts the max number of field macro values - |
|
70 //ELogContactField...ELogSimIdField. |
|
71 TInt iFlagIndex; |
|
72 CDesCArrayFlat* iPredicateList; |
|
73 }; |
|
74 |
|
75 #endif |