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

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.

This initialization function takes a user id as parameter, that must be declared as dbsync user. No authentication is required, because the current end user has already been authenticated to execute this server application.

Invalid call sequence produces fatal error (programming error).