RDbs Class Reference

class RDbs : public RSessionBase

Client-server databases

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.

Inherits from

Public Member Functions
IMPORT_C CDbStrings * BackupPathsL ( TSecureId , TUid )
IMPORT_C CDbDatabaseNames * DatabaseNamesL ( TDriveNumber , TUid )
IMPORT_C TInt DeleteDatabase (const TDesC &, TUid )
IMPORT_C TInt GetBackupPath ( TSecureId , const TDesC &, TUid , TDes &)
IMPORT_C TInt GetDatabasePolicy ( TUid , TPolicyType , TSecurityPolicy &)
IMPORT_C TInt GetReserveAccess ( TInt )
IMPORT_C TInt GetTablePolicies ( TUid , const TDesC &, TPolicyType , TSecurityPolicy &, TSecurityPolicy &)
IMPORT_C TInt GetTablePolicy ( TUid , const TDesC &, TPolicyType , TSecurityPolicy &)
IMPORT_C TInt ReleaseReserveAccess ( TInt )
IMPORT_C TInt ReserveDriveSpace ( TInt , TInt )
IMPORT_C TInt ResourceCount ()
IMPORT_C void ResourceMark ()
IMPORT_C void SetHeapFailure ( TInt , TInt )
IMPORT_C TVersion Version ()
Private Member Functions
TInt DoConnect ()
TInt GetPolicy ( TUid , const TDesC &, TUint , TSecurityPolicy &)
TInt SessionMessage ( TInt )
Inherited Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::Close()
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RSessionBase::CreateSession(RServer2,const TVersion &)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *)
RSessionBase::Open(RMessagePtr2,TInt,TOwnerType)
RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Open(TInt,TOwnerType)
RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Send(TInt)const
RSessionBase::Send(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt)const
RSessionBase::SendReceive(TInt,TRequestStatus &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSessionBase::SetReturnedHandle(TInt)
RSessionBase::SetReturnedHandle(TInt,RHandleBase &)
RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &)
RSessionBase::ShareAuto()
RSessionBase::ShareProtected()
Public Member Enumerations
enum TPolicyType { EReadPolicy , EWritePolicy , ESchemaPolicy }
Inherited Enumerations
RHandleBase:TAttributes
RSessionBase:TAttachMode
Inherited Attributes
RHandleBase::iHandle

Member Functions Documentation

BackupPathsL(TSecureId, TUid)

IMPORT_C CDbStrings * BackupPathsL ( TSecureId aRequesterSid,
TUid aDbPolicyUid
)

Parameters

TSecureId aRequesterSid
TUid aDbPolicyUid

DatabaseNamesL(TDriveNumber, TUid)

IMPORT_C CDbDatabaseNames * DatabaseNamesL ( TDriveNumber aDrive,
TUid aPolicyUid
)

Retrieves a list of names of secure shared databases, which share the same security policy, as determined by the supplied UID. If a database name is longer than KDbMaxName, it will not be added to the list.

leave
KErrNoMemory - not enough memory for the operation to be done
leave
KErrArgument - invalid UID parameter (including KNullUid value)
leave
KErrBadName - invalid drive number (not in A-Z range)
leave
KErrNotReady - the drive is not presented in the system
leave
Some other system-wide error codes

Parameters

TDriveNumber aDrive The drive number to be searched.
TUid aPolicyUid Database security policy UID.

DeleteDatabase(const TDesC &, TUid)

IMPORT_C TInt DeleteDatabase ( const TDesC & aDbName,
TUid aPolicyUid
)

Deletes an existing secure shared database.

capability
Note For a secure shared database, the caller must satisfy the schema access policy for the database.

Parameters

const TDesC & aDbName Source database name (<drive>:<name>.<ext> format)
TUid aPolicyUid Database security policy UID.

DoConnect()

TInt DoConnect ( ) [private]

GetBackupPath(TSecureId, const TDesC &, TUid, TDes &)

IMPORT_C TInt GetBackupPath ( TSecureId aRequesterSid,
const TDesC & aDbName,
TUid aDbPolicyUid,
TDes & aBackupPath
)

The method will fill out aBackupPath argument with the full path of aDbName secure shared database.

Parameters

TSecureId aRequesterSid Security ID of the process which is supposed to backup or restore the database. 0 or ECapability_None are invalid values for aRequesterSID parameter.
const TDesC & aDbName Secure shared database name, which path will be set in aBackupPath parameter. The name's format is <drive>:<name>.<ext>
TUid aDbPolicyUid Database security policy UID.
TDes & aBackupPath An output parameter. After a successfull call, the DBMS server will fill out the full database path there. aBackupPath must offer enough space to get the whole database path. Probably the best aBackupPath length is KMaxPath value.

GetDatabasePolicy(TUid, TPolicyType, TSecurityPolicy &)

IMPORT_C TInt GetDatabasePolicy ( TUid aPolicyUid,
TPolicyType aPolicyType,
TSecurityPolicy & aDbPolicy
)

