CommsDat::CMDBSession Class Reference

#include <metadatabase.h>

Link against: commsdat.lib

class CommsDat::CMDBSession : public CBase, public CBase

Inherits from

Detailed Description

A session with the underlying storage server

Constructor & Destructor Documentation

~CMDBSession ( )

IMPORT_C~CMDBSession()

Virtual Destructor

Member Function Documentation

CancelAllNotifications ( )

IMPORT_C TIntCancelAllNotifications()

Cancel all notification requests that are outstanding from calls to MMetaDatabase::RequestNotification Individual requests can be cancelled via MMetaDatabase::CancelNotify.

Pre-condition
None
Return Value
KErrNone on success or a system-wide error code

ClearAttributeMask ( TMDBAttributeFlags )

IMPORT_C voidClearAttributeMask(TMDBAttributeFlagsaAttributeFlags)

Clear attribute mask settings, indicating required access level to stored data Clear flags in the attribute mask for this session

Flags indicate the requested access level to stored data

Attribute flags that have been set in this function will be cleared from the session's attribute mask and will be obeyed as restrictions in all database interactions, providing the client has enough platform security capabilities to back up the request

Pre-condition
None

Close ( )

IMPORT_C voidClose()

Close session with storage server. Deprecatedv9.1 Destructor is all that is required

CommitTransactionL ( )

IMPORT_C voidCommitTransactionL()

Commit Transaction in database.

Pre-condition
None
Post-condition
On success the database is updated with data added, modified or deleted during the transaction

On failure, any open data containers may not be in sync with the database and should be discarded or reloaded

Leave Codes
Willleave with KErrNotFound if not in transaction
Willleave with a system-wide error code if an error occurs during commit

IsInTransaction ( )

IMPORT_C TIntIsInTransaction()
Query if this session is in a transaction with the database Return code will indicate Not in transaction, Already in transaction for this session, Write-lock not available. Another session has it.
Pre-condition
None

IsSetAttributeMask ( TMDBAttributeFlags )

IMPORT_C TBoolIsSetAttributeMask(TMDBAttributeFlagsaAttributeFlags)

Check flags in attribute mask aAttributeFlags indicates the requested access level to stored data Attribute flags that have been set will be ignored as restrictions in all database interactions, providing the client has enough platform security capabilities to back up the request

Pre-condition
None
Return Value
ETrue if the flag is set in the session mask This means that the attribute is ignored in database interactions for this sessionEFalse if the flag is not set in the session mask This means that the attribute is obeyed in all database interactions for this session

LatestVersion ( )

IMPORT_C TVersionLatestVersion()[static]

Returns the KCDCurrentVersion constant which maps to the KCDVersion1_1 constant for backward compatibility reason. Please avoid using this method when creating a CommsDat session object and use explicit schema version instead.

Deprecated
Pre-condition
None
Post-condition
None

NewL ( TVersion )

IMPORT_C CMDBSession *NewL(TVersionaRequiredVersion)[static]

Open a session with the storage server and establish data format version in use CommsDat always attempts to support the required version of the client-facing data set. The client must carefully choose the dataset version as it affects binary compatibility

aRequiredVersion If the requested version is deprecated but still supported, mapping will be performed within CommsDat to maintain Data and Binary compatibility for the client If the requested version is the latest version, no mapping will be performed and deprecated fields will be ignored A client that needs to maintain BC must use a specific version A client that always wants to use the latest dataset can start the session with KCDLatestVersion

Pre-condition
None
Post-condition
on success a session has been created and initialised
Leave Codes
KErrUnsupportedIf an old unsupported version is requested
System-wideerror codes if there is an unexpected error

NewLC ( TVersion )

IMPORT_C CMDBSession *NewLC(TVersionaRequiredVersion)[static]

As NewL and adds Session to the CleanupStack

OpenTransactionL ( )

IMPORT_C voidOpenTransactionL()

Open Transaction with storage server and obtain write lock - if not already set

Pre-condition
None
Post-condition
on success the session has exclusive write access to the database
Leave Codes
Willleave with KErrNotAvailable if Database write locked by another process
Willreport KErrAlreadyInTransaction if transaction this session is already in a transaction
Willleave with a system-wide error code if an error occurs during commit
Capability
WriteDeviceData

PublishProperties ( )

IMPORT_C TIntPublishProperties()

Attempt to create publish/subscribe properties if not already defined.

This function is normally called as a setup activity by System components

Pre-condition
None
Return Value
KErrNone on success. Otherwise a system-wide error code
Capability
WriteDeviceData- since these properties are created in KUidSystemCategory category.

RollbackTransactionL ( )

IMPORT_C voidRollbackTransactionL()

Cancel Transaction with database and rollback all associated changes

Pre-condition
None - though for correct usage, ensure a transaction is already open
Post-condition
Any open data containers may not be in sync with the database and should be discarded or reloaded
Leave Codes
Willfail with KErrNotFound if not in transaction

SetAttributeMask ( TMDBAttributeFlags )

IMPORT_C voidSetAttributeMask(TMDBAttributeFlagsaAttributeFlags)

Set attributes to ignore for all database operations during this session

aAttributeFlags indicates the requested access level to stored data. Attributes set by this call will be ignored as restrictions in all database interactions, providing the client has enough platform security capabilities to back up the request

Pre-condition
None

VersionInUse ( )

IMPORT_C TVersionVersionInUse()

Lookup data format version currently in use by client