1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
346 |
346 |
347 return retRecord; |
347 return retRecord; |
348 } |
348 } |
349 |
349 |
350 |
350 |
351 RPointerArray<CDecisionRecord> CUpsDbBaseStep::GetDecisionsL(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter, TBool aCancel) |
351 void CUpsDbBaseStep::GetDecisionsL(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter, TBool aCancel, RPointerArray<CDecisionRecord>& aRecordList) |
352 /** |
352 /** |
353 Get a set of decision records from the database. Uses multiple records lookup method (RDbView). |
353 Get a set of decision records from the database. Uses multiple records lookup method (RDbView). |
354 Prints the consumed time to perform this operation. |
354 Prints the consumed time to perform this operation. |
355 */ |
355 */ |
356 { |
356 { |
361 CDecisionView *dbView = aUpsDb.CreateViewL(aFilter); |
361 CDecisionView *dbView = aUpsDb.CreateViewL(aFilter); |
362 CleanupStack::PushL(dbView); |
362 CleanupStack::PushL(dbView); |
363 |
363 |
364 dbView->EvaluateView(iWaiter->iStatus); |
364 dbView->EvaluateView(iWaiter->iStatus); |
365 TInt num = 0; |
365 TInt num = 0; |
366 RPointerArray<CDecisionRecord> recordList; |
|
367 if(aCancel) |
366 if(aCancel) |
368 { |
367 { |
369 dbView->Cancel(); |
368 dbView->Cancel(); |
370 iWaiter->WaitActiveL(KErrCancel); |
369 iWaiter->WaitActiveL(KErrCancel); |
371 } |
370 } |
372 else |
371 else |
373 { |
372 { |
374 iWaiter->WaitActiveL(KErrNone); |
373 iWaiter->WaitActiveL(KErrNone); |
375 CleanupClosePushL(recordList); |
|
376 CDecisionRecord *record = NULL; |
374 CDecisionRecord *record = NULL; |
377 |
375 |
378 while((record = dbView->NextDecisionL()) != NULL) |
376 while((record = dbView->NextDecisionL()) != NULL) |
379 { |
377 { |
380 CleanupStack::PushL(record); |
378 CleanupStack::PushL(record); |
381 num++; |
379 num++; |
382 recordList.AppendL(record); |
380 aRecordList.AppendL(record); |
383 CleanupStack::Pop(record); |
381 CleanupStack::Pop(record); |
384 } |
382 } |
385 CleanupStack::Pop(&recordList); |
|
386 } |
383 } |
387 |
384 |
388 //Timer is stopped |
385 //Timer is stopped |
389 TInt64 elapsedTime = 0; |
386 TInt64 elapsedTime = 0; |
390 StopTimer(startTime,elapsedTime); |
387 StopTimer(startTime,elapsedTime); |
391 |
388 |
392 INFO_PRINTF3(_L("%d records retrieved in %Ld microseconds."), num, elapsedTime); |
389 INFO_PRINTF3(_L("%d records retrieved in %Ld microseconds."), num, elapsedTime); |
393 CleanupStack::PopAndDestroy(dbView); |
390 CleanupStack::PopAndDestroy(dbView); |
394 |
|
395 return recordList; |
|
396 } |
391 } |
397 |
392 |
398 |
393 |
399 void CUpsDbBaseStep::RemoveDecisionsL(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter) |
394 void CUpsDbBaseStep::RemoveDecisionsL(CDecisionDbW &aUpsDb, CDecisionFilter &aFilter) |
400 /** |
395 /** |
553 TInt policyVersion = 9; |
548 TInt policyVersion = 9; |
554 TInt recordId = 0; |
549 TInt recordId = 0; |
555 |
550 |
556 CDecisionRecord *record = NULL; |
551 CDecisionRecord *record = NULL; |
557 CDecisionFilter *filter = NULL; |
552 CDecisionFilter *filter = NULL; |
558 RPointerArray<CDecisionRecord> recordList; |
553 RPointerArray<CDecisionRecord> recordList; |
559 TBuf8<KUpsMaxFingerprintLength> bufFp; |
554 TBuf8<KUpsMaxFingerprintLength> bufFp; |
560 TBuf8<KUpsMaxClientEntityLength> bufCe; |
555 TBuf8<KUpsMaxClientEntityLength> bufCe; |
561 TBuf<KUpsDescriptionLength> bufDes; |
556 TBuf<KUpsDescriptionLength> bufDes; |
562 bufFp.SetLength(KUpsMaxFingerprintLength); |
557 bufFp.SetLength(KUpsMaxFingerprintLength); |
563 bufCe.SetLength(KUpsMaxClientEntityLength); |
558 bufCe.SetLength(KUpsMaxClientEntityLength); |
570 record = CreateRecordL(++clientId,++evaluatorId,++serviceId,++serverId, bufFp, bufCe, bufDes, result, policyVersion, evaluatorInfo, recordId); |
565 record = CreateRecordL(++clientId,++evaluatorId,++serviceId,++serverId, bufFp, bufCe, bufDes, result, policyVersion, evaluatorInfo, recordId); |
571 CleanupStack::PushL(record); |
566 CleanupStack::PushL(record); |
572 InsertRecordL(aUpsDb,*record); |
567 InsertRecordL(aUpsDb,*record); |
573 |
568 |
574 filter = CreateFilterLC(flag,clientId,evaluatorId,serviceId,serverId,bufFp,bufCe,policyVersion,recordId,bufDes,result,evaluatorInfo,EEqual); |
569 filter = CreateFilterLC(flag,clientId,evaluatorId,serviceId,serverId,bufFp,bufCe,policyVersion,recordId,bufDes,result,evaluatorInfo,EEqual); |
575 recordList = GetDecisionsL(aUpsDb,*filter,EFalse); |
570 CleanupResetAndDestroyPushL(recordList); |
|
571 GetDecisionsL(aUpsDb, *filter, EFalse, recordList); |
576 if(recordList.Count() != 1) |
572 if(recordList.Count() != 1) |
577 { |
573 { |
578 SetTestStepResult(EFail); |
574 SetTestStepResult(EFail); |
|
575 CleanupStack::PopAndDestroy(3,record); |
579 break; |
576 break; |
580 } |
577 } |
581 recordList.Close(); |
578 CleanupStack::PopAndDestroy(3,record); |
582 CleanupStack::PopAndDestroy(2,record); |
579 } |
583 } |
|
584 |
|
585 } |
580 } |
586 |
581 |
587 |
582 |
588 void CUpsDbBaseStep::CompactDatabaseL(CDecisionDbW& aUpsDb, TBool aCancel) |
583 void CUpsDbBaseStep::CompactDatabaseL(CDecisionDbW& aUpsDb, TBool aCancel) |
589 /** |
584 /** |