dbsync_srvapp.central_change_init()

Central changes initialization function.

Syntax

FUNCTION central_change_init(
      tablist STRING
  )
  RETURNS INTEGER
  1. tablist is a comma-separated list of table names.
Returns:
  1. The status.

Usage

This sync process initialization function takes a list of SQL tables, separated by a comma.

In server-side applications, INSERT/UPDATE/DELETE and registration of changes must be done in a transaction block, to revert all changes with ROLLBACK WORK in case of failure, and have SQL locks set during the transaction to prevent other dbsync clients to update the same tables.

After BEGIN WORK, call the central_change_init() to initialize the process and set SQL locks on the dbsync_udsinfo table to block other dbsync users. Then do the INSERT/UPDATE/DELETE on the central tables, and register all changes for dbsync with the register_central_*() functions. When all changes are done, call central_change_done() to end the process and then terminate the transaction with COMMIT WORK. If central changes failed at some point, call central_change_cancel() before performing ROLLBACK WORK to cancel the transaction.

Invalid call sequence produces fatal error (programming error).

Example

LET s = dbsync_srvapp.central_change_init("postcode,city,country")