diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-ACE7D63F-9544-56DB-A72D-FFB0A35661EC.dita --- a/Symbian3/PDK/Source/GUID-ACE7D63F-9544-56DB-A72D-FFB0A35661EC.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-ACE7D63F-9544-56DB-A72D-FFB0A35661EC.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,162 +1,162 @@ - - - - - -Loading -a Symbian platform Defined Table, Changing a Field, Write Changed Record: -TutorialThis tutorial shows you how to load a Symbian platform defined -table from the Comms Database, change a field, and write the changed record -to the database. - - -

Before you start, -you must understand:

    -
  • the general concept -of the Comms Database

  • -
  • the specific concept -of fields, records, links and tables

  • -
  • how to write and build -application code to run on Symbian platform

  • -
-

This tutorial shows -you:

    -
  • how to load the Internet -Access Points Configuration table. This table is also called the IAP table

  • -
  • how to search for a -records that have a specific Service Type field.

  • -
  • how to change the Network -Weighting field in the last record found

  • -
  • how to store the changed -record in the Comms Database.

  • -

The principles that apply here also apply to the other Symbian platform -defined tables.

- -Make sure that you -have created a session. - -Create the table -object in the tool or application process. - -You create a CMDBRecordSet <T> object -and specify CCDIAPRecord as the template -parameter. - -Symbian platform defines the CCDIAPRecord class to -represent a IAP record. The class is a schema for the record. The class defines -the fields and links that make a IAP record. -Symbian platform defines unique -numeric Id s for Symbian platform defined tables. The symbol KCDTIdIAPRecord defines the value of this Id for -the IAP table. The Id allows the CommsDat API to retrieve the table from the -Comms Database efficiently. -To work with other Symbian platform defined tables, use the correct -class name and the correct unique numeric Id values. The Reference section -contains a list of all Symbian platform defined tables. -... - -// This code fragment assumes that a session with the Comms Database has been created. -// iDb is a pointer to a CMDBSession object -... - -// Use the standard "new (ELeave)" construction to create the object to -// represent the table. -// -// Note: -// 1. the template parameter CCDIAPRecord defines -// the "IAP" record type. -// 2. the unique numeric Id KCDTIdIAPRecord is passed as a parameter -// to the constructor. -CMDBRecordSet<CCDIAPRecord>* iapRecordSet = - new (ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord); -... - - -Create a record -that contains the type of Service Typefield needed. - -To search for a record the tool or application creates a record in memory. -The fields in the record are set to the specific values on which the search -is to match. In this tutorial this record is called the "search record". The -record is appended to the set of records in the table object. At this point, -the search record is the only record in the table, because the Comms Database -has not yet been accessed. - -In this tutorial, the Service Type field in the search record is set -to DialOutISP. -... -// Searching for all IAP records that support the DialOutISP service. -_LIT(KServiceType, "DialOutISP"); - - -// Create the "search record". You use the unique numeric Id KCDTIdIAPRecord -// to identify the type record to the factory function. -CCDIAPRecord* ptrPrimingRecord = static_cast<CCDIAPRecord *> - (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); - - -// Prime the Service Types field with the string "DialOutISP" -ptrPrimingRecord->iServiceType.SetMaxLengthL(KServiceType().Length()); -ptrPrimingRecord->iServiceType = KServiceType; - - -// Append the search record to the table in memory. Remember that the table only -// contains this record. The Comms Database has not yet been accessed. -iapRecordSet->iRecords.AppendL(ptrPrimingRecord); - - -// Set the record pointer to NULL, because ownership of the "search record" has -// been passed to the table object. -ptrPrimingRecord = NULL; -... - -Perform the search. - -Use the FindL() function to search the table in the -Comms Database. The function is called on the class that defines the table. -The function is implemented in the base class MMetaDatabase. -You pass a reference to the session object into the FindL() function. -... -// Perform the search. -if(iapRecordSet->FindL(*iDb)) - { - // At least one record found. - // Find the number of records found. - TInt iapRecordsFound = iapRecordSet->iRecords.Count(); - - // Change the Network Weighting field in the last record. - CCDIAPRecord* iapRecord = - static_cast<CCDIAPRecord*>( iapRecordSet->iRecords [iapRecordsFound-1]); - iapRecord->iNetworkWeighting = 1; - - // Update the changed record in the Comms Database - - // EITHER - // Check through all records and submit all changes - // made by the tool or application. - iapRecordSet->ModifyL(*iDb); - - // OR - // Explicitly submit this record only - iapRecord ->ModifyL(*iDb); - ... - } -else - { - // No matching records found. - // Note that iRecords[0] still contains the "search record". The "search record" - // only contains the priming values. - // It is important to check the return code from the call to ModifyL() - } -... - - -
-Comms Database - concepts + + + + + +Loading +a Symbian platform Defined Table, Changing a Field, Write Changed Record: +TutorialThis tutorial shows you how to load a Symbian platform defined +table from the Comms Database, change a field, and write the changed record +to the database. + + +

