Symbian3/SDK/Source/GUID-231840A2-255B-5200-8AD1-1D7667FCB448.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-231840A2-255B-5200-8AD1-1D7667FCB448" xml:lang="en"><title>What
       
    13 are records</title><shortdesc>This topic describes the structure of record. A record is an item
       
    14 that can be stored in the Comms Database. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <p>A record is a container and an element. A record refers to a set of fields
       
    16 in a defined order. A set or records that has the same fields in the same
       
    17 order can be called a recordset or a table. Fields in a given position make
       
    18 a column. A column is conceptual. The CommsDat API has no C++ item defined
       
    19 as a column. </p>
       
    20 <p>There are two types of record: </p>
       
    21 <ul>
       
    22 <li id="GUID-5989B5E3-1995-5E12-8BB6-30136BA7DA09"><p>records defined at system
       
    23 compile time - these records have named fields and are defined by Symbian
       
    24 platform. </p> </li>
       
    25 <li id="GUID-E5B40BE7-13D4-5EE1-B005-1D00EAB0A7BC"><p>records defined by the
       
    26 user - these records are defined at run time - they are not known to Symbian
       
    27 platform when Symbian platform is built. </p> </li>
       
    28 </ul>
       
    29 <section id="GUID-6AB91FBD-F293-4563-964C-1A6C7F1459DB"><title>Records defined at system compile time</title> <p> </p> <p>The
       
    30 class <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CCDRecordBase</apiname></xref> represents a Symbian
       
    31 platform defined record. All Symbian platform defined records inherit from <codeph>CCDRecordBase</codeph>.
       
    32 An individual named record is an instance of a class derived from <codeph>CCDRecordBase</codeph>.
       
    33 Symbian platform creates an individual named record and assigns a unique numeric
       
    34 Id. Symbian platform defines the class and the unique Id before the system
       
    35 is built. </p> <p>The class defines a schema for the record. A schema is a
       
    36 pattern for the record that all records of this type follow. The class contains
       
    37 a set of fields and links to other records. </p> <fig id="GUID-A331560C-9996-55E8-8C64-7BB2D5D0C1C6">
       
    38 <image href="GUID-DB9F413A-35E2-577E-91C3-1D519835FAB4_d0e86307_href.png" placement="inline"/>
       
    39 </fig> <p>For example, Symbian platform defines the class <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CCDIAPRecord</apiname></xref>.
       
    40 The class represents an Internet Access Point (IAP) record. A set of IAP records
       
    41 form an IAP table. Symbian platform assigns the unique numeric Id <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>KCDTIdIAPRecord</apiname></xref> to a record of this type. </p> <p>The
       
    42 public data members of this class are the fields and links that make the record.
       
    43 The following code shows part of the class definition. Some parts are omitted
       
    44 - this is not the complete class definition. </p> <codeblock id="GUID-3F6A91C8-BF0E-50E9-B49B-C363816179E5" xml:space="preserve">class CCDIAPRecord : public CCDRecordBase
       
    45     {
       
    46     public:
       
    47         CMDBField&lt;TDesC&gt;                        iServiceType;
       
    48         CMDBRecordLink&lt;CCDServiceRecordBase&gt;    iService;
       
    49         CMDBField&lt;TDesC&gt;                        iBearerType;
       
    50         CMDBRecordLink&lt;CCDBearerRecordBase&gt;     iBearer;
       
    51         CMDBRecordLink&lt;CCDNetworkRecord&gt;        iNetwork;
       
    52         CMDBField&lt;TUint32&gt;                      iNetworkWeighting;
       
    53         CMDBRecordLink&lt;CCDLocationRecord&gt;       iLocation;
       
    54         ...
       
    55     }
       
    56  </codeblock> <p>To create an instance of a Symbian platform defined record
       
    57 in memory, use the factory function: <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::RecordFactoryL()</apiname></xref>. </p> <p>Tools
       
    58 and applications can also create an instance of a Symbian platform defined
       
    59 record in memory, and copy it from another record. Use the factory function: <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::CreateCopyRecord()</apiname></xref>. </p> <p>Fields
       
    60 are public data members of a Symbian platform defined record. Tools and applications
       
    61 access the fields directly. </p> <p>Tools and applications can use the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::GetFieldByNameL()</apiname></xref> or <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::GetFieldByIdL()</apiname></xref> functions
       
    62 to find fields in a Symbian platform defined record. These methods are <i>not</i> recommended.
       
    63 It is more efficient to access the fields directly. </p> </section>
       
    64 <section id="GUID-33F78080-476A-462D-B2A3-788C21DCF4D2"><title>Records defined by the user</title> <p>The class <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CMDBGenericRecord</apiname></xref> represents a user defined record.
       
    65 All user defined records inherit from <codeph>CMDBGenericRecord</codeph>.
       
    66 User defined records do not have named fields. A tool or application supplies
       
    67 a schema at run time. The schema defines the structure of the record. </p> <p>A
       
    68 schema is an array of <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>SGenericRecordTypeInfo</apiname></xref> objects.
       
    69 Each item in the array defines the fields in the record in order. </p> <p>Tools
       
    70 and applications can use the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CMDBGenericRecord::InitializeL()</apiname></xref> function
       
    71 to initialise a record in memory. Tools and Applications can also get use
       
    72 the <codeph>LoadL()</codeph> and <codeph>FindL()</codeph> functions to get
       
    73 the the table schema from the Comms Database. </p> <fig id="GUID-BCE5A2B5-C328-594A-A213-C4AFB48BBF68">
       
    74 <image href="GUID-78AAEDF8-6C31-53E3-B411-3463DDAAC902_d0e86395_href.png" placement="inline"/>
       
    75 </fig> <p> </p> <p>You use the same methods to create, store and access user
       
    76 defined records that Symbian platform defined records use. Symbian platform
       
    77 backs up user defined data and secures user defined data with Platform Security.
       
    78 Symbian platform does not maintain user defined data formats. </p> <p>Tools
       
    79 and applications must use the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::GetFieldByNameL()</apiname></xref> or <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::GetFieldByIdL()</apiname></xref> functions
       
    80 to find fields in a user defined record. It is more efficient to use <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::GetFieldByIdL()</apiname></xref>. </p> </section>
       
    81 </conbody></concept>