MobiLink Synchronization User's Guide
Tutorial: Writing SQL Scripts Using Sybase Central
You can view, write, and modify synchronization scripts using Sybase Central. In this section you add scripts to 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.
To add a script version
Start Sybase Central and connect to the test_consol database using the MobiLink plug-in.
Select the Versions folder. Double-click Add Version.
The Add a New Script Version dialog appears.
Name the new version default. Click Finish.
To add synchronized tables to your consolidated database
In the MobiLink Synchronization plug-in of Sybase Central, select the Tables folder and double-click DBA.
You will see two tables, emp and cust.
Right-click each table and choose Add to Synchronized Tables.
Now that you have designated these tables as synchronized, you can add a new table script for each upload and download to the consolidated database.
To add table scripts to each synchronized table
In the MobiLink Synchronization plug-in of Sybase Central, select the Synchronized Tables folder. You will see two tables, emp and cust. Double-click the emp table.
Double-click Add Table Script. The following dialog appears.
Select the upload_insert event from the dropdown list.
Click Finish.
Type the following SQL statement into the edit screen:
INSERT INTO emp (emp_id, emp_name) VALUES ( ?, ? )
Save the script.
Close the dialog.
Repeat steps 2 to 7 for the download_cursor event using the following SQL statement:
SELECT emp_id, emp_name FROM emp
Select the cust table.
Repeat steps 2 to 7 for the upload_insert event using the following SQL statement:
INSERT INTO cust (cust_id, emp_id, cust_name) VALUES ( ?, ?, ? )
Repeat steps 2 to 7 for the download_cursor event using the following SQL statement:
SELECT cust_id, emp_id, cust_name FROM cust
For more information about the scripts you just created, see upload_insert table event and download_cursor cursor event.
For more information about script versions, see Script versions.
For more information about adding scripts, see Adding and deleting scripts in your consolidated database.
For more information about writing table scripts, see Table scripts.
For more information about writing synchronization scripts, see Writing Synchronization Scripts.