Symbian3/SDK/Source/GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 15:24:26 +0000
changeset 2 ebc84c812384
parent 0 89d6a7a84779
permissions -rw-r--r--
week 10 bug fix submission: Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?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 xml:lang="en" id="GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9"><title>Named database</title><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>