Symbian3/SDK/Source/GUID-231840A2-255B-5200-8AD1-1D7667FCB448.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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 id="GUID-231840A2-255B-5200-8AD1-1D7667FCB448" xml:lang="en"><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
platform. </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
platform when Symbian platform is built. </p> </li>
</ul>
<section id="GUID-6AB91FBD-F293-4563-964C-1A6C7F1459DB"><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
platform defined record. All Symbian platform defined records inherit from <codeph>CCDRecordBase</codeph>.
An individual named record is an instance of a class derived from <codeph>CCDRecordBase</codeph>.
Symbian platform creates an individual named record and assigns a unique numeric
Id. Symbian platform 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_d0e79595_href.png" placement="inline"/>
</fig> <p>For example, Symbian platform 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 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
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 platform 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 platform 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 platform 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 platform defined record. These methods are <i>not</i> recommended.
It is more efficient to access the fields directly. </p> </section>
<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.
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_d0e79683_href.png" placement="inline"/>
</fig> <p> </p> <p>You use the same methods to create, store and access user
defined records that Symbian platform defined records use. Symbian platform
backs up user defined data and secures user defined data with Platform Security.
Symbian platform 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>