CommsDat::MMetaDatabase Class Reference

#include <metadatabase.h>

Link against: commsdat.lib

class CommsDat::MMetaDatabase : public Meta::MMetaData, public Meta::MMetaData

Inherits from

Public Member Functions
virtual ~MMetaDatabase()
IMPORT_C TIntCancelNotification(CMDBSession &, TRequestStatus &)
IMPORT_C voidDeleteL(CMDBSession &)
IMPORT_C TBoolFindL(CMDBSession &)
IMPORT_C voidLoadL(CMDBSession &)
IMPORT_C voidModifyL(CMDBSession &)
IMPORT_C voidRefreshL(CMDBSession &)
IMPORT_C TIntRequestNotification(CMDBSession &, TRequestStatus &)
IMPORT_C voidStoreL(CMDBSession &)
Protected Member Functions
MMetaDatabase()
Inherited Functions
Meta::MMetaData::GetAttribPtr(const TInt)const
Meta::MMetaData::GetVDataTable()const

Detailed Description

Interface for interaction with a database server Inherited by each data set type that can be stored

Constructor & Destructor Documentation

MMetaDatabase ( )

IMPORT_CMMetaDatabase()[protected, explicit]

Protected and explicit constructor - nothing to construct

~MMetaDatabase ( )

IMPORT_C~MMetaDatabase()[virtual]

Virtual destructor - nothing to destroy

Member Function Documentation

CancelNotification ( CMDBSession &, TRequestStatus & )

IMPORT_C TIntCancelNotification(CMDBSession &aSession,
TRequestStatus &aRequestStatus
)

CancelNotification - cancel an outstanding notification request

note that all outstanding notification requests can be cancelled by a call to

CMDBSession::CancelAllNotifications

There is an outstanding notification request

DeleteL ( CMDBSession & )

IMPORT_C voidDeleteL(CMDBSession &aSession)

Delete fields from the database.

Client can request to ignore access control flags by setting the attribute mask, but only fields that the client has capabilities to delete will be removed.

A request to delete data in unauthorised area will cause the function to leave

Pre-condition
Ensure the ElementId for this container fully identifies the target data in the database
<Record> Ensure that the session object has appropriate access control attributes to manage the target data in the database Ensure the ElementId for this container correcty identifies the target data in the database
Leave Codes
Ifclient not authorised to read or write the data, will leave with KErrPermissionDenied May also leave with other general error codes if there are unexpected problems (e.g. KErrNoMemory when out of memory)

FindL ( CMDBSession & )

IMPORT_C TBoolFindL(CMDBSession &aSession)

FindL - Find and Load the data set(s) that match all the data values entered by the client in this container

Client can request to ignore access control flags by setting the attribute mask, CMDBSession::SetAttributeMask() However will not load data that the client is not authorised to see (by platsec) even if the client has sets the appropriate attribute mask

Will return ETrue on success EFalse if no data found that the client is authorised to view

May also leave with KErrGeneral or other general error codes.

On failure, the container should be discarded or repopulated before it is used again

Please note - a case insensitive search is done in the case of text based fields

Pre-condition
Populate this container where necessary with valid data to match during the find operation Ensure the ElementId for this container correcty identifies the target table in the database
Ensure that the session object has been initialised with the correct dataset version Ensure that the session object has appropriate access control attributes to manage the target data in the database

LoadL ( CMDBSession & )

IMPORT_C voidLoadL(CMDBSession &aSession)

LoadL - Load this container with data from the database

Any data in the container will be discarded

Individual fields may legitimately be NULL in the database, but if no data at all is found for an entire table or record, LoadL will leave with KErrNotFound

The client can request to ignore access control flags by setting the attribute mask CMDBSession::SetAttributeMask() However, only fields that the client has capabilities to write will be stored in the database A request to read data from an unauthorised area of the database will cause the function to leave.with KErrPermissionDenied

In a record, fields in an unauthorised column may be silently ignored and returned as NULL

May also leave with KErrNoMemory or other general error codes

On failure, the container should be discarded or reloaded before it is used again

Pre-condition
Ensure the ElementId for this container fully identifies the target data in the database
<Record> Ensure that the session object has been initialised with the correct dataset version Ensure that the session object has appropriate access control attributes to manage the target data in the database

