Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Named database

In order to support the DBMS client-server interface, the RDbNamedDatabase class provides the interface for creating and opening databases identified by name.

The mechanism is generic; the database is identified by its name and the database format. The format is a name that is used to identify the implementation used for creating or opening that database. There is a default format, which has the name "epoc". The default format is a store database in the root stream of the database file.

If required, other formats can be provided in extension DBMS driver libraries. These formats need no be file-based. Additional DBMS driver libraries are dynamically bound to the API at run-time, if one can be found to support the format requested.

Formats which are UidTyped files, such as the default, can allow the client to specify a 3rd Uid by extending the format name with the Uid name (as generated by the Name() member function of TUid, an 8 digit hexadecimal number enclosed in square brackets).

If specified, this is also checked when a database is opened. e.g. creating a FileStore database C:\My Database with a 3rd Uid of 0x10001234:

_LIT(KMydatabase,"C:\\My Database");
_LIT(KDemoUid,"[10001234]");
RDbNamedDatabase database;
TInt r=database.Create(fs,KMydatabase,KDemoUid);

For comparison, the equivalent code required to create an RDbStoreDatabase in the root of a CPermanentFileStore would have been:

_LIT(KMydatabase,"C:\\My Database");
CFileStore* fstore=CPermanentFileStore::ReplaceLC(fs,KMydatabase,EFileWrite);
fstore->SetTypeL(TUidType(fstore->Layout(),KDatabaseUid,TUid::Uid(0x10001234)));
RDbStoreDatabase database;
fstore->SetRootL(database.CreateL(fstore));
fstore->CommitL();

A named database may be encrypted; the default is an un-encrypted database.