Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: D32DBMS.H
Link against: edbms.lib

Class RDbNamedDatabase

class RDbNamedDatabase : public RDbDatabase;

Description

Generic database implementation

Derivation

Members

Defined in RDbNamedDatabase:
Create(), Create(), EReadOnly, EReadWrite, Open(), Open(), Replace(), TAccess

Inherited from RDbDatabase:
AlterTable(), Begin(), Close(), ColSetL(), Commit(), Compact(), CreateIndex(), CreateTable(), Destroy(), DropIndex(), DropTable(), Execute(), InTransaction(), IndexNamesL(), IsDamaged(), KeyL(), Recover(), Rollback(), Size(), TSize, TableNamesL(), UpdateStats(), iDatabase


Member functions


Create()

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

Parameters

RDbs &aDbs

A reference to DBMS session instance.

const TDesC &aDatabase

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

const TDesC &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;


Create()

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

Parameters

RFs &aFs

Handle to a file server session.

const TDesC &aDatabase

Database file name.

const TDesC &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;


Replace()

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

Parameters

RFs &aFs

Handle to a file server session.

const TDesC &aDatabase

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

const TDesC &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;


Open()

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

Parameters

RFs &aFs

Handle to a file server session.

const TDesC &aDatabase

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

const TDesC &aFormat

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

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;


Open()

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

Parameters

RDbs &aDbs

A reference to DBMS session instance.

const TDesC &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 TDesC &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;

[Top]


Member enumerations


Enum TAccess

TAccess

Description

Specifies which operations can be performed on a rowset.

EReadWrite

EReadOnly

Row navigation and reading are permitted.