Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9" xml:lang="en"><title>Named
database</title><shortdesc>Describes how databases can be created and opened using the database
name.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>In order to support the DBMS client-server interface, the <codeph>RDbNamedDatabase</codeph> class
provides the interface for creating and opening databases identified by name.</p>
<p>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.</p>
<p>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.</p>
<p>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 <codeph>Name()</codeph> member function of <codeph>TUid</codeph>, an
8 digit hexadecimal number enclosed in square brackets).</p>
<p>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:</p>
<codeblock id="GUID-2291B3E7-D3D5-5E99-8ACA-886163557978" xml:space="preserve">_LIT(KMydatabase,"C:\\My Database");
_LIT(KDemoUid,"[10001234]");
RDbNamedDatabase database;
TInt r=database.Create(fs,KMydatabase,KDemoUid);</codeblock>
<p>For comparison, the equivalent code required to create an <codeph>RDbStoreDatabase</codeph> in
the root of a <codeph>CPermanentFileStore</codeph> would have been:</p>
<codeblock id="GUID-B103A01B-55C0-50B5-81F7-F2763E5E16DB" xml:space="preserve">_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();</codeblock>
<p>A named database may be encrypted; the default is an un-encrypted database.</p>
</conbody></concept>