Symbian3/PDK/Source/GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9.dita
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 14 578be2adaf3e
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <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");
    12 <concept id="GUID-EFA822E0-BE80-5EB8-82E5-1659BDB1BDD9" xml:lang="en"><title>Named
       
    13 database</title><shortdesc>Describes how databases can be created and opened using the database
       
    14 name.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>In order to support the DBMS client-server interface, the <codeph>RDbNamedDatabase</codeph> class
       
    16 provides the interface for creating and opening databases identified by name.</p>
       
    17 <p>The mechanism is generic; the database is identified by its name and the
       
    18 database format. The format is a name that is used to identify the implementation
       
    19 used for creating or opening that database. There is a default format, which
       
    20 has the name "epoc". The default format is a store database in the root stream
       
    21 of the database file.</p>
       
    22 <p>If required, other formats can be provided in extension DBMS driver libraries.
       
    23 These formats need no be file-based. Additional DBMS driver libraries are
       
    24 dynamically bound to the API at run-time, if one can be found to support the
       
    25 format requested.</p>
       
    26 <p>Formats which are UidTyped files, such as the default, can allow the client
       
    27 to specify a 3rd Uid by extending the format name with the Uid name (as generated
       
    28 by the <codeph>Name()</codeph> member function of <codeph>TUid</codeph>, an
       
    29 8 digit hexadecimal number enclosed in square brackets).</p>
       
    30 <p>If specified, this is also checked when a database is opened. e.g. creating
       
    31 a FileStore database “C:\My Database” with a 3rd Uid of 0x10001234:</p>
       
    32 <codeblock id="GUID-2291B3E7-D3D5-5E99-8ACA-886163557978" xml:space="preserve">_LIT(KMydatabase,"C:\\My Database");
    13 _LIT(KDemoUid,"[10001234]");
    33 _LIT(KDemoUid,"[10001234]");
    14 RDbNamedDatabase database;
    34 RDbNamedDatabase database;
    15 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");
    35 TInt r=database.Create(fs,KMydatabase,KDemoUid);</codeblock>
       
    36 <p>For comparison, the equivalent code required to create an <codeph>RDbStoreDatabase</codeph> in
       
    37 the root of a <codeph>CPermanentFileStore</codeph> would have been:</p>
       
    38 <codeblock id="GUID-B103A01B-55C0-50B5-81F7-F2763E5E16DB" xml:space="preserve">_LIT(KMydatabase,"C:\\My Database");
    16 CFileStore* fstore=CPermanentFileStore::ReplaceLC(fs,KMydatabase,EFileWrite);
    39 CFileStore* fstore=CPermanentFileStore::ReplaceLC(fs,KMydatabase,EFileWrite);
    17 fstore-&gt;SetTypeL(TUidType(fstore-&gt;Layout(),KDatabaseUid,TUid::Uid(0x10001234)));
    40 fstore-&gt;SetTypeL(TUidType(fstore-&gt;Layout(),KDatabaseUid,TUid::Uid(0x10001234)));
    18 RDbStoreDatabase database;
    41 RDbStoreDatabase database;
    19 fstore-&gt;SetRootL(database.CreateL(fstore));
    42 fstore-&gt;SetRootL(database.CreateL(fstore));
    20 fstore-&gt;CommitL();</codeblock> <p>A named database may be encrypted; the default is an un-encrypted database.</p> </conbody></concept>
    43 fstore-&gt;CommitL();</codeblock>
       
    44 <p>A named database may be encrypted; the default is an un-encrypted database.</p>
       
    45 </conbody></concept>