RDbNamedDatabase Class Reference

#include <d32dbms.h>

Link against: edbms.lib

class RDbNamedDatabase : public RDbDatabase

Inherits from

Detailed Description

Generic database implementation

Member Enumeration Documentation

Enum TAccess

Specifies which operations can be performed on a rowset.

EnumeratorValueDescription
EReadWrite
EReadOnly

Row navigation and reading are permitted.

Member Function Documentation

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

IMPORT_C TIntCreate(RDbs &aDbs,
const TDesC &aDatabase,
const TDesC &aFormat
)

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(), which first argument is a RFs reference (or RDbNamedDatabase::Replace()).

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

See also: RDbNamedDatabase::Create(RFs& aFs, const TDesC& aSource, const TDesC& aFormat) RDbNamedDatabase::Replace(RFs& aFs, const TDesC& aSource, const TDesC& aFormat)

ParameterDescription
aDbsA reference to DBMS session instance.
aDatabaseDatabase name. The name format is: <drive>:<name>.<ext>
aFormatDatabase format string. The string format is: "SECURE[UID]", where UID is the database security policy UID. "SECURE" keyword is case insensitive.

Returns: 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;

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

IMPORT_C TIntCreate(RFs &aFs,
const TDesC &aDatabase,
const TDesC &aFormat = TPtrC()
)

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(), which first argument is a RDbs reference.

See also: RDbNamedDatabase::Create(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)

ParameterDescription
aFsHandle to a file server session.
aDatabaseDatabase file name.
aFormatDatabase format string. It can be omitted in which case the default parameter value (TPtrC()) will be used.

Returns: 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;

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

IMPORT_C TIntOpen(RFs &aFs,
const TDesC &aDatabase,
const TDesC &aFormat = TPtrC(),
TAccessaMode = EReadWrite
)

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(), which first argument is a RDbs reference.

See also: RDbNamedDatabase::Open(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)

ParameterDescription
aFsHandle to a file server session.
aDatabaseDatabase name. The name format is: <drive>:<path><name>.<ext>
aFormatDatabase format string. It can be omitted in which case the default parameter value (TPtrC()) will be used.
aModeThe mode in which the database is to be accessed. The mode is defined by the TAccess type.

Returns: 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;

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

IMPORT_C TIntOpen(RDbs &aDbs,
const TDesC &aDatabase,
const TDesC &aFormat = TPtrC()
)

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(), which first argument is a RFs reference.

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

See also: RDbNamedDatabase::Open(RFs& aFs, const TDesC& aSource, const TDesC& aFormat, TAccess aMode).

ParameterDescription
aDbsA reference to DBMS session instance.
aDatabaseThe 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.
aFormatDatabase 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.

Returns: 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;

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

IMPORT_C TIntReplace(RFs &aFs,
const TDesC &aDatabase,
const TDesC &aFormat = TPtrC()
)

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(), which first argument is a RDbs reference.

See also: RDbNamedDatabase::Create(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)

ParameterDescription
aFsHandle to a file server session.
aDatabaseDatabase name. The name format is: <drive>:<path><name>.<ext>
aFormatDatabase format string. It can be omitted in which case the default parameter value (TPtrC()) will be used.

Returns: 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;