Handling synchronization status information

The callback function that monitors synchronization takes a ul_sync_status structure as parameter. For more information, see ul_sync_status structure.

The ul_sync_status structure has the following members:



struct ul_sync_status {
    struct {
       ul_u_long   bytes;
       ul_u_long   inserts;
       ul_u_long   updates;
       ul_u_long   deletes;
     }               sent;
    struct {
       ul_u_long   bytes;
       ul_u_long   inserts;
       ul_u_long   updates;
       ul_u_long   deletes;
     }               received;
    p_ul_sync_info  info;
    ul_sync_state   state;
    ul_u_short       db_tableCount;
    ul_u_short       table_id;
    char             table_name[];
    ul_wchar         table_name_w2[];
    ul_u_short       sync_table_count;
    ul_u_short       sync_table_index;
    ul_sync_state    state;
    ul_bool          stop;
    ul_u_short       flags;
    ul_void *        user_data;
    SQLCA *          sqlca;
}
  • sent.inserts   The number of inserted rows that have been uploaded so far.

  • sent.updates   The number of updated rows that have been uploaded so far.

  • sent.deletes   The number of deleted rows that have been uploaded so far.

  • sent.bytes   The number of bytes that have been uploaded so far.

  • received.inserts   The number of inserted rows that have been downloaded so far.

  • received.updates   The number of updated rows that have been downloaded so far.

  • received.deletes   The number of deleted rows that have been downloaded so far.

  • received.bytes   The number of bytes that have been downloaded so far.

  • info   A pointer to the ul_sync_info structure. See ul_sync_info structure.

  • db_tableCount   Returns the number of tables in the database.

  • table_id   The current table number (relative to 1) that is being uploaded or downloaded. This number may skip values when not all tables are being synchronized and is not necessarily increasing.

  • table_name[]   Name of the current table.

  • table_name_w2[]   Name of the current table (wide character version). This field is only populated in the Windows (desktop and Mobile) environment.

  • sync_table_count   Returns the number of tables being synchronized.

  • sync_table_index   The number of the table that is being uploaded or downloaded, starting at 1 and ending at the sync_table_count value. This number may skip values when not all tables are being synchronized.

  • state   One of the following states:

    • UL_SYNC_STATE_STARTING   No synchronization actions have yet been taken.

    • UL_SYNC_STATE_CONNECTING   The synchronization stream has been built, but not yet opened.

    • UL_SYNC_STATE_SENDING_HEADER   The synchronization stream has been opened, and the header is about to be sent.

    • UL_SYNC_STATE_SENDING_TABLE   A table is being sent.

    • UL_SYNC_STATE_SENDING_DATA   Schema information or data is being sent.

    • UL_SYNC_STATE_FINISHING_UPLOAD   The upload stage is completed and a commit is being carried out.

    • UL_SYNC_STATE_RECEIVING_UPLOAD_ACK   An acknowledgement that the upload is complete is being received.

    • UL_SYNC_STATE_RECEIVING_TABLE   A table is being received.

    • UL_SYNC_STATE_RECEIVING_DATA   Schema information or data is being received.

    • UL_SYNC_STATE_COMMITTING_DOWNLOAD   The download stage is completed and a commit is being carried out.

    • UL_SYNC_STATE_SENDING_DOWNLOAD_ACK   An acknowledgement that download is complete is being sent.

    • UL_SYNC_STATE_DISCONNECTING   The synchronization stream is about to be closed.

    • UL_SYNC_STATE_DONE   Synchronization has completed successfully.

    • UL_SYNC_STATE_ERROR   Synchronization has completed, but with an error.

    • UL_SYNC_STATE_ROLLING_BACK_DOWNLOAD   An error occurred during download and the download is being rolled back.

      For more information about the synchronization process, see The synchronization process.

  • stop   Set this member to true to interrupt the synchronization. The SQL exception SQLE_INTERRUPTED is set, and the synchronization stops as if a communications error had occurred. The observer is always called with either the DONE or ERROR state so that it can do proper cleanup.

  • flags   Returns the current synchronization flags indicating additional information related to the current state.

  • user_data   Returns the user data object that is passed as an argument to the ULSetSynchronizationCallback function.

  • sqlca   Pointer to the connection's active SQLCA.

 Example
 CustDB example