#include <commdb.h>
class CCommsDatabaseBase : public CBase |
Base class for CCommsDatabase.
This class is never instantiated, but its member functions are used through the derived class.
Responsible for Transactions, Notifications, Write protection, Hidden records, Phone number resolution and Creating views. Stores the database, the session, transaction and notifier information.
CCommsDatabaseBase is an abstract base class as the CreateDatabaseL() and Open() methods are pure virtual.
IMPORT_C | CCommsDatabaseBase | ( | ) | [protected] |
Default constructor for internal use only.
void | BeginInternalTransactionL | ( | ) | [protected] |
Lock the database for internal use - begin a transaction if we can!
IMPORT_C TInt | BeginTransaction | ( | ) |
Marks the start of a transaction and gets a shared read-lock on the database. Other clients of the database can concurrently acquire a shared read-lock but no client can gain an exclusive write-lock until this transaction (and any transaction started by other clients) completes as a result of a call to either CommitTransaction() or RollbackTransaction().
A transaction consists of one or more record updates and/or insertions and/or deletions. The process of making changes to records within a view is part of CCommsDbTableView behaviour.
See also: CCommsDbTableView::InsertRecord(), CCommsDbTableView::UpdateRecord(), CCommsDbTableView::DeleteRecord(), CCommsDbTableView::PutRecordChanges() and CCommsDbTableView::CancelRecordChanges().
Returns: KErrNone if the database has been successfully locked; the transaction can start. KErrLocked if another client already has an exclusive write-lock on the database.
IMPORT_C void | CancelRequestNotification | ( | ) |
Cancels an outstanding request for notification of changes to the communications database.
An outstanding request completes with KErrCancel.
TInt | CheckDBCapability | ( | RDbs::TPolicyType | aType, |
const TDesC & | aField, | |||
const RMessagePtr2 * | aMessage | |||
) | [protected] |
Check that a given client has the capabilites required to perform the given operation on the given field
Parameter | Description |
---|---|
aType | Specifies the requested operation (read or write) |
aField | Specifies the field to perform the operation on |
aMessage | Contains the capabilites of the client |
Returns: KErrNone on success, one of the system-wide error codes otherwise
IMPORT_C TInt | CheckReadCapability | ( | const TDesC & | aField, |
const RMessagePtr2 * | aMessage | |||
) |
Check the capabilites required to read a field from the database
Parameter | Description |
---|---|
aField | the name of the field to be read |
aMessage | Message indicating the capabilites to be checked |
Returns: KErrNone on success, one of the system-wide error codes otherwise
IMPORT_C TInt | CheckWriteCapability | ( | const TDesC & | aField, |
const RMessagePtr2 * | aMessage | |||
) |
Check the capabilites required to write a field to the database
Parameter | Description |
---|---|
aField | the name of the field to be written |
aMessage | Message indicating the capabilites to be checked |
Returns: KErrNone on success, one of the system-wide error codes otherwise
TInt | CommitInternalTransaction | ( | ) | [protected] |
Unlocks the database from internal use - end a transaction. If the commit fails then do the rollback.
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
IMPORT_C TInt | CommitTransaction | ( | ) |
Marks the end of a transaction and commits any changes made since the start of the transaction. The client's shared read-lock is removed if no write operations were performed, or the exclusive write-lock is removed if write operations were performed.
Returns: KErrNone if successful, otherwise another of the system-wide error codes.
void | ConvertToUid | ( | const TDesC & | aSetting, |
TUint32 | aVal, | |||
TCommDbPublishSubscribeNotification & | aNotification | |||
) | [protected] |
Checks for the type of the setting passed and sets the value in the Commdb publish subscribe notification appropriately.
Nothing to do. Everything is done in CommsDat from v9.1
Parameter | Description |
---|---|
aSetting | Setting to get |
aVal | Setting value. |
aNotification | A reference to TCommDbSystemAgentNotification |
RDbNamedDatabase * | Database | ( | ) | [protected, inline] |
Returns the interface for creating and opening a database identified by name and format.
Returns: A pointer to the interface for creating and opening a database identified by name and format.
void | DatabaseUpdateHasOccurred | ( | ) | [protected] |
Sets the flag to signal that a successful update has occurred
CCommsDbTableView * | DoOpenIAPTableViewL | ( | const TDesC & | aTableName, |
const TDesC & | aSqlQuery | |||
) | [protected] |
DeprecatedThis method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aSqlQuery | A reference to a descriptor containing the SQL query text |
Returns: Pointer to CCommsDbTableView
CCommsDbTableView * | DoOpenTableViewL | ( | const TDesC & | aTableName, |
const TDesC & | aSqlQuery | |||
) | [protected] |
DeprecatedThis method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aSqlQuery | A reference to a descriptor containing the SQL query text |
Returns: Pointer to CCommsDbTableView
CCommsDbTableView * | DoOpenViewMatchingTextL | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
const TDesC8 & | aValueToMatch, | |||
TBool | aIncludeHiddenRecords | |||
) | [protected] |
Opens a view on the table aTableName containing all records where aColumnToMatch contains aValueToMatch
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aColumnToMatch | A reference to a descriptor containing the name of a column in table aTableName. |
aValueToMatch | reference to an unsigned integer passed by the caller. |
Returns: Pointer to CCommsDbTableView
CCommsDbTableView * | DoOpenViewMatchingTextL | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
const TDesC16 & | aValueToMatch, | |||
TBool | aIncludeHiddenRecords | |||
) | [protected] |
Opens a view on the table aTableName containing all records where aColumnToMatch contains aValueToMatch
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aColumnToMatch | A reference to a descriptor containing the name of a column in table aTableName. |
aValueToMatch | reference to an unsigned integer passed by the caller. |
Returns: Pointer to CCommsDbTableView
CCommsDbTableView * | DoOpenViewMatchingUintL | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
TUint32 | aValueToMatch, | |||
TBool | aIncludeHiddenRecords | |||
) | [protected] |
Opens a view on the table aTableName containing all records where aColumnToMatch contains aValueToMatch
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aColumnToMatch | A reference to a descriptor containing the name of a column in table aTableName. |
aValueToMatch | reference to an unsigned integer passed by the caller. |
Returns: Pointer to CCommsDbTableView
IMPORT_C TBool | InTransaction | ( | ) |
Tests whether a transaction is in progress, i.e. whether a call to BeginTransaction() has been called.
Returns: ETrue if a transaction is in progress (BeginTransaction() has been called but not CommitTransaction() or RollbackTransaction()); EFalse otherwise.
IMPORT_C TInt | InitializeFilestore | ( | ) | [static] |
DeprecatedThis method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
IMPORT_C TBool | IsDatabaseWriteLockedL | ( | ) |
Tests if the database is write locked.
Tries to open a transaction from another client.
Calling InTransaction() is not enough because if the transaction is automatic rather than explicit, this will still return EFalse.
Returns: ETrue if the database is write locked, EFalse if not.
TInt | NotifyAllChanges | ( | ) | [protected] |
Does the notification for all the changes that are stored in the member variable iNotifications.
Nothing to do. Everything is done in CommsDat from v9.1
Returns: KErrNone if successful; KErrPermissionDenied if the caller process failed the Write Policy; KErrNotFound if a property was not found
IMPORT_C CCommsDbTableView * | OpenTableLC | ( | const TDesC & | aTableName | ) |
Fills the container with all records from table and returns a pointer to view class. The view excludes hidden records, unless access to them has previously been explicitly requested by calling the ShowHiddenRecords() member function of this object.
If the process is succesful, the function constructs and returns a pointer to a CCommsDbTableView object which encapsulates the information on that view. The pointer is also put onto the cleanup stack.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of the table in the communications database to be opened. |
Returns: A pointer to the view object.
IMPORT_C CCommsDbTableView * | OpenViewLC | ( | const TDesC & | aTableName, |
const TDesC & | aSqlQuery | |||
) |
DeprecatedThis method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aSqlQuery | A reference to a descriptor containing the SQL query text. |
Returns: A pointer to the view object.
IMPORT_C CCommsDbTableView * | OpenViewMatchingBoolLC | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
TBool | aValueToMatch | |||
) |
Opens a view onto a specified table based on a matching boolean value, and returns a pointer to that view. The view includes all those records where the column, identified by aColumnToMatch, matches the boolean value aValueToMatch.
The view excludes hidden records, unless access to them has previously been explicitly requested by calling the ShowHiddenRecords() member function.
If the open process is successful, the function constructs and returns a pointer to a CCommsDbTableView object which encapsulates the information on that view. The pointer is also put onto the cleanup stack.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of the table of interest in the communications database. |
aColumnToMatch | A reference to a descriptor containing the name of the column to be used in the selection process. |
aValueToMatch | The value to be matched with the content of column aColumnToMatch. |
Returns: A pointer to the view object.
IMPORT_C CCommsDbTableView * | OpenViewMatchingTextLC | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
const TDesC8 & | aValueToMatch | |||
) |
Opens a view onto a specified table based on a matching 8 bit text type, and returns a pointer to that view.
The view includes all those records where the column, identified by aColumnToMatch, matches the narrow text supplied in the descriptor aValueToMatch.
The view excludes hidden records, unless access to them has previously been explicitly requested by calling the ShowHiddenRecords() member function of this object.
If the open process is succesful, the function constructs and returns a pointer to a CCommsDbTableView object which encapsulates the information on that view. The pointer is also put onto the cleanup stack.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aColumnToMatch | A reference to a descriptor containing the name of the column to be used in the selection process. |
aValueToMatch | The narrow (ASCII) text to be matched with the content of column aColumnToMatch. |
Returns: A pointer to the view object.
IMPORT_C CCommsDbTableView * | OpenViewMatchingTextLC | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
const TDesC16 & | aValueToMatch | |||
) |
Opens a view onto a specified table based on a matching 16 bit text type, and returns a pointer to that view. The view includes all those records where the column, identified by aColumnToMatch, matches the wide text supplied in the descriptor aValueToMatch.
The view excludes hidden records, unless access to them has previously been explicitly requested by calling the ShowHiddenRecords() member function of this object.
If the open process is successful, the function constructs and returns a pointer to a CCommsDbTableView object which encapsulates the information on that view. The pointer is also put onto the cleanup stack.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of a table in the communications database. |
aColumnToMatch | A reference to a descriptor containing the name of the column to be used in the selection process. |
aValueToMatch | The wide (UNICODE) text to be matched with the content of column aColumnToMatch. |
Returns: A pointer to the view object.
IMPORT_C CCommsDbTableView * | OpenViewMatchingUintLC | ( | const TDesC & | aTableName, |
const TDesC & | aColumnToMatch, | |||
TUint32 | aValueToMatch | |||
) |
Opens a view onto a specified table based on a matching unsigned integer value, and returns a pointer to that view. The view includes all those records where the column, identified by aColumnToMatch, matches the unsigned integer value aValueToMatch.
The view excludes hidden records, unless access to them has previously been explicitly requested by calling the ShowHiddenRecords() member function of this object.
If the open process is succesful, the function constructs and returns a pointer to a CCommsDbTableView object which encapsulates the information on that view. The pointer is also put onto the cleanup stack.
Parameter | Description |
---|---|
aTableName | A reference to a descriptor containing the name of the table in the communications database on which a view is to be opened. |
aColumnToMatch | A reference to a descriptor containing the name of the column to be used in the selection process. |
aValueToMatch | The value to be matched with the content of column aColumnToMatch. |
Returns: A pointer to the view object.
void | PopulateChargeCardL | ( | TUint32 | aId, |
TChargeCard & | aChargeCard | |||
) | [protected] |
Populates aChargeCard with charge card account and PIN details and network operator specific dialling rules for local, national and international calls by getting the details from the database based on aId.
Parameter | Description |
---|---|
aId | Unique Id associated with the record in the database. |
aChargeCard | On return, contains the charge card account and PIN details and network operator specific dialling rules for local, national and international calls |
void | PopulateDialLocationL | ( | TUint32 | aId, |
TDialLocation & | aLocation | |||
) | [protected] |
populates aLocation with configuration details related to the current location of the telephone equipment getting the details from the database based on aId.
Parameter | Description |
---|---|
aId | Unique Id associated with the record in the database. |
aLocation | On return, contains the configuration details related to the current location of the telephone equipment |
IMPORT_C TInt | RequestNotification | ( | TRequestStatus & | aStatus | ) |
Requests notification when any change is made to the database, whether by this client or any other.
(If the notifier is not successfully opened the function simply returns an error code and none of the following applies).
When any change is made to the database the outstanding notification request completes and TRequestStatus contains a value indicating what type of change has occurred. The value is one of the enumerators of the RDbNotifier::TEvent enumeration.
Alternatively, if an outstanding notification request is cancelled by a call to this CCommsDatabase's CancelRequestNotification() member function, then the request completes with aStatus set to KErrCancel.
An outstanding notification request is also cancelled if the connection to the DBMS is severed through a call to DoClose().
This is an asynchonous request.
Parameter | Description |
---|---|
aStatus | A reference to the request status object. If the request is cancelled, this is set to KErrCancel. If the request completes normally, this is set to one of the enumerators of the RDbNotifier::TEvent enumeration. |
Returns: Any error from opening the notifier: KErrNone if successful, otherwise another of the system-wide error codes.
IMPORT_C void | ResolvePhoneNumberFromDatabaseL | ( | TDesC & | aNumber, |
TDes & | aDialString, | |||
TParseMode | aDialParseMode, | |||
TUint32 | aLocationId, | |||
TUint32 | aChargecardId | |||
) |
Resolves a given telephone number based on a specified dialling location and chargecard. A connection must already exist to the database.
The function does not resolve for mobile phones; aNumber is just copied to aDialString.
Parameter | Description |
---|---|
aNumber | A reference to the descriptor containing the number to be parsed. |
aDialString | On return, a reference to a descriptor which contains the parsed number. |
aDialParseMode | Indicates whether the parsed string is intended for dialling or for display. |
aLocationId | ID of the location record. |
aChargecardId | ID of the chargecard ID to be used for resolution. |
IMPORT_C void | ResolvePhoneNumberL | ( | TDesC & | aNumber, |
TDes & | aDialString, | |||
TParseMode | aDialParseMode, | |||
TUint32 | aLocationId, | |||
TUint32 | aChargecardId | |||
) | [static] |
Resolves a given telephone number based on a specified dialling location and chargecard. The function does not require a connection to the database server, but will form one itself.
The function does not resolve for mobile phones; aNumber is just copied to aDialString.
Parameter | Description |
---|---|
aNumber | The number to be parsed. |
aDialString | On return, contains the parsed number. |
aDialParseMode | Indicates whether the parsed string is intended for dialling or for display. |
aLocationId | ID of the dialling location record to be used for resolution. |
aChargecardId | ID of the chargecard ID to be used for resolution. |
void | RollbackInternalTransaction | ( | ) | [protected] |
Rollback the database after internal use - end a transaction
IMPORT_C void | RollbackTransaction | ( | ) |
IMPORT_C void | ShowHiddenRecords | ( | ) |
Ensures that hidden records are included in the search criteria when creating views using the member functions:
IMPORT_C TVersion | Version | ( | ) | const |
Gets the version from CommsDat.
Returns: The object containing the version information.