RDbs Class Reference

#include <d32dbms.h>

Link against: edbms.lib

class RDbs : public RSessionBase

Inherits from

  • RDbs
    Public Member Enumerations
    enumTPolicyType { EReadPolicy, EWritePolicy, ESchemaPolicy }
    Public Member Functions
    IMPORT_C CDbStrings *BackupPathsL(TSecureId, TUid)
    IMPORT_C TIntConnect()
    IMPORT_C TIntCopyDatabase(const TDesC &, const TDesC &, TUid)
    IMPORT_C CDbDatabaseNames *DatabaseNamesL(TDriveNumber, TUid)
    IMPORT_C TIntDeleteDatabase(const TDesC &, TUid)
    IMPORT_C voidFreeReservedSpace(TInt)
    IMPORT_C TIntGetBackupPath(TSecureId, const TDesC &, TUid, TDes &)
    IMPORT_C TIntGetDatabasePolicy(TUid, TPolicyType, TSecurityPolicy &)
    IMPORT_C TIntGetReserveAccess(TInt)
    IMPORT_C TIntGetTablePolicies(TUid, const TDesC &, TPolicyType, TSecurityPolicy &, TSecurityPolicy &)
    IMPORT_C TIntGetTablePolicy(TUid, const TDesC &, TPolicyType, TSecurityPolicy &)
    IMPORT_C TIntReleaseReserveAccess(TInt)
    IMPORT_C TIntReserveDriveSpace(TInt, TInt)
    IMPORT_C voidResourceCheck()
    IMPORT_C TIntResourceCount()
    IMPORT_C voidResourceMark()
    IMPORT_C voidSetHeapFailure(TInt, TInt)
    IMPORT_C TVersionVersion()
    Inherited Attributes
    RHandleBase::iHandle
    Inherited Enumerations
    RHandleBase:TAttributes
    RSessionBase:TAttachMode
    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()

    Detailed Description

    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.

    Member Enumeration Documentation

    Enum TPolicyType

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

    EnumeratorValueDescription
    EReadPolicy
    EWritePolicy
    ESchemaPolicy

    Member Function Documentation

    BackupPathsL ( TSecureId, TUid )

    IMPORT_C CDbStrings *BackupPathsL(TSecureIdaRequesterSid,
    TUidaDbPolicyUid
    )

    Retrieves a list of paths of secure shared databases, which share the same security policy, as determined by the supplied aDbPolicyUid parameter. Note: If there is a database file which full path length is bigger than KDbMaxStrLen characters, then this file will not be added to the returned CDbStrings array.

    leave
    KErrArgument - 0 or ECapability_None process SID, null database security UID.
    leave
    KErrPermissionDenied - the supplied process SID does not match the database backup& restore SID or the database backup&restore SID is 0 or ECapability_None.
    leave
    Some other system-wide error codes
    ParameterDescription
    aDbPolicyUidDatabase security policy UID.

    Returns: A list with paths of the found databases, which have the same database security uid. The caller is resonsible for deleting the database paths list.

    Connect ( )

    IMPORT_C TIntConnect()

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

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

    Note that:

    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 RSessionBase class.

    Returns: KErrNone if successful, otherwise another of the system-wide error codes.

    CopyDatabase ( const TDesC &, const TDesC &, TUid )

    IMPORT_C TIntCopyDatabase(const TDesC &aSrcDbName,
    const TDesC &aDestDbName,
    TUidaPolicyUid
    )

    Copies an existing secure shared database to a new secure shared database. The new database will have the same security policy as the old one. The maximum length of the target database name (with the extension) is KDbMaxName.

    capability
    Note For a secure shared database, the caller must satisfy the schema access policy for the database.
    ParameterDescription
    aSrcDbNameSource database name (<drive>:<name>.<ext> format)
    aDestDbNameDestination database name (<drive>:<name>.<ext> format)
    aPolicyUidThe database security policy UID. The destination database will have the same policy UID.

    Returns: KErrNone if successful, otherwise one of the system-wide error codes, including: KErrPermissionDenied - the caller has not enough rights to do the operation or the destination drive is a ROM drive; KErrArgument - invalid source or destination database names (null name, too long name, only drive letter); invalid or null UID; KErrNotReady - the drive in database name is not presented in the system; KErrNotFound - the source database not found; KErrInUse - the source database is in use; KErrAlreadyExists - the destination database already exists; KErrNoMemory - not enough memory for the operation to be done;

    DatabaseNamesL ( TDriveNumber, TUid )

    IMPORT_C CDbDatabaseNames *DatabaseNamesL(TDriveNumberaDrive,
    TUidaPolicyUid
    )

    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
    ParameterDescription
    aDriveThe drive number to be searched.
    aPolicyUidDatabase security policy UID.

    Returns: A list with names of the found databases, which have the same database security uid. The database name output format is: <name>.<ext>. The caller is resonsible for deleting the database names list.

    DeleteDatabase ( const TDesC &, TUid )

    IMPORT_C TIntDeleteDatabase(const TDesC &aDbName,
    TUidaPolicyUid
    )

    Deletes an existing secure shared database.

    capability
    Note For a secure shared database, the caller must satisfy the schema access policy for the database.
    ParameterDescription
    aDbNameSource database name (<drive>:<name>.<ext> format)
    aPolicyUidDatabase security policy UID.

    Returns: KErrNone if successful, otherwise one of the system-wide error codes, including: KErrInUse (if the database is in use at the moment); KErrNotFound - the database not found; KErrPermissionDenied - the caller has not enough rights to do the operation;

    FreeReservedSpace ( TInt )

    IMPORT_C voidFreeReservedSpace(TIntaDriveNo)

    The method frees the reserved by the DBMS session disk space.

    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 the reserved disk space is granted but not released.
    ParameterDescription
    aDriveNoDrive number, which reserved space has to be freed.

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

    IMPORT_C TIntGetBackupPath(TSecureIdaRequesterSid,
    const TDesC &aDbName,
    TUidaDbPolicyUid,
    TDes &aBackupPath
    )

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

    ParameterDescription
    aRequesterSidSecurity ID of the process which is supposed to backup or restore the database. 0 or ECapability_None are invalid values for aRequesterSID parameter.
    aDbNameSecure shared database name, which path will be set in aBackupPath parameter. The name's format is <drive>:<name>.<ext>
    aDbPolicyUidDatabase security policy UID.
    aBackupPathAn 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.

    Returns: KErrNone if successful, otherwise one of the system-wide error codes, including:KErrArgument - 0 or ECapability_None process SID, null UID, null or invalid database name, the database is not secure shared database;KErrNotFound - the database file does not exist;KErrPermissionDenied - the supplied process SID does not match the database backup& restore SID or the database backup&restore SID is 0 or ECapability_None.

    GetDatabasePolicy ( TUid, TPolicyType, TSecurityPolicy & )

    IMPORT_C TIntGetDatabasePolicy(TUidaPolicyUid,
    TPolicyTypeaPolicyType,
    TSecurityPolicy &aDbPolicy
    )

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

    ParameterDescription
    aPolicyUidDatabase security policy UID.
    aPolicyTypePolicy type: EReadPolicy, EWritePolicy, ESchemaPolicy.
    aDbPolicyIt will be initialized with the requested security policy data after a successfull call.

    Returns: KErrNone if successful, otherwise one of the system-wide error codes, including KErrArgument - some of the arguments has an invalid value.

    GetReserveAccess ( TInt )

    IMPORT_C TIntGetReserveAccess(TIntaDriveNo)

    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.

    See also: RFs::GetReserveAccess()

    ParameterDescription
    aDriveNoDrive number with a reserved disk space, an access to which is requested.

    Returns: KErrArgument Invalid drive or there is no reserved disk space on aDriveNo. KErrInUse An access to the reserved space has already been given. RFs::GetReserveAccess() return values

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

    IMPORT_C TIntGetTablePolicies(TUidaPolicyUid,
    const TDesC &aTableName,
    TPolicyTypeaPolicyType,
    TSecurityPolicy &aDbPolicy,
    TSecurityPolicy &aTablePolicy
    )

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

    ParameterDescription
    aPolicyUidDatabase security policy UID.
    aTableNameTable name.
    aPolicyTypePolicy type: EReadPolicy, EWritePolicy.
    aDbPolicyIt will be initialized with the requested security policy data after a successfull call.
    aTablePolicyIt will be initialized with the requested security policy data after a successfull call.

    Returns: KErrNone if successful, otherwise one of the system-wide error codes, including: KErrArgument - some of the arguments has an invalid value. KErrNotSupported - the method has been called with aPolicyType = ESchemaPolicy;

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

    IMPORT_C TIntGetTablePolicy(TUidaPolicyUid,
    const TDesC &aTableName,
    TPolicyTypeaPolicyType,
    TSecurityPolicy &aTablePolicy
    )

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

    ParameterDescription
    aPolicyUidDatabase security policy UID.
    aTableNameTable name.
    aPolicyTypePolicy type: EReadPolicy, EWritePolicy.
    aTablePolicyIt will be initialized with the requested security policy data after a successfull call.

    Returns: KErrNone if successful, otherwise one of the system-wide error codes, including: KErrArgument - some of the arguments has an invalid value. KErrNotSupported - the method has been called with aPolicyType = ESchemaPolicy;

    ReleaseReserveAccess ( TInt )

    IMPORT_C TIntReleaseReserveAccess(TIntaDriveNo)

    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.
    ParameterDescription
    aDriveNoDrive number with a reserved disk space, the access to which has to be released.

    Returns: KErrNone.

    ReserveDriveSpace ( TInt, TInt )

    IMPORT_C TIntReserveDriveSpace(TIntaDriveNo,
    TIntaSpace
    )

    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.

    See also: RFs::ReserveDriveSpace()

    ParameterDescription
    aDriveNoDrive number to reserve space on
    aSpaceThis parameter is not used at the moment. The caller shall set it to 0.

    Returns: KErrNoMemory Out of memory KErrArgument Invalid aDriveNo. KErrInUse The space has already been reserved RFs::ReserveDriveSpace() return value

    ResourceCheck ( )

    IMPORT_C voidResourceCheck()

    Checks 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 ( )

    IMPORT_C TIntResourceCount()

    Returns the number of DBMS objects allocated in this session.

    Returns: The number of DBMS allocated objects.

    ResourceMark ( )

    IMPORT_C voidResourceMark()

    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.

    SetHeapFailure ( TInt, TInt )

    IMPORT_C voidSetHeapFailure(TIntaTAllocFail,
    TIntaRate
    )

    Version ( )

    IMPORT_C TVersionVersion()[static]

    Returns the version of the DBMS server.

    Returns: Version information.