Before you start, +you must understand:

    +
  • the general concept +of the Comms Database

  • +
  • the specific concept +of fields, records, links and tables

  • +
  • how to write and build +application code to run on Symbian platform

  • +
+

This tutorial shows +you:

    +
  • how to load the Internet +Access Points Configuration table. This table is also called the IAP table

  • +
  • how to search for a +records that have a specific Service Type field.

  • +
  • how to change the Network +Weighting field in the last record found

  • +
  • how to store the changed +record in the Comms Database.

  • +

The principles that apply here also apply to the other Symbian platform +defined tables.

+ +Make sure that you +have created a session. + +Create the table +object in the tool or application process. + +You create a CMDBRecordSet <T> object +and specify CCDIAPRecord as the template +parameter. + +Symbian platform defines the CCDIAPRecord class to +represent a IAP record. The class is a schema for the record. The class defines +the fields and links that make a IAP record. +Symbian platform defines unique +numeric Id s for Symbian platform defined tables. The symbol KCDTIdIAPRecord defines the value of this Id for +the IAP table. The Id allows the CommsDat API to retrieve the table from the +Comms Database efficiently. +To work with other Symbian platform defined tables, use the correct +class name and the correct unique numeric Id values. The Reference section +contains a list of all Symbian platform defined tables. +... + +// This code fragment assumes that a session with the Comms Database has been created. +// iDb is a pointer to a CMDBSession object +... + +// Use the standard "new (ELeave)" construction to create the object to +// represent the table. +// +// Note: +// 1. the template parameter CCDIAPRecord defines +// the "IAP" record type. +// 2. the unique numeric Id KCDTIdIAPRecord is passed as a parameter +// to the constructor. +CMDBRecordSet<CCDIAPRecord>* iapRecordSet = + new (ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord); +... + + +Create a record +that contains the type of Service Typefield needed. + +To search for a record the tool or application creates a record in memory. +The fields in the record are set to the specific values on which the search +is to match. In this tutorial this record is called the "search record". The +record is appended to the set of records in the table object. At this point, +the search record is the only record in the table, because the Comms Database +has not yet been accessed. + +In this tutorial, the Service Type field in the search record is set +to DialOutISP. +... +// Searching for all IAP records that support the DialOutISP service. +_LIT(KServiceType, "DialOutISP"); + + +// Create the "search record". You use the unique numeric Id KCDTIdIAPRecord +// to identify the type record to the factory function. +CCDIAPRecord* ptrPrimingRecord = static_cast<CCDIAPRecord *> + (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); + + +// Prime the Service Types field with the string "DialOutISP" +ptrPrimingRecord->iServiceType.SetMaxLengthL(KServiceType().Length()); +ptrPrimingRecord->iServiceType = KServiceType; + + +// Append the search record to the table in memory. Remember that the table only +// contains this record. The Comms Database has not yet been accessed. +iapRecordSet->iRecords.AppendL(ptrPrimingRecord); + + +// Set the record pointer to NULL, because ownership of the "search record" has +// been passed to the table object. +ptrPrimingRecord = NULL; +... + +Perform the search. + +Use the FindL() function to search the table in the +Comms Database. The function is called on the class that defines the table. +The function is implemented in the base class MMetaDatabase. +You pass a reference to the session object into the FindL() function. +... +// Perform the search. +if(iapRecordSet->FindL(*iDb)) + { + // At least one record found. + // Find the number of records found. + TInt iapRecordsFound = iapRecordSet->iRecords.Count(); + + // Change the Network Weighting field in the last record. + CCDIAPRecord* iapRecord = + static_cast<CCDIAPRecord*>( iapRecordSet->iRecords [iapRecordsFound-1]); + iapRecord->iNetworkWeighting = 1; + + // Update the changed record in the Comms Database + + // EITHER + // Check through all records and submit all changes + // made by the tool or application. + iapRecordSet->ModifyL(*iDb); + + // OR + // Explicitly submit this record only + iapRecord ->ModifyL(*iDb); + ... + } +else + { + // No matching records found. + // Note that iRecords[0] still contains the "search record". The "search record" + // only contains the priming values. + // It is important to check the return code from the call to ModifyL() + } +... + + +
+Comms Database + concepts
\ No newline at end of file