Data changes: Row removal (DELETE)
To delete a row with a DB Sync client app, first register the deletion, then perform the DELETE operation.
Before doing the local
DELETE
, register the row deletion with
dbsync_app.register_local_delete()
and perform the DELETE
after
the delete registration:BEGIN WORK
TRY
LET s = dbsync_app.register_local_delete( "customer",
r_customer.customer_id )
IF s < 0 THEN
ERROR "Failed to register customer row deletion"
ROLLBACK WORK
NEXT FIELD CURRENT
END IF
DELETE FROM customer WHERE customer_id = r_customer.customer_id
CATCH
ERROR "Failed to delete the customer row"
ROLLBACK WORK
NEXT FIELD CURRENT
END TRY
COMMIT WORK
Important:
Because row data is saved in a stash table, you must DELETE
the local table row
after registering the row deletion.