Symbian3/SDK/Source/GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-&gt;SetTypeL(TUidType(fstore-&gt;Layout(),KDatabaseUid,TUid::Uid(0x10001234)));
RDbStoreDatabase database;
fstore-&gt;SetRootL(database.CreateL(fstore));
fstore-&gt;CommitL();</codeblock>
<p>A named database may be encrypted; the default is an un-encrypted database.</p>
</conbody></concept>