Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - C and C++ Programming » Application development » UltraLite C++ application development using embedded SQL » Synchronization setup for an embedded SQL application » Synchronization monitoring and canceling

 

Synchronization status information

The callback function that monitors synchronization takes a ul_sync_status structure as a parameter.

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_table_count;
    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;
    ul_u_long        current_download_row_count;
    ul_u_long        total_download_row_count;
}
  • 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   Returns a pointer to the ul_sync_info structure.

  • db_table_count   Returns the number of tables in the database.

  • table_id   Returns 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[]   Returns the name of the current table.

  • table_name_w2[]   Returns the 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   Returns 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 been taken.

    • UL_SYNC_STATE_CONNECTING   The synchronization stream has been built, but not 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 has 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 the 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.

  • 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   Returns the pointer to the connection's active SQLCA.

  • current_download_row_count   Returns the number of rows that have been downloaded so far. This number includes duplicate rows that aren't included in received.inserts, received.updates, or received.deletes.

  • total_download_row_count   Returns the total number of rows to be received in the download. This number includes duplicate rows that aren't included in received.inserts, received.updates, or received.deletes.

 Example
 CustDB example
 See also