Returns in the aDbPolicy output parameter the requested database security policy of type aPolicyType.

Parameters

TUid aPolicyUid Database security policy UID.
TPolicyType aPolicyType Policy type: EReadPolicy, EWritePolicy, ESchemaPolicy.
TSecurityPolicy & aDbPolicy It will be initialized with the requested security policy data after a successfull call.

GetPolicy(TUid, const TDesC &, TUint, TSecurityPolicy &)

TInt GetPolicy ( TUid aPolicyUid,
const TDesC & aTableName,
TUint aMask,
TSecurityPolicy & aPolicy
) [private]

Returns in aPolicy output parameter requested database/table security policy of type aPolicyType.

Parameters

TUid aPolicyUid Database security policy UID
const TDesC & aTableName Table name.
TUint aMask Bit-field: it includes ther policy type: EReadPolicy, EWritePolicy, ESchemaPolicy and the request type - database or table.
TSecurityPolicy & aPolicy It will be initialized with the requested security policy data after a successfull call.

GetReserveAccess(TInt)

IMPORT_C TInt GetReserveAccess ( TInt aDriveNo )

Grants access to a given area on a given drive for RDbs session. Note this session must have reserved space on this particular drive in order to be granted access to the reserved area.

RFs::GetReserveAccess()

Parameters

TInt aDriveNo Drive number with a reserved disk space, an access to which is requested.

GetTablePolicies(TUid, const TDesC &, TPolicyType, TSecurityPolicy &, TSecurityPolicy &)

IMPORT_C TInt GetTablePolicies ( TUid aPolicyUid,
const TDesC & aTableName,
TPolicyType aPolicyType,
TSecurityPolicy & aDbPolicy,
TSecurityPolicy & aTablePolicy
)

Returns in the aDbPolicy and aTablePolicy output parameters the requested database and table security policies of type aPolicyType.

Parameters

TUid aPolicyUid Database security policy UID.
const TDesC & aTableName Table name.
TPolicyType aPolicyType Policy type: EReadPolicy, EWritePolicy.
TSecurityPolicy & aDbPolicy It will be initialized with the requested security policy data after a successfull call.
TSecurityPolicy & aTablePolicy It will be initialized with the requested security policy data after a successfull call.

GetTablePolicy(TUid, const TDesC &, TPolicyType, TSecurityPolicy &)

IMPORT_C TInt GetTablePolicy ( TUid aPolicyUid,
const TDesC & aTableName,
TPolicyType aPolicyType,
TSecurityPolicy & aTablePolicy
)

Returns in the aTablePolicy output parameter the requested table security policy of type aPolicyType.

Parameters

TUid aPolicyUid Database security policy UID.
const TDesC & aTableName Table name.
TPolicyType aPolicyType Policy type: EReadPolicy, EWritePolicy.
TSecurityPolicy & aTablePolicy It will be initialized with the requested security policy data after a successfull call.

ReleaseReserveAccess(TInt)

IMPORT_C TInt ReleaseReserveAccess ( TInt aDriveNo )

Revokes access on a given drive for RDbs session.

panic
In debug mode there will be a panic with the line number as an error code if there is no reserved disk space for aDrive.
panic
In debug mode there will be a panic with the line number as an error code if there is no granted access to the reserved disk space.

Parameters

TInt aDriveNo Drive number with a reserved disk space, the access to which has to be released.

ReserveDriveSpace(TInt, TInt)

IMPORT_C TInt ReserveDriveSpace ( TInt aDriveNo,
TInt aSpace
)

Reserves a prederfined amount of disk space on aDrive drive. At the moment the max possible amount, allowed by the file server, is reserved on aDrive drive.

Use this call to ensure that if your "delete records" transaction fails because of "out of disk space" circumstances, you can get an access to the already reserved disk space and complete your transaction successfully the second time.

There is no strong, 100% guarantee, that the reserved disk space will always help the client in "low memory" situations.

RFs::ReserveDriveSpace()

Parameters

TInt aDriveNo Drive number to reserve space on
TInt aSpace This parameter is not used at the moment. The caller shall set it to 0.

ResourceCount()

IMPORT_C TInt ResourceCount ( )

Returns the number of DBMS objects allocated in this session.

ResourceMark()

IMPORT_C void ResourceMark ( )

Marks 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.

SessionMessage(TInt)

TInt SessionMessage ( TInt aFunction ) [private]

Parameters

TInt aFunction

SetHeapFailure(TInt, TInt)

IMPORT_C void SetHeapFailure ( TInt aTAllocFail,
TInt aRate
)

Parameters

TInt aTAllocFail
TInt aRate

Version()

IMPORT_C TVersion Version ( ) [static]

Returns the version of the DBMS server.

Member Enumerations Documentation

Enum TPolicyType

This enum is used in GetDatabasePolicy/GetTablePolicy/GetTablePolicies calls and specifies requested security policy type: read/write/schema.

Enumerators

EReadPolicy
EWritePolicy
ESchemaPolicy