Symbian3/SDK/Source/GUID-231840A2-255B-5200-8AD1-1D7667FCB448.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-231840A2-255B-5200-8AD1-1D7667FCB448"><title>What are records</title><shortdesc>This topic describes the structure of record. A record is an item that can be stored in the Comms Database. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><p>A record is a container and an element. A record refers to a set of fields in a defined order. A set or records that has the same fields in the same order can be called a recordset or a table. Fields in a given position make a column. A column is conceptual. The CommsDat API has no C++ item defined as a column. </p> <p>There are two types of record: </p> <ul><li id="GUID-5989B5E3-1995-5E12-8BB6-30136BA7DA09"><p>records defined at system compile time - these records have named fields and are defined by Symbian OS. </p> </li> <li id="GUID-E5B40BE7-13D4-5EE1-B005-1D00EAB0A7BC"><p>records defined by the user - these records are defined at run time - they are not known to Symbian OS when Symbian OS is built. </p> </li> </ul> <section><title>Records defined at system compile time</title> <p> </p> <p>The class <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CCDRecordBase</apiname></xref> represents a Symbian OS defined record. All Symbian OS defined records inherit from <codeph>CCDRecordBase</codeph>. An individual named record is an instance of a class derived from <codeph>CCDRecordBase</codeph>. Symbian OS creates an individual named record and assigns a unique numeric Id. Symbian OS defines the class and the unique Id before the system is built. </p> <p>The class defines a schema for the record. A schema is a pattern for the record that all records of this type follow. The class contains a set of fields and links to other records. </p> <fig id="GUID-A331560C-9996-55E8-8C64-7BB2D5D0C1C6"><image href="GUID-DB9F413A-35E2-577E-91C3-1D519835FAB4_d0e66246_href.png" placement="inline"/></fig> <p>For example, Symbian OS defines the class <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CCDIAPRecord</apiname></xref>. The class represents an Internet Access Point (IAP) record. A set of IAP records form an IAP table. Symbian OS 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 public data members of this class are the fields and links that make the record. The following code shows part of the class definition. Some parts are omitted - this is not the complete class definition. </p> <codeblock id="GUID-3F6A91C8-BF0E-50E9-B49B-C363816179E5" xml:space="preserve">class CCDIAPRecord : public CCDRecordBase
    {
    public:
        CMDBField&lt;TDesC&gt;                        iServiceType;
        CMDBRecordLink&lt;CCDServiceRecordBase&gt;    iService;
        CMDBField&lt;TDesC&gt;                        iBearerType;
        CMDBRecordLink&lt;CCDBearerRecordBase&gt;     iBearer;
        CMDBRecordLink&lt;CCDNetworkRecord&gt;        iNetwork;
        CMDBField&lt;TUint32&gt;                      iNetworkWeighting;
        CMDBRecordLink&lt;CCDLocationRecord&gt;       iLocation;
        ...
    }
 </codeblock> <p>To create an instance of a Symbian OS defined record in memory, use the factory function: <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CCDRecordBase::RecordFactoryL()</apiname></xref>. </p> <p>Tools and applications can also create an instance of a Symbian OS defined 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 are public data members of a Symbian OS defined record. Tools and applications 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 to find fields in a Symbian OS defined record. These methods are <i>not</i> recommended. It is more efficient to access the fields directly. </p> </section> <section><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. All user defined records inherit from <codeph>CMDBGenericRecord</codeph>. User defined records do not have named fields. A tool or application supplies a schema at run time. The schema defines the structure of the record. </p> <p>A schema is an array of <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>SGenericRecordTypeInfo</apiname></xref> objects. Each item in the array defines the fields in the record in order. </p> <p>Tools and applications can use the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CommsDat::CMDBGenericRecord::InitializeL()</apiname></xref> function to initialise a record in memory. Tools and Applications can also get use the <codeph>LoadL()</codeph> and <codeph>FindL()</codeph> functions to get the the table schema from the Comms Database. </p> <fig id="GUID-BCE5A2B5-C328-594A-A213-C4AFB48BBF68"><image href="GUID-78AAEDF8-6C31-53E3-B411-3463DDAAC902_d0e66332_href.png" placement="inline"/></fig> <p> </p> <p>You use the same methods to create, store and access user defined records that Symbian OS defined records use. Symbian OS backs up user defined data and secures user defined data with Platform Security. Symbian OS does not maintain user defined data formats. </p> <p>Tools 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 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> </conbody></concept>