DataWindow Synchronization
\The Sandbox \PB History & Future \New In PB6 \DataWindow Synchronization
DW Sync
Example

Description

DataWindow synchronization is the process of managing DataWindow data buffers and status flags in distributed applications that access databases.

Purpose

In a conventional client/server application, where database updates are initiated by a single application running on a client machine, PowerBuilder can manage DataWindow state information automatically. However, in a distributed application, the situation is somewhat different. Because application components are partitioned between the client and the server, you need to write logic to ensure that the data buffers and status flags for the DataWindow control on the client are synchronized with those for the DataStore on the server.

Usage

To synchronize a DataWindow control on the client with a DataStore on the server, you need to move the DataWindow data buffers and status flags back and forth between the client and the server whenever changes occur. The procedures for doing this are essentially the same whether the source of the changes resides on the client or the server.

To apply complete state information from one DataWindow (or DataStore) to another, you need to:

  1. Invoke the GetFullState function to capture the current state of the source DataWindow.
  2. Invoke the SetFullState function to apply the state of the source DataWindow to the target.

To apply changes from one DataWindow (or DataStore) to another, you need to:

  1. Invoke the GetChanges function to capture the changes from the source DataWindow.
  2. Invoke the SetChanges function to apply the changes from the source DataWindow to the target.

When you call GetFullState or GetChanges, PowerBuilder returns DataWindow state information in a blob. The blob returned from GetFullState provides everything required to recreate the DataWindow, including the data buffers, status flags, and complete DataWindow specification. The blob returned from GetChanges provides data buffers and status flags for changed and deleted rows only.

By default, the Update function resets the update flags after successfully completing the update. Therefore, when you call the Update function on the server, the status flags are automatically reset for the server DataStore. However, the update flags for the corresponding client DataWindow control are not reset. Therefore, after issuing the Update function on the server DataStore, you need to recapture the status flags for the server DataStore by using GetChanges, then pass the resulting blob back to the client and call SetChanges to apply the status flags to the client DataWindow.

Functions

The following functions have been added for DataWindow synchronization:

  • GetFullState
  • SetFullState
  • GetChanges
  • SetChanges
  • GetStateStatus

Although these functions are most useful in distributed applications, they can also be used in nondistributed applications where multiple DataWindows (or DataStores) must be synchronized.

For more information

For an example of DataWindow synchronization in a distributed application, see Example of DataWindow synchronization.

PBL Peeper PB Help PB History
& Future About Us Feedback Site Map

Google
 
Web www.techno-kitten.com
www.sybase.com