CommsDat::CMDBSession Class Reference

class CommsDat::CMDBSession : public CBase

A session with the underlying storage server

Inherits from

Constructor & Destructor Documentation

CMDBSession()

CMDBSession ( ) [private]

~CMDBSession()

IMPORT_C ~CMDBSession ( )

Virtual Destructor

Member Functions Documentation

CancelAllNotifications()

IMPORT_C TInt CancelAllNotifications ( )

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

Pre-condition
None

ClearAttributeMask(TMDBAttributeFlags)

IMPORT_C void ClearAttributeMask ( TMDBAttributeFlags aAttributeFlags )

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

Parameters

TMDBAttributeFlags aAttributeFlags

Close()

IMPORT_C void Close ( )

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

CommitTransactionL()

IMPORT_C void CommitTransactionL ( )

Commit Transaction in database.

leave
Will leave with KErrNotFound if not in transaction
leave
Will leave with a system-wide error code if an error occurs during commit
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

ConstructL(TVersion)

TInt ConstructL ( TVersion aRequiredVersion ) [private]

Parameters

TVersion aRequiredVersion

IsInTransaction()

IMPORT_C TInt IsInTransaction ( )
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 TBool IsSetAttributeMask ( TMDBAttributeFlags aAttributeFlags )

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

Parameters

TMDBAttributeFlags aAttributeFlags

LatestVersion()

IMPORT_C TVersion LatestVersion ( ) [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.

Pre-condition
None
Post-condition
None

NewL(TVersion)

IMPORT_C CMDBSession * NewL ( TVersion aRequiredVersion ) [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

leave
KErrUnsupported If an old unsupported version is requested
leave
System-wide error codes if there is an unexpected error
Pre-condition
None
Post-condition
on success a session has been created and initialised

Parameters

TVersion aRequiredVersion

NewLC(TVersion)

IMPORT_C CMDBSession * NewLC ( TVersion aRequiredVersion ) [static]

As NewL and adds Session to the CleanupStack

Parameters

TVersion aRequiredVersion

OpenTransactionL()

IMPORT_C void OpenTransactionL ( )

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

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

PublishProperties()

IMPORT_C TInt PublishProperties ( )

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

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

capability
WriteDeviceData - since these properties are created in KUidSystemCategory category.
Pre-condition
None

RollbackTransactionL()

IMPORT_C void RollbackTransactionL ( )

Cancel Transaction with database and rollback all associated changes

leave
Will fail with KErrNotFound if not in transaction
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

SetAttributeMask(TMDBAttributeFlags)

IMPORT_C void SetAttributeMask ( TMDBAttributeFlags aAttributeFlags )

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

Parameters

TMDBAttributeFlags aAttributeFlags

VersionInUse()

IMPORT_C TVersion VersionInUse ( )

Lookup data format version currently in use by client

Member Data Documentation

CMDBSessionImpl * iMDBSessionImpl

CMDBSessionImpl * iMDBSessionImpl [private]