EPOC   SDK Home Glossary Indexes Previous Next Up

RDbNamedDatabase class


Contents


RDbNamedDatabase class — Interface to a named database

Section Contents


Overview

Compatibility

Applications that use this class will not work correctly on a version of EPOC earlier than ER5.

Derivation

RDbDatabase

Abstract: database behaviour

RDbNamedDatabase

Interface to a database identified by name.

Defined in

d32dbms.h

Link against

edbms.lib

Description

This class provides the interface for creating and opening a database identified by name and its format.

For exclusive read/write or shared read/only access, the database is accessed on the client side through a file server session.

For shared read/write access, the database must be accessed through a DBMS server session.


Create a database


Create() — Create a new database and open for exclusive read/write access

TInt Create(RFs& aFs,const TDesC& aDatabase,const TDesC& aFormat=TPtrC(),CSecurityEncryptBase* aKey=0);

Description

Use this function to create a new database using the supplied format specification. The database must not already exist, otherwise the function fails.

On successful return, the database is open for exclusive read/write access by the client.

This function initiates client-side access to the database through a file server session and does not require a connection to the DBMS server.

Arguments

RFs& aFs

A reference to a file server session through which the database is accessed.

See file server for general information on the file server.

const TDesC& aDatabase

A reference to a descriptor containing the name of the database.

const TDesC& aFormat

A reference to a descriptor containing the format name of the database.

The default format implies a Store database in the root stream of the named file.

CSecurityEncryptBase* aKey

A pointer to an encryption key (as returned , for example, from a call to CSecurityBase::NewEncryptL()); this is used to create authentication data in the database.

The default value is NULL and implies an unencrypted database.

Return value

TInt

KErrNone if successful or one of the system error codes; see system error codes.


Replace() — Create a replacement database and open for exclusive read/write access

TInt Replace(RFs& aFs,const TDesC& aDatabase,const TDesC& aFormat=TPtrC(),CSecurityEncryptBase* aKey=0);

Description

Use this function to create a database using the supplied format specification and replace any existing database with the same name.

On successful return, the database is open for exclusive read/write access by the client.

This function initiates client-side access to the database through a file server session and does not require a connection to the DBMS server.

Arguments

RFs& aFs

A reference to a file server session through which the database is accessed.

See file server for general information on the file server.

const TDesC& aDatabase

A reference to a descriptor containing the name of the database.

const TDesC& aFormat

A reference to a descriptor containing the format name of the database.

The default format implies a Store database in the root stream of the named file.

CSecurityEncryptBase* aKey

A pointer to an encryption key (as returned , for example, from a call to CSecurityBase::NewEncryptL()); this is used to create authentication data in the database

The default value is NULL and implies an unencrypted database.

Return value

TInt

KErrNone if successful or one of the system error codes; see system error codes.


Open a database


Open() — Open a database for client side access

TInt Open(RFs& aFs,const TDesC& aDatabase,const TDesC& aFormat=TPtrC(),CSecurityDecryptBase* aKey=0,TAccess aMode=EReadWrite);

Description

Use this function to open a database, using the supplied format specification, for client side access.

On successful return, the database is open for either exclusive read/write access or shared read/only access by the client, as determined by the file access mode aMode.

This function initiates client-side access to the database through a file server session and does not require a connection to the DBMS server.

Arguments

RFs& aFs

A reference to a file server session through which the database is accessed.

See file server for general information on the file server.

const TDesC& aDatabase

A reference to a descriptor containing the name of the database.

const TDesC& aFormat

A reference to a descriptor containing the format name of the database.

The default format implies a Store database in the root stream of the named file.

CSecurityDecryptBase* aKey

A pointer to a decryption key which should match the database encryption key.

The default value is NULL and implies an unencrypted database.

TAccess aMode

The access mode; the default is exclusive read/write mode.

Return value

TInt

KErrNone if successful or one of the system error codes; see system error codes.


Open() — Open a database through a DBMS server session

TInt Open(RDbs& aDbs,const TDesC& aDatabase,const TDesC& aFormat=TPtrC(),CSecurityDecryptBase* aKey=0);

Description

Use this function to open a database, using the supplied format specification, through a DBMS server session.

On successful return, the database can be shared by multiple threads where at least one of them needs write access.

Arguments

RDbs& aDbs

A reference to a session with the DBMS through which the database is accessed.

const TDesC& aDatabase

A reference to a descriptor containing the name of the database.

const TDesC& aFormat

A reference to a descriptor containing the format name of the database.

The default format implies a Store database in the root stream of the named file.

CSecurityDecryptBase* aKey

A pointer to a decryption key which should match the database encryption key.

The default value is NULL and implies an unencrypted database.

Return value

TInt

KErrNone if successful or one of the system error codes; see system error codes.


Enumerations


TAccess enum — Access mode for opening a database on the client side

Description

This enumeration defines the required access mode when opening a database for client side access through a file server session.

EReadWrite

The database is to be opened in exclusive read/write mode.

EReadOnly

The database is to be opened in shared read-only mode.

EPOC       SDK Home Glossary Indexes Previous Next Up