Share via


ApplyDiffgram Method

Applies a DiffGram to local Visual FoxPro tables.

XMLTable.ApplyDiffgram( [ cAlias [, oCursorAdapter [, lPreserveChanges [, nCodePage ]]]] )

Parameters

  • cAlias
    Specifies the alias of the target cursor. The value of cAlias defaults to the XMLTableAlias property, including when cAlias is an empty string ("").

  • oCursorAdapter
    Specifies a pre-existing CursorAdapter object.

    ApplyDiffgram attaches the temporary table-buffered cursor containing changes to the specified CursorAdapter object. ApplyDiffgram also applies any updates, such as modified, inserted, or deleted records, to the base table set for the CursorAdapter object or to the cursor matching the Alias property of the XMLTable object.

    If you do not provide a value for oCursorAdapter, ApplyDiffgram automatically handles updates to the base table.

    Note

    You can update the remote data source using the ApplyDiffgram method provided that the [CursorAdapter] is configured for such a purpose.

  • lPreserveChanges
    Specifies whether to keep the cursor, with changes, attached to the CursorAdapter object and any changes to the properties of the CursorAdapter object intact when you provide a custom CursorAdapter object, and ApplyDiffgram fails, .

    The following table describes the values for lPreserveChanges.

    lPreserveChanges

    Description

    True (.T.)

    (Default) Keep the cursor, with changes, attached to the cursor adapter and the changes to the properties of the cursor adapter intact.

    False (.F.)

    Detach the cursor, with changes, and revert any changes that were made to the properties of the cursor adapter.

  • nCodePage
    Specifies a code page. The default value is zero (0).

Remarks

Applies To: XMLTable Class

ApplyDiffgram is supported only for XMLTable objects in the XMLAdapter Tables collection. ApplyDiffgram disregards XMLField objects when the XMLField Alias property is empty.

Visual FoxPro checks the XMLField Keyfield property when executing ApplyDiffgram.

Tip

When you use automatic updating, you should set the appropriate XMLField Keyfield properties in the Fields collection to True (.T.) to improve update performance.

Visual FoxPro changes the properties for a custom CursorAdapter as follows:

  • If the Tables Property is empty, Visual FoxPro sets it to the table specified by the cAlias parameter.

  • Visual FoxPro sets the SendUpdates Property to True (.T.).

  • If the DataSource Property is empty, Visual FoxPro sets it to "Native".

  • If the KeyFieldList Property is empty, Visual FoxPro adds key fields only if specified. Otherwise, Visual FoxPro adds all fields.

  • If KeyFieldList is modified, Visual FoxPro sets the WhereType property to Key Fields (DB_KEY or 1).

  • If the UpdatableFieldList Property is empty, Visual FoxPro adds all fields.

  • If the UpdateNameList Property is empty, Visual FoxPro adds all fields and uses the table specified by the cAlias parameter as the base table.

After applying the DiffGram, Visual FoxPro restores all the listed property values to their previous states.

The nCodePage parameter must exist in the list of supported code pages. If nCodePage is zero (0) and the UseCodePage property is False (.F.), the current default code page is used. For more information, see Code Pages Supported by Visual FoxPro and the UseCodePage Property.

The ApplyDiffgram method fails if XPath expressions are used for XMLAdapter or XMLTable objects.

See Also

Reference

XMLTable Object Properties, Methods, and Events

Tables Collection (XMLAdapter)

XMLField Class

Alias Property

CursorAdapter Class

Fields Collection (XMLTable)

CursorAdapter Object Properties, Methods, and Events

Other Resources

Methods (Visual FoxPro)