7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <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_d0e91221_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 |
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_d0e114762_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 |
13 { |
45 { |
14 public: |
46 public: |
15 CMDBField<TDesC> iServiceType; |
47 CMDBField<TDesC> iServiceType; |
16 CMDBRecordLink<CCDServiceRecordBase> iService; |
48 CMDBRecordLink<CCDServiceRecordBase> iService; |
17 CMDBField<TDesC> iBearerType; |
49 CMDBField<TDesC> iBearerType; |
19 CMDBRecordLink<CCDNetworkRecord> iNetwork; |
51 CMDBRecordLink<CCDNetworkRecord> iNetwork; |
20 CMDBField<TUint32> iNetworkWeighting; |
52 CMDBField<TUint32> iNetworkWeighting; |
21 CMDBRecordLink<CCDLocationRecord> iLocation; |
53 CMDBRecordLink<CCDLocationRecord> iLocation; |
22 ... |
54 ... |
23 } |
55 } |
24 </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_d0e91307_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> |
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_d0e114850_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> |