sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Defines a read-only interface for UPS Database and classes to keep filter and record objects. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef UPSDB_H sl@0: #define UPSDB_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: namespace UserPromptService sl@0: { sl@0: sl@0: _LIT(KDecisionViewPanic,"UpsDbView"); sl@0: sl@0: NONSHARABLE_CLASS(CDecisionView):public CActive sl@0: /** sl@0: Stores a handle to a view object and provides a method to retrieve a record from the view. sl@0: */ sl@0: { sl@0: friend class CDecisionDb; sl@0: friend class CDecisionDbW; sl@0: sl@0: public: sl@0: IMPORT_C static CDecisionView *NewLC(); sl@0: sl@0: ~CDecisionView(); sl@0: sl@0: IMPORT_C void EvaluateView(TRequestStatus& aStatus); sl@0: IMPORT_C CDecisionRecord* NextDecisionL(); sl@0: sl@0: protected: sl@0: CDecisionView(); sl@0: static CDecisionRecord* GenerateRecordL(RDbRowSet& aRowSet, CDbColSet* aColSet); sl@0: /** sl@0: From CActive. Handles an evaluation request completion event and evaluate next part if required. sl@0: */ sl@0: void RunL(); sl@0: /** sl@0: From CActive. Cancels evaluation. sl@0: */ sl@0: void DoCancel(); sl@0: /** sl@0: From CActive. Handles errors. sl@0: */ sl@0: TInt RunError(TInt aError); sl@0: sl@0: private: sl@0: /** sl@0: Handle to the view object generated from an SQL query sl@0: */ sl@0: RDbView iDbView; sl@0: /** sl@0: Pointer to the decision database column set definition sl@0: */ sl@0: CDbColSet *iColSet; sl@0: /** sl@0: Copy of the status variable of the client which requested the evaluation service sl@0: */ sl@0: TRequestStatus* iClientStatus; sl@0: }; sl@0: sl@0: sl@0: NONSHARABLE_CLASS(CDecisionDb):public CBase sl@0: /** sl@0: A read-only interface for UPS decision database. Provide methods to query database. sl@0: */ sl@0: { sl@0: public: sl@0: IMPORT_C CDecisionView *CreateViewL(CDecisionFilter& aFilter); sl@0: sl@0: ~CDecisionDb(); sl@0: sl@0: protected: sl@0: CDecisionDb(); sl@0: void CreateSqlStatementLC(CDecisionFilter& aFilter, RBuf& aSql); sl@0: void DoubleSingleQuotesL(const TDesC& aSource, RBuf& aDestination); sl@0: sl@0: private: sl@0: const TDesC* GetComparisonOperator(const TUint32& aFlag) const; sl@0: void AppendQueryInteger(const TUint32& aValue, TDes& aSql, TBool& aMultiple, const TUint32& aFlag, const TUint32& aSetCol, const TDesC& aColName); sl@0: void AppendQueryStringL(const TDesC& aValue, TDes& aSql, TBool& aMultiple, const TUint32& aFlag, const TUint32& aSetCol, const TDesC& aColName); sl@0: sl@0: protected: sl@0: /** sl@0: * Handle to the decision store database sl@0: */ sl@0: RDbStoreDatabase iDatabase; sl@0: /** sl@0: * Pointer to the database file storage object sl@0: */ sl@0: CFileStore* iStore; sl@0: }; sl@0: sl@0: }//namespace UserPromptService sl@0: sl@0: #endif //UPSDB_H