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

SQL Anywhere 11.0.1 (中文) » MobiLink - 服务器管理 » MobiLink 事件 » 同步事件 » MobiLink 事件概述

 

下载过程中的事件

下面的伪代码概述了调用下载事件以及调用同名脚本的序列。

这些事件在MobiLink 事件概述中提供的完整事件模型中的下载位置发生。

------------------------------------------------------
prepare_for_download
------------------------------------------------------

modify_last_download_timestamp
fetch the next download timestamp from consolidated
prepare_for_download
if( modify_last_download_timestamp script is defined
    or prepare_for_download script is defined ) {
    COMMIT
}

------------------------------------------------------
download
------------------------------------------------------

begin_download // Connection event.
for each table being synchronized {
   begin_download // Table event.
}
   handle_DownloadData
   for each table being synchronized {
     begin_download_deletes
     for each row in download_delete_cursor {
       if( all primary key columns are NULL ) {
         send TRUNCATE to remote
       } else {
         send DELETE to remote
       }
     }
     end_download_deletes
     begin_download_rows
     for each row in download_cursor {
       send INSERT ON EXISTING UPDATE to remote
     }
     end_download_rows
   }
   modify_next_last_download_timestamp
   for each table being synchronized {
     if( begin_download table script is called ) {
        end_download // Table event
     }
}
if( begin_download connect script is called ) {
   end_download // Connection event
}
   for each table being synchronized {
     download_statistics   // Table event.
   }
     download_statistics   // Connection event.

COMMIT
注意
  • 如果希望得到确认,并且没有从客户端获得下载确认,则整个下载事务将在统一数据库中回退。

    有关 SQL Anywhere 远程数据库的信息,请参见SendDownloadACK (sa) 扩展选项。有关 UltraLite 远程数据库的信息,请参见发送下载确认同步参数

  • 下载流不区分插入操作与更新操作。与 download_cursor 事件关联的脚本是一个 SELECT 语句,该语句定义要下载的行。客户端将检测行是否存在,然后执行适当的插入或更新操作。

  • 下载过程结束时,客户端将自动删除破坏参照完整性的行。

    请参见参照完整性与同步