os/security/authorisation/userpromptservice/database/inc/upsdb.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Defines a read-only interface for UPS Database and classes to keep filter and record objects.
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file
sl@0
    22
 @publishedPartner
sl@0
    23
 @released
sl@0
    24
*/
sl@0
    25
 
sl@0
    26
#ifndef UPSDB_H
sl@0
    27
#define UPSDB_H
sl@0
    28
sl@0
    29
#include <s32file.h>
sl@0
    30
#include <d32dbms.h>
sl@0
    31
#include <ups/upstypes.h>
sl@0
    32
sl@0
    33
namespace UserPromptService
sl@0
    34
{
sl@0
    35
sl@0
    36
_LIT(KDecisionViewPanic,"UpsDbView");
sl@0
    37
sl@0
    38
NONSHARABLE_CLASS(CDecisionView):public CActive
sl@0
    39
/**
sl@0
    40
   Stores a handle to a view object and provides a method to retrieve a record from the view.
sl@0
    41
 */
sl@0
    42
 	{	
sl@0
    43
 	friend class CDecisionDb;
sl@0
    44
 	friend class CDecisionDbW;
sl@0
    45
 	
sl@0
    46
public:	
sl@0
    47
 	IMPORT_C static CDecisionView *NewLC();
sl@0
    48
 	
sl@0
    49
 	~CDecisionView();
sl@0
    50
 	
sl@0
    51
	IMPORT_C void EvaluateView(TRequestStatus& aStatus);	
sl@0
    52
 	IMPORT_C CDecisionRecord* NextDecisionL();
sl@0
    53
sl@0
    54
protected:
sl@0
    55
 	CDecisionView();
sl@0
    56
 	static CDecisionRecord* GenerateRecordL(RDbRowSet& aRowSet, CDbColSet* aColSet);	
sl@0
    57
	/**
sl@0
    58
		From CActive. Handles an evaluation request completion event and evaluate next part if required.
sl@0
    59
	 */
sl@0
    60
	void RunL();	
sl@0
    61
	/**
sl@0
    62
		From CActive. Cancels evaluation.
sl@0
    63
	 */
sl@0
    64
	void DoCancel();	
sl@0
    65
	/**
sl@0
    66
		From CActive. Handles errors.
sl@0
    67
	 */
sl@0
    68
	TInt RunError(TInt aError);
sl@0
    69
	 	
sl@0
    70
private:
sl@0
    71
	/**
sl@0
    72
	   Handle to the view object generated from an SQL query
sl@0
    73
	 */
sl@0
    74
	RDbView iDbView;	
sl@0
    75
	/**
sl@0
    76
	   Pointer to the decision database column set definition
sl@0
    77
	 */
sl@0
    78
	CDbColSet *iColSet;	
sl@0
    79
	/**
sl@0
    80
	   Copy of the status variable of the client which requested the evaluation service
sl@0
    81
	 */
sl@0
    82
	TRequestStatus* iClientStatus;
sl@0
    83
 	};
sl@0
    84
sl@0
    85
sl@0
    86
NONSHARABLE_CLASS(CDecisionDb):public CBase
sl@0
    87
/**
sl@0
    88
	A read-only interface for UPS decision database. Provide methods to query database.
sl@0
    89
 */
sl@0
    90
	{
sl@0
    91
public:
sl@0
    92
	IMPORT_C CDecisionView *CreateViewL(CDecisionFilter& aFilter);
sl@0
    93
	
sl@0
    94
	~CDecisionDb();
sl@0
    95
sl@0
    96
protected:
sl@0
    97
	CDecisionDb();
sl@0
    98
	void CreateSqlStatementLC(CDecisionFilter& aFilter, RBuf& aSql);	
sl@0
    99
	void DoubleSingleQuotesL(const TDesC& aSource, RBuf& aDestination);
sl@0
   100
	
sl@0
   101
private:
sl@0
   102
	const TDesC* GetComparisonOperator(const TUint32& aFlag) const;
sl@0
   103
	void AppendQueryInteger(const TUint32& aValue, TDes& aSql, TBool& aMultiple, const TUint32& aFlag, const TUint32& aSetCol, const TDesC& aColName);
sl@0
   104
	void AppendQueryStringL(const TDesC& aValue, TDes& aSql, TBool& aMultiple, const TUint32& aFlag, const TUint32& aSetCol, const TDesC& aColName);
sl@0
   105
	
sl@0
   106
protected:
sl@0
   107
	/**
sl@0
   108
	 * Handle to the decision store database
sl@0
   109
	 */
sl@0
   110
	RDbStoreDatabase iDatabase;
sl@0
   111
	/**
sl@0
   112
	 * Pointer to the database file storage object
sl@0
   113
	 */
sl@0
   114
	CFileStore* iStore;	
sl@0
   115
	};
sl@0
   116
sl@0
   117
}//namespace UserPromptService
sl@0
   118
sl@0
   119
#endif //UPSDB_H