1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/authorisation/userpromptservice/database/inc/upsdb.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,119 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Defines a read-only interface for UPS Database and classes to keep filter and record objects.
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @publishedPartner
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef UPSDB_H
1.30 +#define UPSDB_H
1.31 +
1.32 +#include <s32file.h>
1.33 +#include <d32dbms.h>
1.34 +#include <ups/upstypes.h>
1.35 +
1.36 +namespace UserPromptService
1.37 +{
1.38 +
1.39 +_LIT(KDecisionViewPanic,"UpsDbView");
1.40 +
1.41 +NONSHARABLE_CLASS(CDecisionView):public CActive
1.42 +/**
1.43 + Stores a handle to a view object and provides a method to retrieve a record from the view.
1.44 + */
1.45 + {
1.46 + friend class CDecisionDb;
1.47 + friend class CDecisionDbW;
1.48 +
1.49 +public:
1.50 + IMPORT_C static CDecisionView *NewLC();
1.51 +
1.52 + ~CDecisionView();
1.53 +
1.54 + IMPORT_C void EvaluateView(TRequestStatus& aStatus);
1.55 + IMPORT_C CDecisionRecord* NextDecisionL();
1.56 +
1.57 +protected:
1.58 + CDecisionView();
1.59 + static CDecisionRecord* GenerateRecordL(RDbRowSet& aRowSet, CDbColSet* aColSet);
1.60 + /**
1.61 + From CActive. Handles an evaluation request completion event and evaluate next part if required.
1.62 + */
1.63 + void RunL();
1.64 + /**
1.65 + From CActive. Cancels evaluation.
1.66 + */
1.67 + void DoCancel();
1.68 + /**
1.69 + From CActive. Handles errors.
1.70 + */
1.71 + TInt RunError(TInt aError);
1.72 +
1.73 +private:
1.74 + /**
1.75 + Handle to the view object generated from an SQL query
1.76 + */
1.77 + RDbView iDbView;
1.78 + /**
1.79 + Pointer to the decision database column set definition
1.80 + */
1.81 + CDbColSet *iColSet;
1.82 + /**
1.83 + Copy of the status variable of the client which requested the evaluation service
1.84 + */
1.85 + TRequestStatus* iClientStatus;
1.86 + };
1.87 +
1.88 +
1.89 +NONSHARABLE_CLASS(CDecisionDb):public CBase
1.90 +/**
1.91 + A read-only interface for UPS decision database. Provide methods to query database.
1.92 + */
1.93 + {
1.94 +public:
1.95 + IMPORT_C CDecisionView *CreateViewL(CDecisionFilter& aFilter);
1.96 +
1.97 + ~CDecisionDb();
1.98 +
1.99 +protected:
1.100 + CDecisionDb();
1.101 + void CreateSqlStatementLC(CDecisionFilter& aFilter, RBuf& aSql);
1.102 + void DoubleSingleQuotesL(const TDesC& aSource, RBuf& aDestination);
1.103 +
1.104 +private:
1.105 + const TDesC* GetComparisonOperator(const TUint32& aFlag) const;
1.106 + void AppendQueryInteger(const TUint32& aValue, TDes& aSql, TBool& aMultiple, const TUint32& aFlag, const TUint32& aSetCol, const TDesC& aColName);
1.107 + void AppendQueryStringL(const TDesC& aValue, TDes& aSql, TBool& aMultiple, const TUint32& aFlag, const TUint32& aSetCol, const TDesC& aColName);
1.108 +
1.109 +protected:
1.110 + /**
1.111 + * Handle to the decision store database
1.112 + */
1.113 + RDbStoreDatabase iDatabase;
1.114 + /**
1.115 + * Pointer to the database file storage object
1.116 + */
1.117 + CFileStore* iStore;
1.118 + };
1.119 +
1.120 +}//namespace UserPromptService
1.121 +
1.122 +#endif //UPSDB_H