1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: SQL clause handling class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef C_CMSQLDBCLAUSE_H |
|
25 #define C_CMSQLDBCLAUSE_H |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 /** |
|
30 * CCmSqlDbClause class |
|
31 * Part of SQL wrapper. SQL wrapper is part of |
|
32 * Content manager component.CCmSqlDbClause formats needed sql clauses |
|
33 * |
|
34 * @lib cmsqlwrapper.lib |
|
35 * |
|
36 * @since S60 v3.1 |
|
37 */ |
|
38 class CCmSqlDbClause : public CBase |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CCmSqlDbClause* NewL(); |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 */ |
|
51 static CCmSqlDbClause* NewLC(); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 virtual ~CCmSqlDbClause(); |
|
57 |
|
58 public: |
|
59 |
|
60 /** |
|
61 * Starts to generate sql query clause according to |
|
62 * fill rule and fill method |
|
63 * |
|
64 * @since S60 5.1 |
|
65 * @param aRule, fill rule |
|
66 * @param aField, metadata field |
|
67 * @param aMedia, media type |
|
68 * @return None |
|
69 */ |
|
70 void FormatClauseL( CCmFillRule& aRule, |
|
71 TCmMetadataField aField = ECmNone, TCmMediaType aMedia = ECmAll ); |
|
72 |
|
73 /** |
|
74 * Starts to generate sql query clause according to |
|
75 * property collector |
|
76 * |
|
77 * @since S60 5.1 |
|
78 * @param aPropertys, propertys to be filtered |
|
79 * @return None |
|
80 */ |
|
81 void FormatFilteringClauseL( CCmSqlPropertyCollector& aPropertys ); |
|
82 |
|
83 /** |
|
84 * Returns sql clause |
|
85 * |
|
86 * @since S60 5.1 |
|
87 * @param None |
|
88 * @return iClause, reference |
|
89 */ |
|
90 TDesC8& ClauseL() const; |
|
91 |
|
92 /** |
|
93 * Sets profile filters |
|
94 * |
|
95 * @since S60 5.1 |
|
96 * @param aProfileIds, profile ids |
|
97 * @return None |
|
98 */ |
|
99 void SetDlnaProfileFilters( const RArray<TInt64>& aProfileIds ); |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * Formats fill rules media type into sql clause |
|
105 * @param aRule, fill rule |
|
106 * |
|
107 * @since S60 5.1 |
|
108 * @return None |
|
109 */ |
|
110 void FormatMediatypeL( CCmFillRule& aRule ); |
|
111 |
|
112 /** |
|
113 * Formats fill rule params into sql clause |
|
114 * |
|
115 * @since S60 5.1 |
|
116 * @param aRule, fill rule |
|
117 * @return None |
|
118 */ |
|
119 void FormatParamsL( CCmFillRule& aRule ); |
|
120 |
|
121 /** |
|
122 * Formats fill rule media servers into sql clause |
|
123 * |
|
124 * @since S60 5.1 |
|
125 * @param aRule, fill rule |
|
126 * @return None |
|
127 */ |
|
128 void FormatDevicesL( CCmFillRule& aRule ); |
|
129 |
|
130 /** |
|
131 * Formats fill rule query result ordering into sql clause |
|
132 * |
|
133 * @since S60 5.1 |
|
134 * @param aMethod, ordering method |
|
135 * @return None |
|
136 */ |
|
137 void FormatOrderingL( TCmFillMethod aMethod ); |
|
138 |
|
139 /** |
|
140 * Formats fill rule query amount into sql clause |
|
141 * |
|
142 * @since S60 5.1 |
|
143 * @param aRule, fill rule |
|
144 * @return None |
|
145 */ |
|
146 void FormatAmountL( CCmFillRule& aRule ); |
|
147 |
|
148 /** |
|
149 * Formats fill rule metadata field into sql clause |
|
150 * |
|
151 * @since S60 5.1 |
|
152 * @param aField, metadata field to be set in query |
|
153 * @param aMediaType, media type of the fill list |
|
154 * @return None |
|
155 */ |
|
156 void FormatMetadataColumnL( TCmMetadataField aField, |
|
157 TCmMediaType aMediaType ); |
|
158 |
|
159 /** |
|
160 * Formats fill rule operator into sql clause |
|
161 * |
|
162 * @since S60 5.1 |
|
163 * @param aMetadataColum, metadata field to be set in query |
|
164 * @param aOper, operator of query results |
|
165 * @return None |
|
166 */ |
|
167 void FormatOperatorL( TCmMetadataField aMetadataColum, |
|
168 TCmOperatorType aOper ); |
|
169 |
|
170 /** |
|
171 * Formats property values query |
|
172 * |
|
173 * @since S60 5.1 |
|
174 * @param aField, identified property |
|
175 * @param aMedia, identified media type |
|
176 * @return None |
|
177 */ |
|
178 void FormatProperyQueryL( TCmMetadataField aField, |
|
179 TCmMediaType aMedia = ECmAll ); |
|
180 |
|
181 /** |
|
182 * Formats profile filters into sql clause |
|
183 * |
|
184 * @since S60 5.1 |
|
185 * @param None |
|
186 * @return None |
|
187 */ |
|
188 void FormatProfileFiltersL(); |
|
189 |
|
190 /** |
|
191 * Formats property filters into sql clause |
|
192 * |
|
193 * @since S60 5.1 |
|
194 * @param aPropertys, property collector |
|
195 * @return None |
|
196 */ |
|
197 void FormatPropertyFilterL( |
|
198 CCmSqlPropertyCollector& aPropertys ); |
|
199 |
|
200 /** |
|
201 * Adds property filters into sql clause |
|
202 * |
|
203 * @since S60 5.1 |
|
204 * @param aContainer, property container |
|
205 * @param aField, property field |
|
206 * @param aClause, clause to be modified |
|
207 * @return None |
|
208 */ |
|
209 void AddPropertyFilterL( |
|
210 CCmSqlPropertyContainer& aContainer, const TDesC8& aField, |
|
211 HBufC8*& aClause ); |
|
212 |
|
213 private: |
|
214 |
|
215 /** |
|
216 * Performs the first phase of two phase construction. |
|
217 */ |
|
218 CCmSqlDbClause(); |
|
219 |
|
220 /** |
|
221 * Performs the second phase construction. |
|
222 */ |
|
223 void ConstructL(); |
|
224 |
|
225 |
|
226 private: |
|
227 |
|
228 /** |
|
229 * Formated clause |
|
230 */ |
|
231 HBufC8* iClause; // Owned |
|
232 |
|
233 /** |
|
234 * Temporal free text clause |
|
235 */ |
|
236 HBufC8* iFreeText; // Owned |
|
237 |
|
238 /** |
|
239 * Profile ids which need to be filtered out |
|
240 */ |
|
241 RArray<TInt64> iProfileFilters; |
|
242 |
|
243 }; |
|
244 |
|
245 #endif // C_CMSQLDBCLAUSE_H |
|