Loads each member of the MMetaDatabase object from the database. Will (delete and) overwrite any data already in the container.

ModifyL ( CMDBSession & )

IMPORT_C voidModifyL(CMDBSession &aSession)

Modify all fields in the database that have been changed in this container by the caller

Modification is atomic for this container. It uses an internal transaction even if no overall transaction set by client. All changed fields in the element are modified in database on success. No fields are altered in the database if the function leaves

Client can request to ignore access control flags by setting the attribute mask CMDBSession::SetAttributeMask() However, only fields that the client has capabilities to alter will be modified.in the database A request to modify data in an unauthorised area will cause the function to leave.with KErrPermissionDenied

May also leave with other general error codes if there are unexpected problems (e.g. KErrNoMemory when out of memory)

On failure, the container should be discarded or repopulated before it is used again

Pre-condition
Populate this container with valid data for storage Ensure the ElementId for this container fully identifies the target data in the database
<Record> Ensure that the session object has been initialised with the correct dataset version Ensure that the session object has appropriate access control attributes to manage the target data in the database

Modifies each changed member of the MMetaDatabase object in the database

RefreshL ( CMDBSession & )

IMPORT_C voidRefreshL(CMDBSession &aSession)

Refresh all fields in the container that have not been changed by the client

The client can request to ignore access control flags by setting the attribute mask, CMDBSession::SetAttributeMask() However, only data that the client has capabilities to view will be loaded Unauthorised data elements will be silently ignored and will remain NULL

If no data at all is found the functon will leave with KErrNotFound

If fields are not accessible for reading the function may leave with KErrPermissionDenied

May also leave with other general error codes if there are unexpected problems (e.g. KErrNoMemory when out of memory)

On failure, the container should be discarded or reloaded before it is used again

Pre-condition
Ensure the ElementId for this container fully identifies the target data in the database
<Record> Ensure that the session object has been initialised with the correct dataset version Ensure that the session object has appropriate access control attributes to manage the target data in the database

Updates each unchanged member of the MMetaDatabase object from the database

RequestNotification ( CMDBSession &, TRequestStatus & )

IMPORT_C TIntRequestNotification(CMDBSession &aSession,
TRequestStatus &aRequestStatus
)

RequestNotification - Register for notification of events from all clients of the database

aRequestStatus will be completed when the following events occur TransactionComplete TransactionRollback SessionClose

this aRequestStatus can be cancelled by a call to

MMetaDatabase::CancelNotification

all outstanding aRequestStatus can be cancelled by a call to

CMDBSession::CancelAllNotifications

aSession a valid session object aRequestStatus the requestStatus object that will be completed on notification
Pre-condition
None
Post-condition
A notification request will be outstanding
Return Value
KErrNone on success. A system wide error on failure
Capability
WriteDeviceData

StoreL ( CMDBSession & )

IMPORT_C voidStoreL(CMDBSession &aSession)

StoreL - Store all fields in the database that have been changed in this container and create new records where necessary.

StoreL is atomic for this container. An internal transaction is used even if no overall transaction is set by client. All changed fields in the element are stored in the database on success. No fields or records are stored in the database if the function leaves

If a client has an open transaction in the session, the stored data will be available to this session as soon as StoreL completes but will not be visible to other sessions until the transaction completes successfully

The client can request to ignore access control flags by setting the attribute mask CMDBSession::SetAttributeMask() However, only fields that the client has capabilities to write will be stored in the database A request to modify data in an unauthorised area of the database will cause the function to leave.with KErrPermissionDenied

If a field already exists, StoreL will leave with KErrAlreadyExists

May also leave with other general error codes if there are unexpected problems (e.g. KErrNoMemory when out of memory)

Store will be atomic - all fields stored after success. No fields stored if the function leaves

If StoreL fails or the later commit is not successful, The data in the container will not match the data in the database.

On failure, the container should be discarded or repopulated before it is used again

Pre-condition
Populate this container with valid data for storage Ensure the ElementId for this container fully identifies the target location in the database
<Record> Ensure that the session object has been initialised with the correct dataset version Ensure that the session object has appropriate access control attributes to manage the target data in the database