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 服务器 API » 使用 Java 语言编写同步脚本 » 用于 Java 的 MobiLink 服务器 API 参考 » UploadedTableData 接口

 

getUpdates 方法

语法
public UpdateResultSet getUpdates( )
注释

返回表示 MobiLink 客户端所上载的更新操作的 UpdateResultSet 对象。每个更新由包括所有列值的一行来表示。UpdateResultSet 是对 java.sql.ResultSet 的扩展,它加入了用于 MobiLink 冲突检测的特殊方法。

返回值

表示 MobiLink 客户端所上载的更新操作的 UpdateResultSet 对象。

另请参见
示例

假定远程客户端包含一个名为 remoteOrders 的表。以下示例使用 UploadedTableData.getUpdates 方法获取所更新行的结果集。此代码将获取每行的订单额。

import ianywhere.ml.script.*;
import java.sql.*;

// the method used for the handle_UploadData event
public void HandleUpload(UploadData ut)
    throws SQLException, IOException
{
    // Get an UploadedTableData instance representing the remoteOrders table.
    UploadedTableData remoteOrdersTable = ut.getUploadedTableByName("remoteOrders");
 
    // Get inserts uploaded by the MobiLink client.
    java.sql.ResultSet rs = remoteOrdersTable.getUpdates();
    while (rs.next()) { 
        // Get the uploaded order_amount.
        double order_amount = rs.getDouble("order_amount"); 

        // ...
    }
    rs.close();
}