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

SQL Anywhere 11.0.1 (Français) » MobiLink - Client Administration » SQL Anywhere Clients for MobiLink » Dbmlsync API


Dbmlsync API for C++

This section describes the methods in the C++ implementation of the DbmlsyncClient class.

The sample below shows a typical application using the C++ version of the Dbmlsync API to perform a synchronization to receive output events. The sample omits error handling for clarity. It is always good indent practice to check the return value from each API call.

Dbmlsync C++ sample
#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 );

    // 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 );
            client->FreeEventInfo( ev1 );
     client->ShutdownServer( DBSC_SHUTDOWN_ON_EMPTY_QUEUE );
     client->WaitForServerShutdown( 10000 );
     delete client;

     return( 0 );

The DbmlsyncClient class public methods in the C++ version of the API are shown below.

InstantiateClient method
Init method
Fini method
StartServer method
Connect method
Disconnect method
Ping method
Sync method
ShutdownServer method
WaitForServerShutdown method
CancelSync method
GetEvent method
FreeEventInfo method
GetErrorInfo method
SetProperty method
GetProperty method
DBSC_Event structure