Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <D32DBMS.H>
Link against: edbms.lib

Class RDbNamedDatabase

class RDbNamedDatabase : public RDbDatabase;

Description

Generic database implementation

Derivation

Members

Defined in RDbNamedDatabase:

Inherited from RDbDatabase:


Member functions


Create(RDbs &,const TDesC &,const TDesC &)

Capability: Security policy note: For a secure shared database, the caller must satisfy the schema access policy for the database.

IMPORT_C TInt Create(RDbs &aDbs, const TDesC &aDatabase, const TDesC &aFormat);

Description

Creates a secure shared database. Max allowed database name length (with the extension) is KDbMaxName symbols.

In this "client-server" mode the database can be shared with the other clients.

For creating a non-secure database, see RDbNamedDatabase::Create(RDbs &,const TDesC &,const TDesC &), which first argument is a RFs reference (or RDbNamedDatabase::Replace(RFs &,const TDesC &,const TDesC &)).

Parameters

RDbs &aDbs

A reference to DBMS session instance.

const TDesC16 &aDatabase

Database name. The name format is: <drive>:<name>.<ext>

const TDesC16 &aFormat

Database format string. The string format is: "SECURE[UID]", where UID is the database security policy UID. "SECURE" keyword is case insensitive.

Return value

TInt

KErrNone if successful otherwise one of the system-wide error codes, including: KErrAlreadyExists - the database already exists; KErrNotSupported - invalid format string; KErrArgument - bad argument, including null/invaluid uids, the database name includes a path; KErrPermissionDenied - the caller has not enough rights to do the operation;

See also:


Create(RFs &,const TDesC &,const TDesC &)

IMPORT_C TInt Create(RFs &aFs, const TDesC &aDatabase, const TDesC &aFormat=TPtrC());

Description

Creates a new non-secure database.

In this "single client" mode, the database cannot be shared with the other clients. The database server is not involved in the operations with the database, the client side database library (edbms.dll) will be used. If the database has to be shared, the following example shows how this may be accomplished:

RFs fs;
TInt err = fs.Connect();
<process the error>
_LIT(KDatabaseName, _L("C:\\A.DB"));
RDbNamedDatabase db;
err = db.Create(fs, KDatabaseName);      //Step 1 - create the database using the RFs object
<process the error>
db.Close();                             //Step 2 - close the database
RDbs dbs;
err = dbs.Connect();
<process the error>
err = db.Open(dbs, KDatabaseName);       //Step 3 - reopen the database using the RDbs object
<process the error>
...

Max allowed database name length (with the extension) is KDbMaxName symbols.

For creating a new secure shared database, see RDbNamedDatabase::Create(RDbs &,const TDesC &,const TDesC &), which first argument is a RDbs reference.

Parameters

RFs &aFs

Handle to a file server session.

const TDesC16 &aDatabase

Database file name.

const TDesC16 &aFormat

Database format string. It can be omitted in which case the default parameter value (TPtrC) will be used.

Return value

TInt

KErrNone if successful otherwise one of the system-wide error codes, including: KErrAlreadyExists - the database already exists; KErrArgument - bad argument, including null/invaluid uids, the database name includes a null;

See also:


Replace(RFs &,const TDesC &,const TDesC &)

IMPORT_C TInt Replace(RFs &aFs, const TDesC &aDatabase, const TDesC &aFormat=TPtrC());

Description

Creates a new non-secure database. If a database with the same file name exists, it will be replased.

In this "single client" mode, the database cannot be shared with the other clients. The database server is not involved in the operations with the database, the client side database library (edbms.dll) will be used. If the database has to be shared, the following example shows how this may be accomplished:

RFs fs;
TInt err = fs.Connect();
<process the error>
_LIT(KDatabaseName, _L("C:\\A.DB"));
RDbNamedDatabase db;
err = db.Replace(fs, KDatabaseName); //Step 1 - create the database using the RFs object
<process the error>
db.Close();                             //Step 2 - close the database
RDbs dbs;
err = dbs.Connect();
<process the error>
err = db.Open(dbs, KDatabaseName);       //Step 3 - reopen the database using the RDbs object
<process the error>
...

Max allowed database name length (with the extension) is KDbMaxName symbols.

For creating a new secure shared database, see RDbNamedDatabase::Create(RDbs &,const TDesC &,const TDesC &), which first argument is a RDbs reference.

Parameters

RFs &aFs

Handle to a file server session.

const TDesC16 &aDatabase

Database name. The name format is: :.

const TDesC16 &aFormat

Database format string. It can be omitted in which case the default parameter value (TPtrC) will be used.

Return value

TInt

KErrNone if successful otherwise one of the system-wide error codes, including: KErrArgument - bad argument, including null/invaluid uids, the database name includes a null;

See also:


Open(RFs &,const TDesC &,const TDesC &,TAccess)

IMPORT_C TInt Open(RFs &aFs, const TDesC &aDatabase, const TDesC &aFormat=TPtrC(), TAccess aMode=EReadWrite);

Description

Opens an existing non-secure database.

In this "single client" mode, the database cannot be shared with the other clients. The database server is not involved in the operations with the database, the client side database library (edbms.dll) will be used.

For opening a new secure shared database, see RDbNamedDatabase::Open(RFs &,const TDesC &,const TDesC &,TAccess), which first argument is a RDbs reference.

Parameters

RFs &aFs

Handle to a file server session.

const TDesC16 &aDatabase

Database name. The name format is: :.

const TDesC16 &aFormat

Database format string. It can be omitted in which case the default parameter value (TPtrC) will be used.

RDbNamedDatabase::TAccess aMode

The mode in which the database is to be accessed. The mode is defined by the TAccess type.

Return value

TInt

KErrNone if successful otherwise one of the system-wide error codes, including: KErrNotFound - the database is not found; KErrPathNotFound - the path of database is not found KErrNotSupported - the format is not supported. KErrArgument - bad argument,including null/invaluid uids,the database name is null; KErrPermissionDenied - the caller has not enough rights to do the operation;

See also:


Open(RDbs &,const TDesC &,const TDesC &)

Capability: Security policy note: For a secure shared database, the caller must satisfy the read, the write or the schema access policy for the database.

IMPORT_C TInt Open(RDbs &aDbs, const TDesC &aDatabase, const TDesC &aFormat=TPtrC());

Description

Opens an existing shared secure or non-secure database. Max allowed database name length (with the extension) is KDbMaxName symbols.

In this "client-server" mode the database can be shared with the other clients.

For opening a single, non-shareable connection to the database, see RDbNamedDatabase::Open(RFs &,const TDesC &,const TDesC &,TAccess), which first argument is a RFs reference.

Parameters

RDbs &aDbs

A reference to DBMS session instance.

const TDesC16 &aDatabase

The name of the file that hosts the database. If this is a secure database, then the format of the name must be: <drive>:<database file name excluding the path>. If this is a non-secure database, then aDatabase has to be the full database file name.

const TDesC16 &aFormat

Database format string. For shared secure databases the string format is: "SECURE[UID]", where UID is the database security policy UID. "SECURE" keyword is case insensitive. For shared non-secure databases, the default parameter value (TPtrC) can be used.

Return value

TInt

KErrNone if successful otherwise one of the system-wide error codes, including: KErrNotFound - the database is not found; KErrArgument - bad argument, including null/invaluid uids, the database name includes a path; KErrPermissionDenied - the caller has not enough rights to do the operation;

See also:

[Top]


Member enumerations


Enum TAccess

TAccess

Description

Specifies which operations can be performed on a rowset.

EReadWrite

EReadOnly

Row navigation and reading are permitted.