Contents Index Generating scripts automatically Example scripts for UltraLite

MobiLink Synchronization User's Guide
  Writing Synchronization Scripts
    Introduction to synchronization scripts
      Generating scripts automatically

Generating example scripts

You can use the dbmlrv9 -ze option to generate example synchronization scripts. The example synchronization scripts are capable of performing a snapshot synchronization of your consolidated database with your remote database using the table and column names sent from the client, but they are not enabled. If the consolidated database has different table or column names, then activating these scripts causes an error during the synchronization.

To use this feature with Adaptive Server Anywhere clients, set the SendColumnNames extended option to ON to cause dbmlsync to send the column names with the upload header. To use this feature with UltraLite clients, set the send_column_names parameter to ul_true.

The -ze option generates the example scripts example_upload_insert, example_upload_update, example_upload_delete, and example_download_cursor.

For more information, see -ze option.

Example 

The following example generates scripts for an Adaptive Server Anywhere remote database.

At a command prompt, type:

dbmlsrv9 -c "dsn=YourDBDSN" -ze

At a command prompt, type:

dbmlsync -c dsn=dsn_remote -e "SendColumnNames=ON"

In the example above, example scripts are generated for all tables specified in the synchronization definition. The scripts exist for each table specified in the synchronization definition. The following table lists these scripts for the emp table.

Script name Script
example_upload_insert
INSERT INTO emp (emp_id,emp_name) VALUES (?,?)
example_upload_update
UPDATE emp SET emp_name=?
WHERE emp_id=?
example_upload_delete
DELETE FROM emp
WHERE emp_id=?
example_download_cursor
SELECT emp_id, emp_name FROM emp

The example scripts select and upload all records from any table in the synchronization subscription that meet the conditions specified in the statement. So, for example, the upload_insert script for emp inserts all records from emp. The example scripts are generated for each table in the remote database specified in the synchronization subscription. The MobiLink synchronization server generates complete scripts needed for a snapshot synchronization. The scripts are added right after the synchronization description is processed. The synchronization is aborted after scripts are generated.


Contents Index Generating scripts automatically Example scripts for UltraLite