You can view, write, and modify synchronization scripts using Sybase Central. In this section you write the following synchronization scripts:
upload_insert To define how data inserted into the remote database is to be applied to the consolidated database.
download_cursor To define what data should be downloaded from the consolidated database.
Each script belongs to a designated script version. You must add a script version to the consolidated database before you add scripts.
Connect to the cons database using the MobiLink plug-in for Sybase Central:
In the left pane of Sybase Central, select MobiLink 11.
Choose Mode » Admin.
Choose File » Connect.
Click the Identification tab.
Click ODBC Data Source Name, and type sa_cons. Click OK.
Add the script version ver1:
In the left pane, right-click Versions and choose New » Version.
In the What Do You Want To Name The New Script Version field, type ver1.
In the left pane in the MobiLink 11 list, right-click Synchronized Tables » New » Synchronized Table.
Click Choose A Table In The Consolidated Database With The Same Name As The Remote Table.
On the Which User Owns The Table You Want To Synchronize list, click DBA.
In the Which Table Do You Want To Synchronize list, click Product.
Add a new table script for each upload and download to the consolidated database
In the left pane in the MobiLink 11 list, expand Synchronized Tables.
Right-click the Product table and choose New » Table Script.
In the For Which Version Do You Want To Create The Table Script list, click ver1.
In the Which Event Should Cause The Table Script To Be Executed list, click upload_insert. Click Next.
In the right pane of Sybase Central, type the following SQL statement:
INSERT INTO Product( name, quantity, last_modified ) VALUES( ?, ?, ? )
The upload_insert event determines how data inserted into the remote database should be applied to the consolidated database. For more information about upload_insert, see upload_insert table event.
Choose File » Save.
Repeat steps 1 to 5 for the download_cursor event using the following SQL statement:
SELECT name, quantity, last_modified FROM Product where last_modified >= ?
The download_cursor script defines a cursor to select consolidated database rows that are downloaded and inserted or updated in the remote database. For more information about download_cursor, see download_cursor table event.
For more information about script versions, see Script versions.
For more information about adding scripts, see Adding and deleting scripts.
For more information about writing table scripts, see Table scripts.
For more information about writing synchronization scripts, see Writing synchronization scripts.
For a complete list of the events that you can program to customize your synchronization, see Synchronization events.
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|