#include <d32dbms.h>
class RDbs : public RSessionBase |
Public Member Enumerations | |
---|---|
enum | TPolicyType { EReadPolicy, EWritePolicy, ESchemaPolicy } |
Public Member Functions | |
---|---|
IMPORT_C CDbStrings * | BackupPathsL(TSecureId, TUid) |
IMPORT_C TInt | Connect() |
IMPORT_C TInt | CopyDatabase(const TDesC &, const TDesC &, TUid) |
IMPORT_C CDbDatabaseNames * | DatabaseNamesL(TDriveNumber, TUid) |
IMPORT_C TInt | DeleteDatabase(const TDesC &, TUid) |
IMPORT_C void | FreeReservedSpace(TInt) |
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 void | ResourceCheck() |
IMPORT_C TInt | ResourceCount() |
IMPORT_C void | ResourceMark() |
IMPORT_C void | SetHeapFailure(TInt, TInt) |
IMPORT_C TVersion | Version() |
Inherited Attributes | |
---|---|
RHandleBase::iHandle |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes | |
RSessionBase:TAttachMode |
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.
IMPORT_C CDbStrings * | BackupPathsL | ( | TSecureId | aRequesterSid, |
TUid | aDbPolicyUid | |||
) |
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.
Parameter | Description |
---|---|
aDbPolicyUid | Database 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.
IMPORT_C TInt | Connect | ( | ) |
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.
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.
Parameter | Description |
---|---|
aSrcDbName | Source database name (<drive>:<name>.<ext> format) |
aDestDbName | Destination database name (<drive>:<name>.<ext> format) |
aPolicyUid | The 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;
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.
Parameter | Description |
---|---|
aDrive | The drive number to be searched. |
aPolicyUid | Database 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.
Deletes an existing secure shared database.
Parameter | Description |
---|---|
aDbName | Source database name (<drive>:<name>.<ext> format) |
aPolicyUid | Database 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;
IMPORT_C void | FreeReservedSpace | ( | TInt | aDriveNo | ) |
The method frees the reserved by the DBMS session disk space.
Parameter | Description |
---|---|
aDriveNo | Drive number, which reserved space has to be freed. |
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. Deprecated
Parameter | Description |
---|---|
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. |
aDbName | Secure shared database name, which path will be set in aBackupPath parameter. The name's format is <drive>:<name>.<ext> |
aDbPolicyUid | Database security policy UID. |
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. |
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.
IMPORT_C TInt | GetDatabasePolicy | ( | TUid | aPolicyUid, |
TPolicyType | aPolicyType, | |||
TSecurityPolicy & | aDbPolicy | |||
) |
Returns in the aDbPolicy output parameter the requested database security policy of type aPolicyType.
Parameter | Description |
---|---|
aPolicyUid | Database security policy UID. |
aPolicyType | Policy type: EReadPolicy, EWritePolicy, ESchemaPolicy. |
aDbPolicy | It 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.
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()
Parameter | Description |
---|---|
aDriveNo | Drive 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
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.
Parameter | Description |
---|---|
aPolicyUid | Database security policy UID. |
aTableName | Table name. |
aPolicyType | Policy type: EReadPolicy, EWritePolicy. |
aDbPolicy | It will be initialized with the requested security policy data after a successfull call. |
aTablePolicy | It 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;
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.
Parameter | Description |
---|---|
aPolicyUid | Database security policy UID. |
aTableName | Table name. |
aPolicyType | Policy type: EReadPolicy, EWritePolicy. |
aTablePolicy | It 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;
Revokes access on a given drive for RDbs session.
Parameter | Description |
---|---|
aDriveNo | Drive number with a reserved disk space, the access to which has to be released. |
Returns: KErrNone.
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()
Parameter | Description |
---|---|
aDriveNo | Drive number to reserve space on |
aSpace | This 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
IMPORT_C void | ResourceCheck | ( | ) |
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().
IMPORT_C TInt | ResourceCount | ( | ) |
Returns the number of DBMS objects allocated in this session.
Returns: The number of DBMS allocated objects.
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.
IMPORT_C TVersion | Version | ( | ) | [static] |
Returns the version of the DBMS server.
Returns: Version information.