EPOC   SDK Home Glossary Indexes Previous Next Up

RDbs class


Contents


RDbs class — Session with the DBMS server

Section Contents


Overview

Compatibility

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

Derivation

RHandleBase

Abstract: handle to an object

RSessionBase

Abstract: base class for handle to a session

RDbs

Session with the DBMS server.

Defined in

d32dbms.h

Link against

edbms.lib

Description

This class represents a session with the DBMS server. A thread uses this class to set up a DBMS server session and this provides the basis for sharing databases with other threads.


Connecting to the DBMS server


Connect() — Make a connection with the DBMS server

TInt Connect();

Description

Use this function to make a connection with the DBMS server. This function causes the server to start, if it is not already running.

Connect() should be the first function called on an RDbs object after it is created.

Once a connection has been established, databases can be opened through the server.

Return value

TInt

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

Notes

Threads can make any number of simultaneous connections to the DBMS server.

The session must stay open until all DBMS objects opened through the server have been closed.

The session is terminated by calling the Close() member function provided by the RHandleBase class.


Information


Version() — Version information

static TVersion Version();

Description

Use this function to return the version of the DBMS server.

Return value

TVersion

The object containing the version information.


Utility functions for checking allocated DBMS objects


ResourceMark() — Mark start point for checking number of allocated DBMS objects

void ResourceMark();

Description

Use this function to mark the start point for checking the number of DBMS objects allocated in this session.

The function takes the current number of allocated DBMS objects as its benchmark number.

A call to this function is normally followed by a later call to ResourceCheck() which expects that the number of allocated DBMS objects to be the same as this benchmark number.


ResourceCheck() — Check the number of allocated DBMS objects

void ResourceCheck();

Description

Use this function to check that the number of DBMS objects allocated in this session is the same as the benchmark number recorded by an earlier call to ResourceMark().

The function raises a CSession 2 panic if the current number of DBMS objects is not the same as that recorded by an earlier call to ResourceMark().


ResourceCount() — Fetch number of DBMS objects allocated in this session

TInt ResourceCount();

Description

Use this function to return the number of DBMS objects allocated in this session.

Return value

TInt

The number of DBMS allocated objects.


Debugging support for the DBMS server heap


SetHeapFailure() — Simulate DBMS server heap allocation failure

void SetHeapFailure(RHeap::TAllocFail aType,TInt aRate);

Description

Use this function to simulate a heap allocation failure in the DBMS server's heap.

The function behaves as described by the __DbgSetAllocFail() member function of the User class.

Arguments

RHeap::TAllocFail aType

An enumeration which indicates how to simulate allocation failure in the DBMS server's heap. This is one of:

RHeap::EFailNext - the next attempt to allocate from the heap fails.

RHeap::ERandom - attempts to allocate from the heap fail at a random rate; however, the interval pattern between failures is the same every time simulation is started.

RHeap::ETrueRandom - attempts to allocate from the heap fail at a random rate. The interval pattern between failures may be different every time simulation is started.

RHeap::EDeterministic - attempts to allocate from the heap fail at a rate aRate; for example, if aRate is 3, allocation fails at every third attempt.

RHeap::ENone - cancels simulated heap allocation failure.

TInt aRate

The rate of failure;
when aType is RHeap::EDeterministic, heap allocation fails every aRate attempt

Notes

The function has no effect if running with a release build of EUSER.DLL.

EPOC       SDK Home Glossary Indexes Previous Next Up