Symbian3/SDK/Source/GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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>