williamr@2: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // Comms Database public interface williamr@2: // williamr@2: // williamr@2: williamr@2: /** williamr@2: @file williamr@2: @deprecated since v9.1. Functionality is replaced with commsdat. williamr@2: */ williamr@2: williamr@2: #ifndef COMMDB_H williamr@2: #define COMMDB_H williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: using namespace CommsDat; williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: Protection of settings: when the entire table is protected, write operations williamr@2: fail with KErrWrite. However KErrAccessDenied should be returned to client williamr@2: @internalComponent williamr@2: */ williamr@2: #define TRAPD_CONVERT(_r,_s) TRAPD(_r,_s); if(ret == KErrWrite) ret = KErrAccessDenied; williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: #define TRAP_CONVERT(_r,_s) TRAP(_r,_s); if(ret == KErrWrite) ret = KErrAccessDenied; williamr@2: williamr@2: class CCommsDbTableView; williamr@2: class CCommsDbConnectionPrefTableView; williamr@2: class CCommDbTableExtension; williamr@2: class CCommsDatabaseImpl; williamr@2: williamr@2: class CCommsDatabaseBase : public CBase williamr@2: /** Base class for CCommsDatabase. williamr@2: williamr@2: This class is never instantiated, but its member functions are used through williamr@2: the derived class. williamr@2: williamr@2: Responsible for Transactions, Notifications, Write protection, Hidden williamr@2: records, Phone number resolution and Creating views. Stores the database, the williamr@2: session, transaction and notifier information. williamr@2: williamr@2: CCommsDatabaseBase is an abstract base class as the CreateDatabaseL() and williamr@2: Open() methods are pure virtual. williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: // These classes added as friends for commdb shim williamr@2: friend class CCommsDbTableView; williamr@2: friend class CCommsDbConnectionPrefTableView; williamr@2: friend class CCommsDbProtectTableView; williamr@2: friend class CCommsDbProtectConnectPrefTableView; williamr@2: friend class CCommsDbTemplateRecord; williamr@2: public: williamr@2: IMPORT_C virtual ~CCommsDatabaseBase(); williamr@2: williamr@2: // Returns the version of the database server. williamr@2: IMPORT_C TVersion Version() const; williamr@2: // Begin a transaction. Call before `InsertRecord()` or `UpdateRecord()`. williamr@2: IMPORT_C TInt BeginTransaction(); williamr@2: // End a transaction. Call after `InsertRecord()` or `UpdateRecord()`. williamr@2: IMPORT_C TInt CommitTransaction(); williamr@2: // Cancel a transaction. williamr@2: IMPORT_C void RollbackTransaction(); williamr@2: // True if BeginTransaction() has been called but not williamr@2: // `CommitTransaction()` or `RollbackTransaction()`. williamr@2: IMPORT_C TBool InTransaction(); williamr@2: // True if the database has been locked. williamr@2: IMPORT_C TBool IsDatabaseWriteLockedL(); williamr@2: williamr@2: // Enable a notification event on any change to the database. williamr@2: IMPORT_C TInt RequestNotification(TRequestStatus& aStatus); williamr@2: // Cancels notifications. williamr@2: IMPORT_C void CancelRequestNotification(); williamr@2: williamr@2: // Obtain a view of all records in a table. williamr@2: IMPORT_C CCommsDbTableView* OpenTableLC(const TDesC& aTableName); williamr@2: // Obtain a view of the records in a table that match the query. williamr@2: IMPORT_C CCommsDbTableView* OpenViewLC(const TDesC& aTableName, const TDesC& aSqlQuery); williamr@2: // Obtain a view of all the records in a table for which the field williamr@2: // `aColumnToMatch` matches `aValueToMatch`. williamr@2: IMPORT_C CCommsDbTableView* OpenViewMatchingUintLC(const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch); williamr@2: IMPORT_C CCommsDbTableView* OpenViewMatchingBoolLC(const TDesC& aTableName, const TDesC& aColumnToMatch, TBool aValueToMatch); williamr@2: IMPORT_C CCommsDbTableView* OpenViewMatchingTextLC(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch); williamr@2: IMPORT_C CCommsDbTableView* OpenViewMatchingTextLC(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch); williamr@2: williamr@2: // Make hidden records visible williamr@2: IMPORT_C void ShowHiddenRecords(); williamr@2: williamr@2: // Set `aDialString` to be the appropriate string based on the directory williamr@2: // number, where the dial is being performed and the chargecard to use. williamr@2: // `ResolvePhoneNumberL()` opens a comms database to perform the williamr@2: // resolution williamr@2: IMPORT_C static void ResolvePhoneNumberL(TDesC& aNumber, TDes& aDialString, TParseMode aDialParseMode, TUint32 aLocationId, TUint32 aChargecardId); williamr@2: // Set `aDialString` to be the appropriate string based on the directory williamr@2: // number, where the dial is being performed and the chargecard to use. williamr@2: IMPORT_C void ResolvePhoneNumberFromDatabaseL(TDesC& aNumber, TDes& aDialString, TParseMode aDialParseMode, TUint32 aLocationId, TUint32 aChargecardId); williamr@2: IMPORT_C static TInt InitializeFilestore(); williamr@2: williamr@2: // Check access to database fields williamr@2: IMPORT_C TInt CheckReadCapability( const TDesC& aField, const RMessagePtr2* aMessage ); williamr@2: IMPORT_C TInt CheckWriteCapability( const TDesC& aField, const RMessagePtr2* aMessage ); williamr@2: williamr@2: protected: williamr@2: // internal williamr@2: // Please note that as of v9.0 TCommDbSystemAgentNotification now actually contains williamr@2: // the notification information for the Publish and Subscribe notifications, not williamr@2: // for System Agent notifications. williamr@2: class TCommDbSystemAgentNotification williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: */ williamr@2: { williamr@2: public: williamr@2: TCommDbSystemAgentNotification(); williamr@2: void Set(TUid aUid, TInt aVal); williamr@2: public: williamr@2: TUid iUid; williamr@2: TInt iValue; williamr@2: }; williamr@2: williamr@2: class TCommDbPublishSubscribeNotification williamr@2: /** williamr@2: @internalComponent williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: TCommDbPublishSubscribeNotification(); williamr@2: void Set(TUid aUid, TInt aVal); williamr@2: public: williamr@2: TUid iUid; williamr@2: TInt iValue; williamr@2: }; williamr@2: williamr@2: protected: williamr@2: // internal williamr@2: IMPORT_C CCommsDatabaseBase(); williamr@2: // internal williamr@2: virtual void CreateDatabaseL() =0; williamr@2: // williamr@2: void DoClose(); williamr@2: CCommsDbTableView* DoOpenViewMatchingUintL(const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch, TBool aIncludeHiddenRecords); williamr@2: CCommsDbTableView* DoOpenViewMatchingTextL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch, TBool aIncludeHiddenRecords); williamr@2: CCommsDbTableView* DoOpenViewMatchingTextL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch, TBool aIncludeHiddenRecords); williamr@2: CCommsDbTableView* DoOpenTableViewL(const TDesC& aTableName, const TDesC& aSqlQuery); williamr@2: CCommsDbTableView* DoOpenIAPTableViewL(const TDesC& aTableName,const TDesC& aSqlQuery); williamr@2: // williamr@2: void PopulateDialLocationL(TUint32 aId, TDialLocation& aLocation); williamr@2: void PopulateChargeCardL(TUint32 aId, TChargeCard& aChargeCard); williamr@2: void BeginInternalTransactionL(); williamr@2: TInt CommitInternalTransaction(); williamr@2: void RollbackInternalTransaction(); williamr@2: void DatabaseUpdateHasOccurred(); williamr@2: void NotifyChangeL(const TDesC& aSetting, TUint32 aVal); williamr@2: TInt NotifyAllChanges(); williamr@2: williamr@2: TUint32 GetNewNumber(TUid aUid); williamr@2: TInt CheckDBCapability( RDbs::TPolicyType aType, const TDesC& aField, const RMessagePtr2* aMessage ); williamr@2: void ConvertToUid(const TDesC& aSetting, TUint32 aVal, TCommDbPublishSubscribeNotification& aNotification); williamr@2: williamr@2: inline RDbNamedDatabase* Database(); williamr@2: protected: williamr@2: //internal williamr@2: CCommsDatabaseImpl* iImpl; williamr@2: RDbNamedDatabase iDatabase; williamr@2: RDbNotifier iNotifier; williamr@2: // store container data for deletion after session is finished williamr@2: //RPointerArray iTransactionCache; williamr@2: williamr@2: TInt iNotifierOpenError; williamr@2: TBool iShowHiddenRecords; williamr@2: TBool iImplNotCreated; williamr@2: TBool iInInternalTransaction; williamr@2: williamr@2: RArray iNotifications; williamr@2: private: williamr@2: // Check access to database fields williamr@2: TInt DoCheckReadCapabilityL( const TDesC& aField, const RMessagePtr2* aMessage ); williamr@2: TInt DoCheckWriteCapabilityL( const TDesC& aField, const RMessagePtr2* aMessage ); williamr@2: williamr@2: TBool ConvertTableName(const TDesC& aTableName, TDes& aResult); williamr@2: }; williamr@2: williamr@2: class CCommsDatabase : public CCommsDatabaseBase williamr@2: /** williamr@2: Accesses the communications database through the DBMS. williamr@2: williamr@2: An object of this type must be constructed and opened by a client before any williamr@2: of the tables in the database can be accessed, e.g. to create views and access williamr@2: template records. williamr@2: williamr@2: Implements the pure virtual functions CreateDatabaseL() and DoOpen(). williamr@2: Responsible for Global settings and Connection Preferences. Has utility williamr@2: functions for accessing Global and Agent tables. No additional state (to williamr@2: CCommsDatabaseBase) is stored. williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CCommsDatabase* NewL(); williamr@2: IMPORT_C static CCommsDatabase* NewL(TBool aUseDefaultDb); williamr@2: IMPORT_C static CCommsDatabase* NewL(TCommDbOpeningMethod &aOpeningMethod); williamr@2: IMPORT_C virtual ~CCommsDatabase(); williamr@2: IMPORT_C void GetGlobalSettingL(const TDesC& aSetting, TUint32& aValue); williamr@2: IMPORT_C void GetGlobalSettingL(const TDesC& aSetting, TDes& aValue); williamr@2: IMPORT_C void SetGlobalSettingL(const TDesC& aSetting, TUint32 aValue); williamr@2: IMPORT_C void SetGlobalSettingL(const TDesC& aSetting, const TDesC& aValue); williamr@2: IMPORT_C void ClearGlobalSettingL(const TDesC& aSetting); williamr@2: IMPORT_C void GetDefaultTsyL(TDes& aValue); williamr@2: williamr@2: // Deprecated. Past use: Gets settings (Modem, Chargecard, and Service) for the dial out IAP. williamr@2: IMPORT_C void GetCurrentDialOutSettingL(const TDesC& aSetting, TUint32& aValue); williamr@2: // Deprecated. Past use: Retrieve settings for the dial in IAP. williamr@2: IMPORT_C void GetCurrentDialInSettingL(const TDesC& aSetting, TUint32& aValue); williamr@2: // Open a connection preference view. williamr@2: IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableLC(); williamr@2: // Open a connection preference view containing connections of the williamr@2: // specified direction. williamr@2: IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableLC(TCommDbConnectionDirection aDirection); williamr@2: // Open a connection preference view containing connections of the williamr@2: // specified direction excluding connections of rank zero. williamr@2: IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableInRankOrderLC(TCommDbConnectionDirection aDirection); williamr@2: // Open a connection preference view containing connections of the williamr@2: // specified direction and rank. williamr@2: IMPORT_C CCommsDbConnectionPrefTableView* OpenConnectionPrefTableViewOnRankLC(TCommDbConnectionDirection aDirection, TUint32 aRank); williamr@2: williamr@2: //DEPRECATED : Agent table has been removed. These functions have been williamr@2: // stubbed to return KErrNotSupported or leave with the same error. williamr@2: // Access agent settings. `aService` is one of: (`DIAL_OUT_ISP`, williamr@4: // `DIAL_IN_ISP`, `OUTGOING_WCDMA'). */ williamr@2: IMPORT_C void SetAgentL(const TDesC& aService, const TDesC& aAgent); williamr@2: williamr@2: IMPORT_C void SetAgentExtL(const TDesC& aService, const TDesC& aAgentExt); williamr@2: IMPORT_C void GetAgentL(const TDesC& aService, TDes& aAgent); williamr@2: IMPORT_C void GetAgentExtL(const TDesC& aService, TDes& aAgentExt); williamr@2: IMPORT_C void ClearAgentAndExtL(const TDesC& aService); williamr@2: IMPORT_C void SetAgentClientTimeoutL(const TDesC& aService, TInt aClientTimeout); williamr@2: IMPORT_C void SetAgentRouteTimeoutL(const TDesC& aService, TInt aRouteTimeout); williamr@2: IMPORT_C TInt GetAgentClientTimeoutL(const TDesC& aService); williamr@2: IMPORT_C TInt GetAgentRouteTimeoutL(const TDesC& aService); williamr@2: williamr@2: /** Open a view on the IAP table containing records that match the williamr@2: bearers and direction specified. `aBearerSet` is a bit mask of type williamr@2: `TCommDbBearer`. */ williamr@2: IMPORT_C CCommsDbTableView* OpenIAPTableViewMatchingBearerSetLC(TUint32 aBearerSet, TCommDbConnectionDirection aDirection); williamr@2: williamr@2: /** Open a viewon the IAP table containing records which match the specified network */ williamr@2: IMPORT_C CCommsDbTableView* OpenIAPTableViewMatchingNetworkLC(TUint32 aNetwork); williamr@2: williamr@2: // Open a view on the proxy table containing records that match the williamr@2: // service id and type specified. williamr@2: IMPORT_C CCommsDbTableView* OpenViewOnProxyRecordLC(TUint32 aServiceId, const TDesC& aServiceType); williamr@2: williamr@2: // Functionality re-implemented to facilitate BC with 6.1 williamr@2: IMPORT_C static CCommsDatabase* NewL(TCommDbDatabaseType aDbType); williamr@2: // Creates a `CCommsDatabase` as with `NewL()`. The method of opening: williamr@2: // (Created, CopiedDefault or Opened) is returned in `aOpeningMethod`. williamr@2: IMPORT_C static CCommsDatabase* NewL(TCommDbDatabaseType aDbType, TCommDbOpeningMethod &aOpeningMethod); williamr@2: williamr@2: private: williamr@2: enum TGlobalSettingType williamr@2: { williamr@2: ENotASetting, williamr@2: EGlobalSetting, williamr@2: ECompatibilitySetting williamr@2: }; williamr@2: protected: williamr@2: CCommsDatabase(); williamr@2: void DoOpenL(TCommDbOpeningMethod& aOpeningMethod,TBool aUseDefaultDb); williamr@2: private: williamr@2: /** CCommsDatabaseBase pure virtuals */ williamr@2: williamr@2: virtual void CreateDatabaseL(); williamr@2: CCommsDbTableView* OpenGlobalSettingsTableLC(const TDesC& aSetting, TBool& aExists); williamr@2: TGlobalSettingType GlobalSettingTypeL(const TDesC& aSetting) const; williamr@2: williamr@2: }; williamr@2: williamr@2: class CCommsDbTemplateRecord; williamr@2: williamr@2: class CCommsDbTableView : public CBase williamr@2: /** williamr@2: williamr@2: The view on a specific table in the database. williamr@2: williamr@2: Includes the necessary behaviour for navigating through the records in williamr@2: the view and reading and writing to columns within a record. williamr@2: williamr@2: Uses a CCommsDatabase and has an RDbView to read from and write to database. Created via williamr@2: CCommsDatabase::OpenTableLC() (which opens a view of all the records in the table) or one williamr@2: of the OpenViewLC...() functions (which open a specific view of the table): williamr@2: williamr@2: CCommsDatabase::OpenTableLC() williamr@2: williamr@2: CCommsDatabase::OpenViewMatchingUintLC() williamr@2: williamr@2: CCommsDatabase::OpenViewMatchingBoolLC() williamr@2: williamr@2: CCommsDatabase::OpenViewMatchingTextLC() williamr@2: williamr@2: CCommsDatabase::OpenViewLC() williamr@2: williamr@2: Note that the above five functions have been withdrawn in CCommsDatabase and williamr@2: are now implemented in CCommsDatabaseBase. williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: friend class CCommsDatabaseBase; williamr@2: friend class CCommsDbTemplateRecord; williamr@2: public: williamr@2: // Low level view creation. Use if `CCommsDatabase::OpenTableLC()` or williamr@2: //`CCommsDatabase::OpenViewLC...()` are not sufficient. williamr@2: static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDbQuery& aQuery, TBool aUseTemplate = ETrue); williamr@2: static CCommsDbTableView* NewLC(const TDesC& aTableName, CCommsDatabaseBase& aDb); williamr@2: // additional constructors, commdb shim specific williamr@2: static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, const TDesC& aTableName, TBool aUseTamplate = ETrue); // ETrue if template is instantiating williamr@2: static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch); williamr@2: static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch); williamr@2: static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch); williamr@2: static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDesC& aColumnToMatch, TBool aValueToMatch); williamr@2: // this two are for IAP table only so table name is not needed williamr@2: static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, TUint32 aBearerSet, TCommDbConnectionDirection aDirection); williamr@2: static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, TUint32 aNetworkId); williamr@2: // this one is for Proxie table only williamr@2: static CCommsDbTableView* NewLC(CCommsDatabaseBase& aDb, TUint32 aServiceId, const TDesC& aServiceType); williamr@2: williamr@2: CCommsDbTableView(CCommsDatabaseBase& aDb, const TDesC& aTableName); williamr@2: williamr@2: IMPORT_C virtual ~CCommsDbTableView(); williamr@2: williamr@2: // Add a new record to this table. The record number is returned. williamr@2: // `PutRecordChanges()` is called to complete the transaction williamr@2: IMPORT_C TInt InsertRecord(TUint32& aId); williamr@2: /** Add a new record to this table. Filling all empty fields with values copied williamr@2: from record currently pointed at. The record number is returned. williamr@2: `PutRecordChanges()` is called to complete the transaction */ williamr@2: IMPORT_C TInt InsertCopyRecord(TUint32& aId); williamr@2: /** Modify the current record of this view. `PutRecordChanges()` is called williamr@2: to complete the transaction */ williamr@2: IMPORT_C TInt UpdateRecord(); williamr@2: // Remove the current record from the table. williamr@2: IMPORT_C TInt DeleteRecord(); williamr@2: // Store an inserted or updated record back to the database. williamr@2: IMPORT_C TInt PutRecordChanges(TBool aHidden = EFalse, TBool aReadOnly = EFalse); williamr@2: // Cancel pending changes since an insert or update. williamr@2: IMPORT_C void CancelRecordChanges(); williamr@2: // williamr@2: // Navigate throught the records in the view williamr@2: // williamr@2: IMPORT_C TInt GotoFirstRecord(); williamr@2: IMPORT_C TInt GotoNextRecord(); williamr@2: IMPORT_C TInt GotoPreviousRecord(); williamr@2: // williamr@2: // Access data from the current record williamr@2: // williamr@2: IMPORT_C void ReadTextL(const TDesC& aColumn, TDes8& aValue); williamr@2: IMPORT_C void ReadTextL(const TDesC& aColumn, TDes16& aValue); williamr@2: IMPORT_C HBufC* ReadLongTextLC(const TDesC& aColumn); williamr@2: IMPORT_C void ReadUintL(const TDesC& aColumn, TUint32& aValue); williamr@2: IMPORT_C void ReadBoolL(const TDesC& aColumn, TBool& aValue); williamr@2: // Determine the type and attributes of a column. The type is one of: williamr@2: // (EDbColBit, EDbColUint32, EDbColText8, EDbColText16, EDbColLongText16). williamr@2: // The attribute is a bit mask of: (ENotNull and EAutoIncrement). williamr@2: IMPORT_C void ReadTypeAttribL(const TDesC& aColumn, TDbColType& aColType, TUint32& aAttrib); williamr@2: // Null columns return 0, integers and bools 1, strings return their length in characters. williamr@2: IMPORT_C void ReadColumnLengthL(const TDesC& aColumn, TInt& aLength); williamr@2: williamr@2: // williamr@2: // Modify an inserted or modified record. Must call `PutRecordChanges()` williamr@2: // to store the changes. williamr@2: // williamr@2: IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC8& aValue); williamr@2: IMPORT_C void WriteTextL(const TDesC& aColumn, const TDesC16& aValue); williamr@2: IMPORT_C void WriteLongTextL(const TDesC& aColumn, const TDesC& aValue); williamr@2: IMPORT_C void WriteUintL(const TDesC& aColumn, const TUint32& aValue); williamr@2: IMPORT_C void WriteBoolL(const TDesC& aColumn, const TBool& aValue); williamr@2: IMPORT_C void SetNullL(const TDesC& aColumn); williamr@2: williamr@2: IMPORT_C void ReadColumnMaxLengthL(const TDesC& aColumn, TInt& aLength); williamr@2: inline CCommsDatabaseBase* Database() const { return &iDb; } williamr@2: williamr@2: void OpenL(const TDbQuery& aQuery); williamr@2: williamr@2: inline void GetTableName(TDes& aTableName) const; williamr@2: protected: williamr@2: TDbColNo ColNumL(const TDesC& aColumn) const; williamr@2: void Close(); williamr@2: void ConstructL(const TDesC& aTableName, TBool aShowHidden, TBool aUseTemplate); williamr@2: void ConstructL(const TDbQuery& aQuery, TBool aUseTemplate); williamr@2: RDbRowSet::TAccess GetL(); williamr@2: williamr@2: // All other ConstructructL methods are added for commdb shimm williamr@2: void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC8& aValueToMatch); williamr@2: void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, const TDesC16& aValueToMatch); williamr@2: void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, TUint32 aValueToMatch); williamr@2: void ConstructL(const TDesC& aTableName, const TDesC& aColumnToMatch, TBool aValueToMatch); williamr@2: void ConstructL(TUint32 aBearerSet, TCommDbConnectionDirection aDirection); williamr@2: void ConstructL(TUint32 aNetworkId); williamr@2: void ConstructL(TUint32 aServiceId, const TDesC& aServiceType); williamr@2: // used for template creation only williamr@2: void ConstructL(const TDesC& aTableName); williamr@2: williamr@2: private: williamr@2: enum TTableState { williamr@2: EClosed, williamr@2: EOpenIdle, williamr@2: EInsert, williamr@2: EUpdate williamr@2: }; williamr@2: private: williamr@2: TBool TableWithTemplateRecord() const; williamr@2: TInt InsertTemplateRecord(); williamr@2: TInt DoInsertRecord(TBool aType, TUint32& aId, TBool aIsTemplate); williamr@2: TInt DoPutRecordChanges(TBool aHidden = EFalse, TBool aReadOnly = EFalse, TBool aIsTemplateCall = EFalse); williamr@2: williamr@2: private: williamr@2: TTableState iState; williamr@2: CCommsDbTemplateRecord* iTemplate; williamr@2: TBool iTsyNameChanged; williamr@2: TUint32 iInsertedRecordIndex; williamr@2: TUint32 iCurrentId; williamr@2: williamr@2: protected: williamr@2: CCommsDatabaseBase& iDb; williamr@2: TBuf iTableName; williamr@2: RDbView iTableView; williamr@2: CCommDbTableExtension* iTableExt; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Convert a legacy field name to a CommsDat element Id williamr@2: williamr@2: @internalTechnology williamr@2: @param aFieldName A legacy commdb field name in the format "tableName\fieldName" williamr@2: @return A Commsdat element Id williamr@2: */ williamr@2: class CommDbShimUtil williamr@2: { williamr@2: public: williamr@2: IMPORT_C static TMDBElementId GetElementIdFromFieldNameL(const TDesC& aFieldName); williamr@2: }; williamr@2: williamr@2: // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY williamr@2: williamr@2: williamr@2: #include williamr@2: williamr@2: #endif williamr@2: // COMMDB_H