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 的 CustDB 示例 » 同步 CustDB

 

同步 CustDB 示例中的客户

业务规则

用于管理客户的业务规则如下:

  • 在统一数据库和远程数据库中都可以修改客户信息。

  • 远程数据库和统一数据库中都包含一个完整的客户列表。

下载

可以在统一数据库中插入或更新客户信息。对应于这些操作的脚本如下所示:

  • download_cursor   以下 download_cursor 脚本下载自用户上次下载信息以来其信息发生更改的所有客户。
    SELECT cust_id, cust_name FROM ULCustomer WHERE last_modified >= {ml s.last_table_download}

上载

您可以在远程数据库中插入、更新或删除客户信息。对应于这些操作的脚本如下所示:

  • upload_insert   CustDB 的 upload_insert 脚本如下所示:
    INSERT INTO ULCustomer( cust_id, cust_name )
       VALUES( {ml r.cust_id, r.cust_name } )

  • upload_update   CustDB 的 upload_update 脚本如下所示:
    UPDATE ULCustomer SET cust_name = {ml r.cust_name} 
       WHERE cust_id = {ml r.cust_id}

    不对此表执行冲突检测。

  • upload_delete   CustDB 的 upload_delete 脚本如下所示:
    DELETE FROM ULCustomer WHERE cust_id = {ml r.cust_id}