Collection Contents 上一页 下一页 PDF

MobiLink 管理指南

同步事件

upload_insert 表事件


功能 

为 MobiLink 同步服务器提供一个在上载流处理过程中使用的事件,该事件用于处理插入到远程数据库中的行。

参数 
参数
1 column 1
2 column 2
... ...
缺省操作 

无。

说明 

基于语句的 upload_insert 脚本将用于直接插入列值。

您可以为远程数据库的每个表编写一个 upload_insert 脚本。

对于 Java 和 .NET 应用程序,此脚本必须返回有效的 SQL。

另请参见 
SQL 示例 

本示例处理在远程数据库的 Customer 表中进行的插入。该脚本将值插入到统一数据库的名为 Customer 的表中。该表的最后一列将 Customer 标识为活动。最后一列不会在远程数据库中出现。

call ml_add_table_script(
  'ver1',
  'Customer',
  'upload_insert',
'INSERT INTO Customer( cust_id, name, rep_id, active )
VALUES ( ?, ?, ?, 1 )')
Java 示例 

下面的存储过程调用在同步脚本版本 ver1 时将名为 uploadInsertTable 的 Java 方法注册为 upload_insert 表事件的脚本。

call ml_add_java_table_script(
  'ver1',
  'table1',
  'upload_insert',
  'ExamplePackage.ExampleClass.uploadInsertTable' )

下面是示例 Java 方法 uploadInsertTable。它动态生成 UPLOAD 语句。此语法用于 Adaptive Server Anywhere 统一数据库。

public string uploadInsertTable()
{  return("insert into" + _curTable + getCols(_curTable)
   + "values" + getQM(_curTable)); }
.NET 示例 

下面的存储过程调用在同步脚本版本 ver1 和表 table1 时将名为 UploadInsert 的 .NET 方法注册为 upload_insert 表事件的脚本。此语法用于 Adaptive Server Anywhere 统一数据库。

call ml_add_dnet_table_script(
  'ver1',
  'table1',
  'upload_insert',
  'TestScripts.Test.UploadInsert'
)

下面是示例 .NET 方法 UploadInsert。它返回一条针对 ULCustomer 表的 UPLOAD 语句。

public static string UploadInsert()
 {
   return("INSERT INTO ULCustomer(cust_id,cust_name) values (?,?)");
 }

Collection Contents 上一页 下一页 PDF