Editar

Compartir a través de


Conversion of operations from set-based to record-by-record

You can use the following statements and methods to help improve performance by reducing communication between the application and the database:

In some situations, these record set–based operations can be converted to slower record-by-record operations. The following table identifies these situations.

Situation delete_from update_recordset insert_recordset RecordSortedList, RecordInsertList Used to override
Non-SQL tables Yes Yes Yes Yes Not applicable
Delete actions Yes No No No skipDeleteActions
The database log is enabled. Yes Yes Yes No skipDatabaseLog
Overridden method Yes Yes Yes Yes skipDataMethods
Alerts are set up for the table. Yes Yes Yes No skipEvents
The ValidTimeStateFieldType property on a table is set to a value other than None. Yes Yes Yes Yes Not applicable

You can use the skip* settings that are shown in the "Used to override" column to explicitly skip or ignore one or more factors that adversely affect performance. If one of the previously mentioned SQL operations is downgraded to a record-by-record operation, all the skip* settings are ignored. In the following example code, the insert method on the myTable table is run, even though it's explicitly stated that this method should be skipped if a container or memo field is defined for myTable.

public void tutorialRecordInsertList()
{
    MyTable myTable;
    RecordInsertList insertList = new RecordInsertList(
        myTable.TableId,
        True);
    int i;
    for ( i = 1; i <=  100; i++ )
    {
        myTable.value = i;
        insertList.add(myTable);
    }
    insertList.insertDatabase();
}