Symbian3/SDK/Source/GUID-0D1E30D8-D900-5FD9-BD1F-1B93BAD8AEF5.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 11 Mar 2010 15:24:26 +0000
changeset 2 ebc84c812384
parent 0 89d6a7a84779
permissions -rw-r--r--
week 10 bug fix submission: Bug 1892, Bug 1897, Bug 1319. Also 3 or 4 documents were found to contain code blocks with SFL, which has been fixed. Partial fix for broken links, links to Forum Nokia, and the 'Symbian platform' terminology issues.

<?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-0D1E30D8-D900-5FD9-BD1F-1B93BAD8AEF5"><title>What are fields</title><shortdesc>This topic describes the structure of a field. A field is an item that can be stored in the Comms Database. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> <p>A field is a container and an element. A field is the basic unit of information in the Comms Database. </p> <p>A field is represented by the templated class <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CMDBField</apiname></xref> <codeph>&lt;T&gt;</codeph>. The template parameter defines the type of data that the field contains. For example <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TInt</apiname></xref>, <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TDesC</apiname></xref>, <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>TBool</apiname></xref>   </p> <p>Fields are collected into records. </p> <fig id="GUID-39CDC3FB-156B-539B-A513-7B725A97D3B9"><image href="GUID-DA070DA3-CE2E-5B4E-834F-32BED736E01D_d0e66123_href.png" placement="inline"/></fig> <p><b>Getting data from a field </b> </p> <p>An overloaded conversion operator converts the data value in a <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CMDBField</apiname></xref> <codeph>&lt;T&gt;</codeph> object to the template type. The template type is the type defined by the characters <codeph>T</codeph>. The operator allows you to use a <codeph>CMDBField&lt;T&gt;</codeph> object on the right-hand side of an assignment call. The operator also allows you to pass a <codeph>CMDBField&lt;T&gt;</codeph> object into a function that requires items of the template type. </p> <p>The value of a field in memory is NULL: </p> <ul><li id="GUID-1500B567-B899-5769-97D8-E7949B6034CA"><p>if the caller has not set the value </p> </li> <li id="GUID-2766C253-443B-5BD1-977F-69EB4E2349CD"><p>if the field as not been loaded from the Comms Database </p> </li> </ul> <p>If the value of a field is NULL after the field has been successfully loaded from the Comms Database, the field has been explicitly set to NULL by the writer of the record. </p> <p><b>Setting data into a field </b> </p> <p>A field has an assignment operator. A type <codeph>T</codeph> field accepts a type <codeph>T</codeph> item on the right-hand side of an assignment. </p> <p>A descriptor has variable length data. You need to set the size of the buffer that the field uses to store data. You must call <codeph>SetMaxLengthL()</codeph> on the <xref href="GUID-1CDD0B97-8B00-3373-9908-512C9BC1CF51.dita"><apiname>CMDBField</apiname></xref> <codeph>&lt;T&gt;</codeph> object and pass the length of the data to be added. You then use the assignment operator. The length that you set must be enough or the assignment operator does not work. The <codeph>SetL()</codeph> function is an alternative method. This function calculates the length of a descriptor parameter for a descriptor field type and performs the allocation and assignment. </p> </conbody></concept>