File modifications in the change log

This example demonstrates a programming pattern for registering data row changes in a central database, including initializing changes, handling inserts, updates, and deletes, and ensuring proper transaction management with error handling.

The next code lines illustrate the programming pattern to register data row changes for an application connected directly to the central database:
... fetch rows into memory (record or array) ...
CALL dbsync_srvapp.central_set_sync_timestamp()
...

TRY
    BEGIN WORK

    LET s = dbsync_srvapp.central_change_init( comma-sep-table-list )
    IF s<0 THEN GOTO tx_error END IF

    INSERT ...
    LET s = dbsync_srvapp.register_central_insert( ... )
    IF s<0 THEN GOTO tx_error END IF

    UPDATE ...
    LET s = dbsync_srvapp.register_central_update( ... )
    IF s<0 THEN GOTO tx_error END IF

    -- For DELETE we must register the change before the SQL!
    LET s = dbsync_srvapp.register_central_delete( ... )
    IF s<0 THEN GOTO tx_error END IF
    DELETE ...

    COMMIT WORK
    CALL dbsync_srvapp.central_change_done()
    RETURN 0

CATCH
LABEL tx_error:
    CALL dbsync_srvapp.central_change_cancel()
    ROLLBACK WORK
    RETURN -1
END TRY