diff -r 000000000000 -r b497e44ab2fc omaprovisioning/provisioning/ProvisioningEngine/Inc/CWPInternetAPDB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omaprovisioning/provisioning/ProvisioningEngine/Inc/CWPInternetAPDB.h Thu Dec 17 09:07:52 2009 +0200 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: create/save/get Internet connection methods from database. +* +*/ + +#include +#include + +//database name +//_LIT(KtxDatabaseName, "DBS_INTERNET_ConnectionMethods.db"); +_LIT(KtxDatabaseName, "c:InternetConnectionMethods.db"); +_LIT( KNonSecureDbFullName, "C:\\system\\data\\InternetConnectionMethods.db" ); + +//Originator max length +#define KOriginatorMaxLength 50 + +// database column names +_LIT(NCol1, "Index"); +_LIT(NCol2, "APID"); +_LIT(NCol3, "BearerType"); +_LIT(NCol4, "Originator"); + +// database table name +_LIT(KtxtItemlist, "itemlist"); + +class TAccessPointItem + { +public: + TAccessPointItem() : + iIndex(-1) + { + } + ; +public: + TInt iIndex; + TUint iAPID; + TUint iBearerType; + TBuf iOriginator; + }; + +class CWPInternetAPDB : public CBase + { +public: + /** + * Two-phased constructor. + */ + static CWPInternetAPDB* NewL(); + + /** + * Two-phased constructor. + */ + static CWPInternetAPDB* NewLC(); + +public: + void ConstructL(); + ~CWPInternetAPDB(); +public: + /** + * CreateandOpenL + * Creates and Opens the database. + * @param name Path of the database + * @return void + **/ + inline void CreateandOpenL(TParse& name); + /** + * ReadItemsL + * Reads the Access Point data from a + * database and store the data in a Item array. + * @param aItemArray Item Array + * @param QueryBuffer SQL Query + * @return void + **/ + void + ReadItemsL(RArray& aItemArray, + TFileName QueryBuffer); + /** + * SaveToDatabaseL + * Saves the Access Point data in a database + * database and stores the data in a Item array. + * @param aIndex Index + * @param aAPId Access Point ID + * @param aBearerType Bearer Type + * @param aOriginator Operator + * @return void + **/ + void SaveToDatabaseL(TInt& aIndex, TUint aAPId, TUint32 aBearerType, + const TDesC& aOriginator); + /** + * ReadDbItemsL + * Reads the Access Point data from a + * database and stores the data in a Item array. + * @param aItemArray Item Array + * @return void + **/ + void ReadDbItemsL(RArray& aItemArray); + + /** + * ReadDbItemsForOrigL + * Reads the Access Point data for an operartor + * from a database and stores the data in a Item array. + * @param aItemArray Item Array + * @param aValue Operator + * @return void + **/ + void ReadDbItemsForOrigL(RArray& aItemArray, + TDesC& aValue); + + /** + * DeleteFromDatabaseL + * Deletes the existings rows which have same Access Point ID + * @param aAPId Access Point ID + * @return TBool deleted rows + **/ + TBool DeleteFromDatabaseL(TUint aAPId); +private: + /** + * CreateTableL + * Creates table for a database + * @param aDatabase Database Name + * @return void + **/ + void CreateTableL(RDbDatabase& aDatabase); +private: + // Database Name + RDbNamedDatabase iItemsDatabase; + // File session + RFs iFsSession; + //Datbase session + RDbs iRdbSession; + };