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

SQL Anywhere 11.0.1 (日本語) » Mobile Link - クライアント管理 » Mobile Link 用 SQL Anywhere クライアント » dbmlsync API

 

C++ 用 dbmlsync API

この項では、DbmlsyncClient クラスの C++ 実装のメソッドについて説明します。

この後に示す例は、dbmlsync API の C++ バージョンを使用して同期を行い、出力イベントを受け取る典型的なアプリケーションを示したものです。この例では、わかりやすいようにエラー処理を省略しています。各 API 呼び出しの戻り値を確認する習慣をつけることをおすすめします。

dbmlsync C++ の例
#include <stdio.h>
#include "dbmlsynccli.h"


int main( void ) {
    DbmlsyncClient *client;
    DBSC_SyncHdl    syncHdl;
    DBSC_Event     *ev1;

    client = DbmlsyncClient::InstantiateClient();
    if( client == NULL ) return( 1 );
    client->Init();

    // Setting the "server path" is usually required on Windows Mobile/CE.
    // In other environments the server path is usually not required unless
    // you SA install is not in your path or you have multiple versions of the
    // product installed
    client->SetProperty( "server path", "C:\\SQLAnywhere\\bin32" );

    client->StartServer( 3426,
              "-c eng=remote;dbn=rem1;uid=dba;pwd=sql -v+ -ot c:\\dbsync1.txt",
              5000, NULL );
    client->Connect( NULL, 3426, "dba", "sql");
    syncHdl = client->Sync( "my_sync_profile", "" );
    while( client->GetEvent( &ev1, 5000) == DBSC_GETEVENT_OK ) {
        if( ev1->hdl == syncHdl ) {
            //
            // Process events that interest you here
            //

            if( ev1->type == DBSC_EVENTTYPE_SYNC_DONE ) {
                client->FreeEventInfo( ev1 );
                break;
            }
            client->FreeEventInfo( ev1 );
         }
     }
     client->ShutdownServer( DBSC_SHUTDOWN_ON_EMPTY_QUEUE );
     client->WaitForServerShutdown( 10000 );
     client->Disconnect();
     client->Fini();
     delete client;

     return( 0 );
}

API の C++ バージョンの DbmlsyncClient クラスのパブリック・メソッドを次に示します。


InstantiateClient メソッド
Init メソッド
Fini メソッド
StartServer メソッド
Connect メソッド
Disconnect メソッド
Ping メソッド
Sync メソッド
ShutdownServer メソッド
WaitForServerShutdown メソッド
CancelSync メソッド
GetEvent メソッド
FreeEventInfo メソッド
GetErrorInfo メソッド
SetProperty メソッド
GetProperty メソッド
DBSC_Event 構造体