85
|
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:
|
|
15 |
*
|
|
16 |
*/
|
86
|
17 |
#include "casqlitestorage.h"
|
85
|
18 |
#include "caconsts.h"
|
|
19 |
#include "casqlcommands.h"
|
|
20 |
#include "casqlquery.h"
|
|
21 |
#include "casqlquerycreator.h"
|
|
22 |
#include "cainnerentry.h"
|
|
23 |
#include "cainnerquery.h"
|
|
24 |
#include "caarraycleanup.inl"
|
|
25 |
#include "calocalizationentry.h"
|
88
|
26 |
#include "cainternaltypes.h"
|
89
|
27 |
#include "cadef.h"
|
85
|
28 |
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
// CCASqLiteStorage::CCpStorageEngine()
|
|
31 |
//
|
|
32 |
// ---------------------------------------------------------------------------
|
|
33 |
//
|
|
34 |
CCaSqLiteStorage::CCaSqLiteStorage()
|
|
35 |
{
|
|
36 |
}
|
|
37 |
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
// CCASqLiteStorage::ConstructL()
|
|
40 |
//
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
void CCaSqLiteStorage::ConstructL()
|
|
44 |
{
|
86
|
45 |
User::LeaveIfError( iRfs.Connect() );
|
85
|
46 |
|
86
|
47 |
User::LeaveIfError( CreatePrivateDirPath( iPrivatePathCDriveDb, KCDrive,
|
|
48 |
KDbName ) );
|
85
|
49 |
|
86
|
50 |
User::LeaveIfError( CreatePrivateDirPath( iPrivatePathZDriveDb, KZDrive,
|
|
51 |
KDbName ) );
|
85
|
52 |
|
86
|
53 |
User::LeaveIfError( CreatePrivateDirPath( iPrivatePathCDrive, KCDrive,
|
|
54 |
KNullDesC ) );
|
89
|
55 |
|
85
|
56 |
|
86
|
57 |
if( iSqlDb.Open( iPrivatePathCDriveDb, &KSqlDbConfig ) )
|
85
|
58 |
{
|
86
|
59 |
//we could not load data base from C-drive lets try Rom
|
|
60 |
LoadDataBaseFromRomL();
|
|
61 |
}
|
89
|
62 |
else
|
|
63 |
{
|
|
64 |
TBuf<KCaMaxAttrNameLen> versionValue;
|
|
65 |
DbPropertyL(KCaDbPropVersion, versionValue);
|
|
66 |
ASSERT(versionValue.Length()>0);
|
|
67 |
if( versionValue.CompareC( KCaDbVersion ) )
|
|
68 |
{
|
|
69 |
// database loaded from C: is obsolete, load from Z:
|
|
70 |
iSqlDb.Close();
|
|
71 |
LoadDataBaseFromRomL();
|
|
72 |
}
|
|
73 |
}
|
86
|
74 |
}
|
85
|
75 |
|
86
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CCASqLiteStorage::NewL()
|
|
78 |
//
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
void CCaSqLiteStorage::LoadDataBaseFromRomL()
|
|
82 |
{
|
|
83 |
if( ( BaflUtils::FileExists( iRfs, iPrivatePathCDriveDb ) ) )
|
|
84 |
{
|
|
85 |
iSqlDb.Close();
|
|
86 |
User::LeaveIfError( BaflUtils::DeleteFile( iRfs,
|
|
87 |
iPrivatePathCDriveDb ) );
|
85
|
88 |
}
|
|
89 |
|
86
|
90 |
if( !( BaflUtils::FileExists( iRfs, iPrivatePathZDriveDb ) ) )
|
|
91 |
{
|
89
|
92 |
User::Panic( _L("fatal error - castorage.db not exists in ROM"),
|
86
|
93 |
KErrNotFound );
|
|
94 |
}
|
|
95 |
else
|
|
96 |
{
|
|
97 |
if( !( BaflUtils::FolderExists( iRfs, iPrivatePathCDrive ) ) )
|
|
98 |
{
|
|
99 |
User::LeaveIfError( iRfs.CreatePrivatePath( EDriveC ) );
|
|
100 |
}
|
|
101 |
User::LeaveIfError( BaflUtils::CopyFile( iRfs,
|
|
102 |
iPrivatePathZDriveDb, iPrivatePathCDrive ) );
|
|
103 |
User::LeaveIfError( iRfs.SetAtt( iPrivatePathCDriveDb,
|
|
104 |
KEntryAttNormal, KEntryAttReadOnly ) );
|
|
105 |
User::LeaveIfError( iSqlDb.Open( iPrivatePathCDriveDb,
|
|
106 |
&KSqlDbConfig ) );
|
|
107 |
}
|
85
|
108 |
}
|
|
109 |
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
// CCASqLiteStorage::NewL()
|
|
112 |
//
|
|
113 |
// ---------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
CCaSqLiteStorage* CCaSqLiteStorage::NewL()
|
|
116 |
{
|
|
117 |
CCaSqLiteStorage* self = CCaSqLiteStorage::NewLC();
|
|
118 |
CleanupStack::Pop( self );
|
|
119 |
return self;
|
|
120 |
}
|
|
121 |
|
|
122 |
// ---------------------------------------------------------------------------
|
|
123 |
// CCASqLiteStorage::NewLC()
|
|
124 |
//
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
CCaSqLiteStorage* CCaSqLiteStorage::NewLC()
|
|
128 |
{
|
|
129 |
CCaSqLiteStorage* self = new ( ELeave ) CCaSqLiteStorage();
|
|
130 |
CleanupStack::PushL( self );
|
|
131 |
self->ConstructL();
|
|
132 |
return self;
|
|
133 |
}
|
|
134 |
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
// CCASqLiteStorage::~CCpStorageEngine()
|
|
137 |
//
|
|
138 |
// ---------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
CCaSqLiteStorage::~CCaSqLiteStorage()
|
|
141 |
{
|
|
142 |
iSqlDb.Close();
|
86
|
143 |
iRfs.Close();
|
85
|
144 |
}
|
|
145 |
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
// CCaSqLiteStorage::CreatePrivateDirPath()
|
|
148 |
//
|
|
149 |
// ---------------------------------------------------------------------------
|
|
150 |
//
|
|
151 |
TInt CCaSqLiteStorage::CreatePrivateDirPath( TFileName& aPrivatePath,
|
86
|
152 |
const TDesC& aDrive, const TDesC& aDbName )
|
85
|
153 |
{
|
|
154 |
TInt error( KErrNone );
|
|
155 |
|
|
156 |
#ifdef CONTENT_ARSENAL_STORAGE_UT
|
|
157 |
TFileName KPathWithoutDrive( KDoubleSlash );
|
|
158 |
#else
|
|
159 |
TFileName KPathWithoutDrive;
|
86
|
160 |
error = iRfs.PrivatePath( KPathWithoutDrive );
|
85
|
161 |
if( error != KErrNone )
|
|
162 |
{
|
|
163 |
return error;
|
|
164 |
}
|
|
165 |
#endif
|
|
166 |
|
|
167 |
aPrivatePath.Copy( aDrive );
|
|
168 |
aPrivatePath.Append( KPathWithoutDrive );
|
|
169 |
aPrivatePath.Append( aDbName );
|
|
170 |
|
|
171 |
return error;
|
|
172 |
}
|
|
173 |
|
|
174 |
// ---------------------------------------------------------------------------
|
|
175 |
// CCASqLiteStorage::GetListL
|
|
176 |
//
|
|
177 |
// ---------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
void CCaSqLiteStorage::GetEntriesL( const CCaInnerQuery* aQuery,
|
|
180 |
RPointerArray<CCaInnerEntry>& aResultContainer )
|
|
181 |
{
|
|
182 |
// Fetch entries from
|
|
183 |
CCaSqlQuery* sqlGetEntriesQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
184 |
CaSqlQueryCreator::CreateGetEntriesQueryL( aQuery, sqlGetEntriesQuery );
|
|
185 |
sqlGetEntriesQuery->PrepareL();
|
|
186 |
sqlGetEntriesQuery->BindValuesForGetEntriesL( aQuery );
|
|
187 |
sqlGetEntriesQuery->ExecuteL( aResultContainer, CCaSqlQuery::EEntry );
|
|
188 |
CleanupStack::PopAndDestroy( sqlGetEntriesQuery );
|
|
189 |
|
|
190 |
// Populate the entries with their attributes
|
|
191 |
if( aResultContainer.Count() > 0 )
|
|
192 |
{
|
|
193 |
CCaSqlQuery* sqlGetAttributesQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
194 |
CaSqlQueryCreator::CreateGetAttributesQueryL(
|
|
195 |
aResultContainer.Count(), sqlGetAttributesQuery );
|
|
196 |
sqlGetAttributesQuery->PrepareL();
|
|
197 |
sqlGetAttributesQuery->BindEntryIdsL( aResultContainer );
|
|
198 |
sqlGetAttributesQuery->ExecuteL( aResultContainer,
|
|
199 |
CCaSqlQuery::EAttribute );
|
|
200 |
CleanupStack::PopAndDestroy( sqlGetAttributesQuery );
|
|
201 |
}
|
88
|
202 |
|
85
|
203 |
// set entries if proper order if they were fetched by ids
|
|
204 |
if( aQuery->GetIds().Count() > 0 )
|
|
205 |
{
|
|
206 |
SetEntriesInProperOrderL( aQuery->GetIds(), aResultContainer );
|
|
207 |
}
|
|
208 |
}
|
|
209 |
|
94
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
//
|
85
|
214 |
void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization )
|
|
215 |
{
|
|
216 |
CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb );
|
96
|
217 |
if( aLocalization.GetAttributeName().Compare( KColumnEnText ) == 0 )
|
|
218 |
{
|
|
219 |
CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery,
|
|
220 |
KSQLLocalizeTextEntry );
|
|
221 |
}
|
|
222 |
else if ( aLocalization.GetAttributeName().Compare(
|
|
223 |
KColumnEnDescription ) == 0 )
|
|
224 |
{
|
|
225 |
CaSqlQueryCreator::CreateLocalizationTableQueryL( sqlLocalizeEntryQuery,
|
|
226 |
KSQLLocalizeDescriptionEntry );
|
|
227 |
}
|
85
|
228 |
sqlLocalizeEntryQuery->PrepareL();
|
|
229 |
sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization );
|
|
230 |
sqlLocalizeEntryQuery->ExecuteL( );
|
|
231 |
CleanupStack::PopAndDestroy( sqlLocalizeEntryQuery );
|
|
232 |
}
|
|
233 |
|
94
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
// ---------------------------------------------------------------------------
|
|
237 |
//
|
|
238 |
void CCaSqLiteStorage::AddLocalizationL(
|
|
239 |
const CCaLocalizationEntry& aLocalization)
|
|
240 |
{
|
|
241 |
if (LocalizationEntryPresentL(aLocalization))
|
|
242 |
{
|
|
243 |
ExecuteLocalizationStatementL(aLocalization, KSQLUpdateLocalization);
|
|
244 |
}
|
|
245 |
else
|
|
246 |
{
|
|
247 |
ExecuteLocalizationStatementL(aLocalization, KSQLAddLocalization);
|
|
248 |
}
|
|
249 |
}
|
|
250 |
|
|
251 |
// ---------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
// ---------------------------------------------------------------------------
|
|
254 |
//
|
|
255 |
TBool CCaSqLiteStorage::LocalizationEntryPresentL(
|
|
256 |
const CCaLocalizationEntry& aLocalization)
|
|
257 |
{
|
|
258 |
TBool result(EFalse);
|
|
259 |
CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
260 |
CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlQuery,
|
|
261 |
KSQLGetLocalization);
|
|
262 |
sqlQuery->PrepareL();
|
|
263 |
sqlQuery->BindValuesForGetLocalizationEntryL( aLocalization );
|
|
264 |
result = sqlQuery->ExecuteEntryPresentL( );
|
|
265 |
CleanupStack::PopAndDestroy( sqlQuery );
|
|
266 |
return result;
|
|
267 |
}
|
|
268 |
|
|
269 |
// ---------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
// ---------------------------------------------------------------------------
|
|
272 |
//
|
|
273 |
void CCaSqLiteStorage::ExecuteLocalizationStatementL(
|
|
274 |
const CCaLocalizationEntry& aLocalization, const TDesC& aStatement)
|
|
275 |
{
|
|
276 |
CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
277 |
CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlQuery,aStatement );
|
|
278 |
sqlQuery->PrepareL();
|
|
279 |
sqlQuery->BindValuesForLocalizationEntryL( aLocalization );
|
|
280 |
sqlQuery->ExecuteL( );
|
|
281 |
CleanupStack::PopAndDestroy( sqlQuery );
|
|
282 |
}
|
|
283 |
|
|
284 |
// ---------------------------------------------------------------------------
|
|
285 |
//
|
|
286 |
// ---------------------------------------------------------------------------
|
|
287 |
//
|
86
|
288 |
void CCaSqLiteStorage::GetLocalizationsL(
|
|
289 |
RPointerArray<CCaLocalizationEntry>& aResultContainer )
|
85
|
290 |
{
|
|
291 |
CCaSqlQuery* sqlGetLocalizationsQuery = CCaSqlQuery::NewLC( iSqlDb );
|
94
|
292 |
CaSqlQueryCreator::CreateLocalizationTableQueryL(
|
|
293 |
sqlGetLocalizationsQuery, KSQLGetLocalizations );
|
85
|
294 |
sqlGetLocalizationsQuery->PrepareL();
|
|
295 |
sqlGetLocalizationsQuery->ExecuteLocalizationsL( aResultContainer );
|
|
296 |
CleanupStack::PopAndDestroy( sqlGetLocalizationsQuery );
|
|
297 |
}
|
|
298 |
|
|
299 |
// ---------------------------------------------------------------------------
|
|
300 |
// CCASqLiteStorage::GetEntriesIdsL
|
|
301 |
//
|
|
302 |
// ---------------------------------------------------------------------------
|
|
303 |
//
|
86
|
304 |
void CCaSqLiteStorage::GetEntriesIdsL( const CCaInnerQuery* aQuery,
|
85
|
305 |
RArray<TInt>& aResultIdArray )
|
|
306 |
{
|
|
307 |
CCaSqlQuery* sqlGetEntriesIdsQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
308 |
CaSqlQueryCreator::CreateGetEntriesQueryL( aQuery,
|
|
309 |
sqlGetEntriesIdsQuery );
|
|
310 |
sqlGetEntriesIdsQuery->PrepareL();
|
|
311 |
sqlGetEntriesIdsQuery->BindValuesForGetEntriesL( aQuery );
|
|
312 |
sqlGetEntriesIdsQuery->ExecuteL( aResultIdArray,
|
|
313 |
CCaSqlQuery::EEntryTable );
|
|
314 |
CleanupStack::PopAndDestroy( sqlGetEntriesIdsQuery );
|
|
315 |
}
|
|
316 |
|
|
317 |
// ---------------------------------------------------------------------------
|
|
318 |
// CCASqLiteStorage::GetEntriesIdsL
|
|
319 |
//
|
|
320 |
// ---------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
void CCaSqLiteStorage::GetParentsIdsL( const RArray<TInt>& aEntryIdArray,
|
98
|
323 |
RArray<TInt>& aParentIdArray, TBool aCheckParentsParent )
|
85
|
324 |
{
|
|
325 |
CCaSqlQuery* sqlGetParentIdsQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
326 |
CaSqlQueryCreator::CreateGetParentsIdsQueryL( aEntryIdArray,
|
|
327 |
sqlGetParentIdsQuery, aParentIdArray );
|
|
328 |
sqlGetParentIdsQuery->PrepareL();
|
|
329 |
sqlGetParentIdsQuery->BindIdsL( aEntryIdArray, KSQLGEEntryId );
|
|
330 |
if( aParentIdArray.Count() > 0 )
|
|
331 |
{
|
|
332 |
sqlGetParentIdsQuery->BindIdsL( aParentIdArray, KSQLGEIdGroup );
|
|
333 |
}
|
|
334 |
TInt parentCount = sqlGetParentIdsQuery->ExecuteL( aParentIdArray,
|
|
335 |
CCaSqlQuery::EGroupTable );
|
|
336 |
CleanupStack::PopAndDestroy( sqlGetParentIdsQuery );
|
98
|
337 |
if( aCheckParentsParent && parentCount > 0 )
|
85
|
338 |
{
|
|
339 |
GetParentsIdsL( aParentIdArray, aParentIdArray );
|
|
340 |
}
|
|
341 |
}
|
|
342 |
|
|
343 |
// ---------------------------------------------------------------------------
|
|
344 |
// CCASqLiteStorage::AddL
|
|
345 |
//
|
|
346 |
// ---------------------------------------------------------------------------
|
|
347 |
//
|
|
348 |
void CCaSqLiteStorage::AddL( CCaInnerEntry* aEntry, TBool aUpdate)
|
|
349 |
{
|
|
350 |
RPointerArray<CCaSqlQuery> sqlQueries;
|
|
351 |
CleanupResetAndDestroyPushL( sqlQueries );
|
|
352 |
|
|
353 |
CaSqlQueryCreator::CreateAddQueryL( aEntry, sqlQueries, iSqlDb );
|
|
354 |
|
|
355 |
ExecuteStatementL( KSqlStatementBegin );
|
|
356 |
TRAPD( err, ExecuteAddL( aEntry, sqlQueries ) );
|
|
357 |
if( err )
|
|
358 |
{
|
|
359 |
ExecuteStatementL( KSqlStatementRollback );
|
|
360 |
User::Leave( err );
|
|
361 |
}
|
|
362 |
ExecuteStatementL( KSqlStatementCommit );
|
|
363 |
|
|
364 |
CleanupStack::PopAndDestroy( &sqlQueries );
|
86
|
365 |
|
85
|
366 |
if( aUpdate )
|
|
367 |
{
|
|
368 |
RemoveFromLocalizationL( aEntry->GetId() );
|
|
369 |
}
|
|
370 |
}
|
|
371 |
|
|
372 |
// ---------------------------------------------------------------------------
|
|
373 |
// CCASqLiteStorage::RemoveL
|
|
374 |
//
|
|
375 |
// ---------------------------------------------------------------------------
|
|
376 |
//
|
|
377 |
void CCaSqLiteStorage::RemoveL( const RArray<TInt>& aEntryIds )
|
|
378 |
{
|
|
379 |
ExecuteStatementL( KSqlStatementBegin );
|
|
380 |
TRAPD( err, ExecuteRemoveL( aEntryIds ) );
|
|
381 |
if( err )
|
|
382 |
{
|
|
383 |
ExecuteStatementL( KSqlStatementRollback );
|
|
384 |
User::Leave( err );
|
|
385 |
}
|
|
386 |
ExecuteStatementL( KSqlStatementCommit );
|
|
387 |
}
|
|
388 |
|
|
389 |
// ---------------------------------------------------------------------------
|
86
|
390 |
// CCASqLiteStorage::OrganizeL( const RArray<TInt>& aEntryIds,
|
85
|
391 |
// TCaOperationParams aParams )
|
|
392 |
//
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
//
|
|
395 |
void CCaSqLiteStorage::OrganizeL( const RArray<TInt>& aEntryIds,
|
|
396 |
TCaOperationParams aParams )
|
|
397 |
{
|
|
398 |
ExecuteStatementL( KSqlStatementBegin );
|
|
399 |
TRAPD( err, ExecuteOrganizeL( aEntryIds, aParams ) );
|
|
400 |
if( err )
|
|
401 |
{
|
|
402 |
ExecuteStatementL( KSqlStatementRollback );
|
|
403 |
User::Leave( err );
|
|
404 |
}
|
|
405 |
ExecuteStatementL( KSqlStatementCommit );
|
|
406 |
}
|
|
407 |
|
|
408 |
// ---------------------------------------------------------------------------
|
|
409 |
// CCASqLiteStorage::TouchL( const TInt aEntryId )
|
|
410 |
//
|
|
411 |
// ---------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
void CCaSqLiteStorage::TouchL( const TInt aEntryId )
|
|
414 |
{
|
|
415 |
ExecuteStatementL( KSqlStatementBegin );
|
|
416 |
TRAPD( err, ExecuteTouchL( aEntryId ) );
|
|
417 |
if( err )
|
|
418 |
{
|
|
419 |
ExecuteStatementL( KSqlStatementRollback );
|
|
420 |
User::Leave( err );
|
|
421 |
}
|
|
422 |
ExecuteStatementL( KSqlStatementCommit );
|
|
423 |
}
|
|
424 |
|
|
425 |
// ---------------------------------------------------------------------------
|
86
|
426 |
// CCASqLiteStorage::DbPropertyL
|
|
427 |
// ( const TDesC& aProperty, TDes& aPropertyValue )
|
85
|
428 |
// ---------------------------------------------------------------------------
|
|
429 |
//
|
|
430 |
void CCaSqLiteStorage::DbPropertyL( const TDesC& aProperty,
|
|
431 |
TDes& aPropertyValue )
|
|
432 |
{
|
|
433 |
ExecuteStatementL( KSqlStatementBegin );
|
|
434 |
TRAPD( err, ExecuteDbPropertyL( aProperty, aPropertyValue ) );
|
|
435 |
if( err )
|
|
436 |
{
|
|
437 |
ExecuteStatementL( KSqlStatementRollback );
|
|
438 |
User::Leave( err );
|
|
439 |
}
|
|
440 |
ExecuteStatementL( KSqlStatementCommit );
|
|
441 |
}
|
|
442 |
|
|
443 |
// ---------------------------------------------------------------------------
|
86
|
444 |
// CCASqLiteStorage::SetDBPropertyL
|
|
445 |
// ( const TDesC& aProperty, const TDesC& aPropertyValue )
|
85
|
446 |
// ---------------------------------------------------------------------------
|
|
447 |
//
|
|
448 |
void CCaSqLiteStorage::SetDBPropertyL( const TDesC& aProperty,
|
|
449 |
const TDesC& aPropertyValue )
|
|
450 |
{
|
|
451 |
ExecuteStatementL( KSqlStatementBegin );
|
|
452 |
TRAPD( err, ExecuteSetDbPropertyL( aProperty, aPropertyValue ) );
|
|
453 |
if( err )
|
|
454 |
{
|
|
455 |
ExecuteStatementL( KSqlStatementRollback );
|
|
456 |
User::Leave( err );
|
|
457 |
}
|
|
458 |
ExecuteStatementL( KSqlStatementCommit );
|
|
459 |
}
|
|
460 |
|
|
461 |
// ---------------------------------------------------------------------------
|
|
462 |
// CCaSqLiteStorage::RemoveFromLocalizationL( const TInt aEntryId )
|
|
463 |
//
|
|
464 |
// ---------------------------------------------------------------------------
|
|
465 |
//
|
|
466 |
void CCaSqLiteStorage::RemoveFromLocalizationL( const TInt aEntryId )
|
|
467 |
{
|
|
468 |
ExecuteStatementL( KSqlStatementBegin );
|
|
469 |
TRAPD( err, ExecuteRemoveFromLocalizationL( aEntryId ) );
|
|
470 |
if( err )
|
|
471 |
{
|
|
472 |
ExecuteStatementL( KSqlStatementRollback );
|
|
473 |
User::Leave( err );
|
|
474 |
}
|
|
475 |
ExecuteStatementL( KSqlStatementCommit );
|
|
476 |
}
|
|
477 |
|
|
478 |
// ---------------------------------------------------------------------------
|
86
|
479 |
// CCaSqLiteStorage::CustomSortL
|
|
480 |
// ( const RArray<TInt>& aEntryIds, const TInt aGroupId )
|
85
|
481 |
// ---------------------------------------------------------------------------
|
|
482 |
//
|
|
483 |
void CCaSqLiteStorage::CustomSortL( const RArray<TInt>& aEntryIds,
|
|
484 |
const TInt aGroupId )
|
|
485 |
{
|
|
486 |
RPointerArray<CCaSqlQuery> sqlQueries;
|
|
487 |
CleanupResetAndDestroyPushL( sqlQueries );
|
|
488 |
|
86
|
489 |
CaSqlQueryCreator::CreateCustomSortQueryL(
|
|
490 |
aEntryIds, sqlQueries, iSqlDb );
|
85
|
491 |
|
|
492 |
ExecuteStatementL( KSqlStatementBegin );
|
|
493 |
TRAPD( err, ExecuteCustomSortL( aEntryIds, aGroupId, sqlQueries ) );
|
|
494 |
if( err )
|
|
495 |
{
|
|
496 |
ExecuteStatementL( KSqlStatementRollback );
|
|
497 |
User::Leave( err );
|
|
498 |
}
|
|
499 |
ExecuteStatementL( KSqlStatementCommit );
|
|
500 |
|
|
501 |
CleanupStack::PopAndDestroy( &sqlQueries );
|
|
502 |
}
|
|
503 |
|
|
504 |
// ---------------------------------------------------------------------------
|
86
|
505 |
// CCaSqLiteStorage::ExecuteCustomSortL
|
|
506 |
// ( const RArray<TInt>& aEntryIds, const TInt aGroupId )
|
85
|
507 |
// ---------------------------------------------------------------------------
|
|
508 |
//
|
|
509 |
void CCaSqLiteStorage::ExecuteCustomSortL( const RArray<TInt>& aEntryIds,
|
|
510 |
const TInt aGroupId , RPointerArray<CCaSqlQuery>& aSqlQuery )
|
|
511 |
{
|
|
512 |
for( TInt i = 0; i < aSqlQuery.Count(); i++ )
|
|
513 |
{
|
|
514 |
TInt newPosition = i + 1;
|
|
515 |
TInt entryId = aEntryIds[i];
|
86
|
516 |
|
85
|
517 |
aSqlQuery[i]->PrepareL();
|
|
518 |
aSqlQuery[i]->BindValuesForCustomSortL( aGroupId, entryId, newPosition );
|
|
519 |
aSqlQuery[i]->ExecuteL();
|
|
520 |
aSqlQuery[i]->CloseStatement();
|
|
521 |
}
|
|
522 |
}
|
|
523 |
|
|
524 |
// ---------------------------------------------------------------------------
|
|
525 |
// CCaSqLiteStorage::ExecuteRemoveFromLocalizationL( const TInt aEntryId )
|
|
526 |
//
|
|
527 |
// ---------------------------------------------------------------------------
|
|
528 |
//
|
|
529 |
void CCaSqLiteStorage::ExecuteRemoveFromLocalizationL( const TInt aEntryId )
|
|
530 |
{
|
|
531 |
CCaSqlQuery* query = CCaSqlQuery::NewLC( iSqlDb );
|
|
532 |
query->SetQueryL( KSQLDeleteLocalizationTextWhereEntryId );
|
|
533 |
query->PrepareL();
|
|
534 |
query->BindValuesForRemoveFromLocalizationL( aEntryId );
|
|
535 |
query->ExecuteL();
|
|
536 |
CleanupStack::PopAndDestroy( query );
|
|
537 |
}
|
|
538 |
|
|
539 |
// ---------------------------------------------------------------------------
|
|
540 |
// CCASqLiteStorage::ExecuteStatementL( const TDesC& aStatement )
|
|
541 |
//
|
|
542 |
// ---------------------------------------------------------------------------
|
|
543 |
//
|
|
544 |
void CCaSqLiteStorage::ExecuteStatementL( const TDesC& aStatement )
|
|
545 |
{
|
|
546 |
CCaSqlQuery* query = CCaSqlQuery::NewLC( iSqlDb );
|
|
547 |
query->SetQueryL( aStatement );
|
|
548 |
query->PrepareL();
|
|
549 |
query->ExecuteL();
|
|
550 |
CleanupStack::PopAndDestroy( query );
|
|
551 |
}
|
|
552 |
|
|
553 |
// ---------------------------------------------------------------------------
|
86
|
554 |
// CCASqLiteStorage::ExecuteAddL(CCaInnerEntry* aEntry,
|
85
|
555 |
// RPointerArray<CCASqlQuery>& sqlQuery)
|
|
556 |
//
|
|
557 |
// ---------------------------------------------------------------------------
|
|
558 |
//
|
86
|
559 |
void CCaSqLiteStorage::ExecuteAddL( CCaInnerEntry* aEntry,
|
85
|
560 |
RPointerArray<CCaSqlQuery>& aSqlQuery )
|
|
561 |
{
|
|
562 |
TBool isAttributeDeleted( EFalse );
|
|
563 |
for( TInt i = 0; i < aSqlQuery.Count(); i++ )
|
|
564 |
{
|
|
565 |
if( aSqlQuery[i]->Type() == CCaSqlQuery::EIconTable )
|
|
566 |
{
|
|
567 |
//check if icon exists - just update
|
|
568 |
CCaSqlQuery* query = CCaSqlQuery::NewLC( iSqlDb );
|
92
|
569 |
CaSqlQueryCreator::CreateFindIconQueryL(aEntry, query);
|
85
|
570 |
query->SetTableType( CCaSqlQuery::EIconTable );
|
|
571 |
query->PrepareL();
|
|
572 |
query->BindValuesForGetIconL( aEntry );
|
92
|
573 |
TInt idIcon( 0 );
|
|
574 |
query->ExecuteL( idIcon );
|
85
|
575 |
CleanupStack::PopAndDestroy( query );
|
86
|
576 |
|
85
|
577 |
aSqlQuery[i]->PrepareL();
|
|
578 |
aSqlQuery[i]->BindValuesForAddL( aEntry );
|
|
579 |
TInt tmpId( 0 );
|
|
580 |
TRAPD( err, tmpId = aSqlQuery[i]->ExecuteL() );
|
|
581 |
aSqlQuery[i]->CloseStatement();
|
92
|
582 |
if( !idIcon && !aEntry->GetIconId() )
|
85
|
583 |
{ // new icon added
|
|
584 |
aEntry->SetIconId( tmpId );
|
|
585 |
}
|
|
586 |
if( err == KSqlErrConstraint )
|
|
587 |
{
|
|
588 |
// ignore, this means that the icon cannot be removed
|
|
589 |
// because some other entry has the same icon.
|
|
590 |
}
|
|
591 |
else if( err )
|
|
592 |
{
|
|
593 |
User::Leave( err );
|
|
594 |
}
|
|
595 |
|
|
596 |
}
|
|
597 |
else if( aSqlQuery[i]->Type() == CCaSqlQuery::EEntryTable )
|
|
598 |
{
|
|
599 |
aSqlQuery[i]->PrepareL();
|
|
600 |
aSqlQuery[i]->BindValuesForAddL( aEntry );
|
|
601 |
TInt tmpId = aSqlQuery[i]->ExecuteL();
|
|
602 |
aSqlQuery[i]->CloseStatement();
|
|
603 |
if( !aEntry->GetId() )
|
|
604 |
{
|
|
605 |
// new entry added
|
|
606 |
aEntry->SetId( tmpId );
|
|
607 |
}
|
|
608 |
}
|
|
609 |
else if( !isAttributeDeleted
|
|
610 |
&& aSqlQuery[i]->Type() == CCaSqlQuery::EAttributeTable )
|
|
611 |
{
|
|
612 |
// delete all entry's attributes, just ones
|
|
613 |
aSqlQuery[i]->PrepareL();
|
|
614 |
aSqlQuery[i]->BindEntryIdL( aEntry->GetId() );
|
|
615 |
aSqlQuery[i]->ExecuteL();
|
|
616 |
aSqlQuery[i]->CloseStatement();
|
|
617 |
isAttributeDeleted = ETrue;
|
|
618 |
}
|
|
619 |
else if( aSqlQuery[i]->Type()==CCaSqlQuery::EAttributeTable )
|
|
620 |
{
|
|
621 |
// add new attribute(s) if it's neccesery
|
|
622 |
aSqlQuery[i]->PrepareL();
|
|
623 |
for( TInt k(0); k < aEntry->GetAttributes().Count(); k++ )
|
|
624 |
{
|
|
625 |
// if(id_entry, name) exist it'll replaced by new value
|
|
626 |
aSqlQuery[i]->BindValuesForAddAttributeL( aEntry,
|
|
627 |
aEntry->GetAttributes()[k] );
|
|
628 |
aSqlQuery[i]->ExecuteL();
|
|
629 |
aSqlQuery[i]->ResetStatement();
|
|
630 |
}
|
|
631 |
aSqlQuery[i]->CloseStatement();
|
|
632 |
}
|
|
633 |
}
|
|
634 |
}
|
|
635 |
// ---------------------------------------------------------------------------
|
|
636 |
// CCASqLiteStorage::ExecuteRemoveL( const RArray<TInt>& aEntryIds)
|
|
637 |
//
|
|
638 |
// ---------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
void CCaSqLiteStorage::ExecuteRemoveL( const RArray<TInt>& aEntryIds )
|
|
641 |
{
|
|
642 |
for( int i=0; i<aEntryIds.Count(); i++ )
|
|
643 |
{
|
|
644 |
// check if entry exist in database
|
|
645 |
CCaSqlQuery* queryEntry = CCaSqlQuery::NewLC( iSqlDb );
|
|
646 |
queryEntry->SetQueryL( KSQLGetEntryIdFromEntryTable );
|
|
647 |
queryEntry->PrepareL();
|
|
648 |
queryEntry->BindEntryIdL( aEntryIds[i] );
|
|
649 |
TInt entryCount( 0 );
|
|
650 |
queryEntry->ExecuteL( entryCount );
|
|
651 |
CleanupStack::PopAndDestroy( queryEntry );
|
|
652 |
if( !entryCount )
|
|
653 |
{
|
|
654 |
User::Leave( KErrNotFound );
|
|
655 |
}
|
|
656 |
|
|
657 |
// SELECT Id_Icon FROM CA_ENTRY WHERE Id = aEntryId;
|
|
658 |
CCaSqlQuery* queryIconId = CCaSqlQuery::NewLC( iSqlDb );
|
|
659 |
queryIconId->SetQueryL( KSQLGETIconIdFromEntryTable );
|
|
660 |
queryIconId->PrepareL();
|
|
661 |
queryIconId->BindEntryIdL( aEntryIds[i] );
|
|
662 |
TInt iconId( 0 );
|
|
663 |
queryIconId->ExecuteL( iconId );
|
|
664 |
CleanupStack::PopAndDestroy( queryIconId );
|
|
665 |
|
|
666 |
RPointerArray<CCaSqlQuery> sqlQuery;
|
|
667 |
CleanupResetAndDestroyPushL( sqlQuery );
|
|
668 |
CaSqlQueryCreator::CreateRemoveQueryL( sqlQuery, iSqlDb );
|
|
669 |
for( TInt j = 0; j < sqlQuery.Count(); j++ )
|
|
670 |
{
|
|
671 |
if( !( sqlQuery[j]->Type() == CCaSqlQuery::EIconTable &&
|
|
672 |
iconId == 0 ) )
|
|
673 |
{
|
|
674 |
sqlQuery[j]->PrepareL();
|
|
675 |
sqlQuery[j]->BindValuesForRemoveL( aEntryIds[i], iconId );
|
|
676 |
TRAPD( err, sqlQuery[j]->ExecuteL() );
|
|
677 |
sqlQuery[j]->CloseStatement();
|
|
678 |
|
|
679 |
if( sqlQuery[j]->Type() == CCaSqlQuery::EIconTable &&
|
|
680 |
err == KSqlErrConstraint )
|
|
681 |
{
|
|
682 |
// ignore, this means that the icon cannot be removed
|
|
683 |
// because some other entry has the same icon.
|
|
684 |
}
|
|
685 |
else if( err )
|
|
686 |
{
|
|
687 |
User::Leave( err );
|
|
688 |
}
|
|
689 |
}
|
|
690 |
}
|
|
691 |
CleanupStack::PopAndDestroy( &sqlQuery );
|
|
692 |
}
|
|
693 |
}
|
|
694 |
|
|
695 |
// ---------------------------------------------------------------------------
|
|
696 |
// CCASqLiteStorage::ExecuteOrganizeL(const RArray<TInt>& aEntryIds,
|
|
697 |
// TCaOperationParams aParams)
|
|
698 |
//
|
|
699 |
// ---------------------------------------------------------------------------
|
|
700 |
//
|
|
701 |
void CCaSqLiteStorage::ExecuteOrganizeL( const RArray<TInt>& aEntryIds,
|
|
702 |
TCaOperationParams aParams )
|
|
703 |
{
|
|
704 |
VerifyOrganizeParamsL( aEntryIds, aParams );
|
|
705 |
|
|
706 |
RPointerArray<CCaSqlQuery> sqlQueries;
|
|
707 |
CleanupResetAndDestroyPushL( sqlQueries );
|
|
708 |
|
|
709 |
TBool revereseInsertOrder = CaSqlQueryCreator::CreateOrganizeQueryL(
|
|
710 |
aEntryIds, aParams, iSqlDb, sqlQueries );
|
|
711 |
|
|
712 |
for( TInt i = 0; i < sqlQueries.Count(); i++ )
|
|
713 |
{
|
|
714 |
switch( sqlQueries[i]->Type() )
|
|
715 |
{
|
|
716 |
case CCaSqlQuery::EGroupTableRemove:
|
|
717 |
{
|
|
718 |
sqlQueries[i]->PrepareL();
|
|
719 |
sqlQueries[i]->BindValuesForOrganizeL( aEntryIds, aParams );
|
|
720 |
sqlQueries[i]->ExecuteL();
|
|
721 |
sqlQueries[i]->CloseStatement();
|
|
722 |
}
|
|
723 |
break;
|
|
724 |
|
|
725 |
case CCaSqlQuery::EGroupTableInsert:
|
|
726 |
{
|
|
727 |
sqlQueries[i]->PrepareL();
|
|
728 |
for( TInt j = 0; j < aEntryIds.Count(); j++ )
|
|
729 |
{
|
86
|
730 |
TInt k = (revereseInsertOrder) ?
|
85
|
731 |
(aEntryIds.Count() - 1) - j : j;
|
86
|
732 |
sqlQueries[i]->BindValuesForOrganizeL(
|
85
|
733 |
aEntryIds, aParams, aEntryIds[k] );
|
|
734 |
sqlQueries[i]->ExecuteL();
|
|
735 |
sqlQueries[i]->ResetStatement();
|
|
736 |
}
|
|
737 |
sqlQueries[i]->CloseStatement();
|
|
738 |
}
|
|
739 |
break;
|
|
740 |
}
|
|
741 |
}
|
|
742 |
|
|
743 |
CleanupStack::PopAndDestroy( &sqlQueries );
|
|
744 |
}
|
|
745 |
|
|
746 |
// ---------------------------------------------------------------------------
|
|
747 |
// CCASqLiteStorage::ExecuteTouchL( const TInt aEntryId )
|
|
748 |
//
|
|
749 |
// ---------------------------------------------------------------------------
|
|
750 |
//
|
|
751 |
void CCaSqLiteStorage::ExecuteTouchL( const TInt aEntryId )
|
|
752 |
{
|
|
753 |
RPointerArray<CCaSqlQuery> sqlQuery;
|
|
754 |
CleanupResetAndDestroyPushL( sqlQuery );
|
|
755 |
|
|
756 |
CaSqlQueryCreator::CreateTouchQueryL( sqlQuery, iSqlDb );
|
|
757 |
|
|
758 |
TTime time;
|
|
759 |
time.UniversalTime();
|
|
760 |
|
|
761 |
for( TInt i = 0; i < sqlQuery.Count(); i++ )
|
|
762 |
{
|
|
763 |
sqlQuery[i]->PrepareL();
|
|
764 |
sqlQuery[i]->BindValuesForLaunchL( aEntryId, time.Int64() );
|
|
765 |
sqlQuery[i]->ExecuteL();
|
|
766 |
sqlQuery[i]->CloseStatement();
|
|
767 |
}
|
|
768 |
|
|
769 |
CleanupStack::PopAndDestroy( &sqlQuery );
|
|
770 |
}
|
|
771 |
|
|
772 |
// ---------------------------------------------------------------------------
|
|
773 |
// ExecuteDbPropertyL( const TDesC& aProperty, TDes& aPropertyValue )
|
|
774 |
//
|
|
775 |
// ---------------------------------------------------------------------------
|
|
776 |
//
|
|
777 |
void CCaSqLiteStorage::ExecuteDbPropertyL( const TDesC& aProperty,
|
|
778 |
TDes& aPropertyValue )
|
|
779 |
{
|
|
780 |
CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
781 |
sqlQuery->SetQueryL( KSQLGetProperty );
|
|
782 |
sqlQuery->PrepareL();
|
|
783 |
sqlQuery->BindValuesForPropertyL( aProperty );
|
|
784 |
sqlQuery->ExecutePropertyL( aPropertyValue );
|
|
785 |
sqlQuery->CloseStatement();
|
|
786 |
CleanupStack::PopAndDestroy( sqlQuery );
|
|
787 |
}
|
|
788 |
|
|
789 |
// ---------------------------------------------------------------------------
|
|
790 |
// ExecuteSetDbPropertyL( const TDesC& aProperty, const TDesC& aPropertyValue )
|
|
791 |
//
|
|
792 |
// ---------------------------------------------------------------------------
|
|
793 |
//
|
|
794 |
void CCaSqLiteStorage::ExecuteSetDbPropertyL( const TDesC& aProperty,
|
|
795 |
const TDesC& aPropertyValue )
|
|
796 |
{
|
|
797 |
CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
798 |
sqlQuery->SetQueryL( KSQLUpdateProperty );
|
|
799 |
sqlQuery->PrepareL();
|
|
800 |
sqlQuery->BindValuesForPropertyUpdateL( aProperty, aPropertyValue );
|
|
801 |
sqlQuery->ExecuteL();
|
|
802 |
sqlQuery->CloseStatement();
|
|
803 |
CleanupStack::PopAndDestroy( sqlQuery );
|
|
804 |
}
|
|
805 |
|
|
806 |
|
|
807 |
// ---------------------------------------------------------------------------
|
|
808 |
// CCASqLiteStorage::RemoveOldEntriesFromLaunchTableL( TInt aDays )
|
|
809 |
//
|
|
810 |
// ---------------------------------------------------------------------------
|
|
811 |
//
|
|
812 |
void CCaSqLiteStorage::RemoveOldEntriesFromLaunchTableL( TInt aDays )
|
|
813 |
{
|
|
814 |
TTime presentTime;
|
|
815 |
presentTime.UniversalTime();
|
|
816 |
TTime borderTime = presentTime - ( TTimeIntervalDays( aDays ) );
|
|
817 |
|
|
818 |
CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb );
|
|
819 |
sqlQuery->SetQueryL( KSQLDeleteOldFromLaunch );
|
|
820 |
sqlQuery->PrepareL();
|
|
821 |
sqlQuery->BindValuesForLaunchL( 0, borderTime.Int64() );
|
|
822 |
sqlQuery->ExecuteL();
|
|
823 |
|
|
824 |
CleanupStack::PopAndDestroy( sqlQuery );
|
|
825 |
}
|
|
826 |
|
|
827 |
// ---------------------------------------------------------------------------
|
|
828 |
// CCASqLiteStorage::VerifyOrganizeParamsL( const RArray<TInt>& aEntryIds,
|
|
829 |
// TCaOperationParams aParams);
|
|
830 |
//
|
|
831 |
// ---------------------------------------------------------------------------
|
|
832 |
//
|
|
833 |
void CCaSqLiteStorage::VerifyOrganizeParamsL( const RArray<TInt>& aEntryIds,
|
|
834 |
TCaOperationParams aParams )
|
|
835 |
{
|
|
836 |
switch( aParams.iOperationType )
|
|
837 |
{
|
|
838 |
case TCaOperationParams::ERemove:
|
|
839 |
{
|
|
840 |
CCaSqlQuery * query = CCaSqlQuery::NewLC( iSqlDb );
|
|
841 |
CaSqlQueryCreator::PopulateQueryWithIdListL( aEntryIds.Count(),
|
|
842 |
query, KSQLOrganizeGetEntryIdCountFromGroup );
|
|
843 |
|
|
844 |
query->PrepareL();
|
|
845 |
query->BindValuesForOrganizeL( aEntryIds, aParams );
|
|
846 |
TInt dbEntryCount;
|
|
847 |
query->ExecuteL( dbEntryCount );
|
|
848 |
query->CloseStatement();
|
|
849 |
if( dbEntryCount < aEntryIds.Count() )
|
|
850 |
{
|
|
851 |
User::Leave( KErrArgument );
|
|
852 |
}
|
|
853 |
|
|
854 |
CleanupStack::PopAndDestroy( query );
|
|
855 |
break;
|
|
856 |
}
|
|
857 |
case TCaOperationParams::EInsert:
|
|
858 |
{
|
|
859 |
CCaSqlQuery * query = CCaSqlQuery::NewLC( iSqlDb );
|
|
860 |
CaSqlQueryCreator::PopulateQueryWithIdListL( 1, query,
|
|
861 |
KSQLOrganizeGetEntryIdCountFromGroup );
|
|
862 |
RArray<TInt> id;
|
|
863 |
CleanupClosePushL( id );
|
|
864 |
id.AppendL( aParams.iBeforeEntryId );
|
|
865 |
|
|
866 |
query->PrepareL();
|
|
867 |
query->BindValuesForOrganizeL( id, aParams );
|
|
868 |
TInt dbEntryCount;
|
|
869 |
query->ExecuteL( dbEntryCount );
|
|
870 |
query->CloseStatement();
|
|
871 |
if( dbEntryCount == 0 )
|
|
872 |
{
|
|
873 |
User::Leave( KErrArgument );
|
|
874 |
}
|
|
875 |
|
|
876 |
CleanupStack::PopAndDestroy( &id );
|
|
877 |
CleanupStack::PopAndDestroy( query );
|
|
878 |
break;
|
|
879 |
}
|
|
880 |
case TCaOperationParams::EPrepend:
|
|
881 |
case TCaOperationParams::EAppend:
|
|
882 |
default:
|
|
883 |
{
|
|
884 |
break;
|
|
885 |
}
|
|
886 |
}
|
|
887 |
}
|
|
888 |
|
|
889 |
// ---------------------------------------------------------------------------
|
|
890 |
// CCASqLiteStorage::SetEntriesInProperOrderL
|
|
891 |
// ---------------------------------------------------------------------------
|
|
892 |
//
|
|
893 |
void CCaSqLiteStorage::SetEntriesInProperOrderL(
|
|
894 |
const RArray<TInt>& aEntryIds,
|
|
895 |
RPointerArray<CCaInnerEntry>& aResultContainer )
|
|
896 |
{
|
|
897 |
for( TInt i = 0; i < aEntryIds.Count(); i++ )
|
|
898 |
{
|
|
899 |
for( TInt j = i + 1; j < aResultContainer.Count(); j++ )
|
|
900 |
{
|
|
901 |
if( aEntryIds[i] == aResultContainer[j]->GetId() )
|
|
902 |
{
|
|
903 |
CCaInnerEntry* temporary( NULL );
|
|
904 |
temporary = aResultContainer[i];
|
|
905 |
aResultContainer[i] = aResultContainer[j];
|
|
906 |
aResultContainer[j] = temporary;
|
|
907 |
break;
|
|
908 |
}
|
|
909 |
}
|
|
910 |
}
|
|
911 |
}
|
|
912 |
|
98
|
913 |
|