This topic describes the structure of a field. A field is an item that can be stored in the Comms Database.
A field is a container and an element. A field is the basic unit of information in the Comms Database.
A field is represented by the templated class CMDBField <T>
. The template parameter defines the type of data that the field contains. For example TInt, TDesC, TBool
Fields are collected into records.
Getting data from a field
An overloaded conversion operator converts the data value in a CMDBField <T>
object to the template type. The template type is the type defined by the characters T
. The operator allows you to use a CMDBField<T>
object on the right-hand side of an assignment call. The operator also allows you to pass a CMDBField<T>
object into a function that requires items of the template type.
The value of a field in memory is NULL:
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.
Setting data into a field
A field has an assignment operator. A type T
field accepts a type T
item on the right-hand side of an assignment.
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 SetMaxLengthL()
on the CMDBField <T>
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 SetL()
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.