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

SQL Anywhere 11.0.1 (中文) » UltraLite - C 及 C++ 编程 » 应用程序开发 » 使用嵌入式 SQL 开发应用程序 » 向应用程序添加同步

 

监控和取消同步

本节介绍如何从 UltraLite 应用程序监控和取消同步。

监控同步
  • 在同步结构 (ul_synch_info) 的 observer 成员中指定回调函数的名称。

  • 调用同步函数或方法启动同步。

  • 每当同步状态发生更改时,UltraLite 将调用回调函数。下一节将对同步状态进行介绍。

以下代码显示在嵌入式 SQL 应用程序中可以如何实现这一系列任务:

ULInitSynchInfo( &info );
info.user_name = m_EmpIDStr;
...
//The info parameter of ULSynchronize() contains
// a pointer to the observer function
info.observer = ObserverFunc;
ULSynchronize( &sqlca, &info );

处理同步状态信息