-
Notifications
You must be signed in to change notification settings - Fork 4
Description
There is good way to implement user transactions
Example API:
userdata pg_begin_tx(userdata connection)
Execute query CREATE TRANSACTION, set it status 'open' and save into local transactions storage.
userdata pg_rollback_tx(userdata transaction)
Get transaction from storage. If transaction is open and valid, rollback it with ROLLBACK and set 'rollbacked' status.
Abort transaction when has no instances in storage
userdata pg_commit_tx(userdata transaction)
Get transaction from storage and commit it with COMMIT if opened and set 'commited' status.
Abort transaction when has no instances in storage
Client database transactions control implementation may prevent problems with concurrent execution and add more performance features (for instance, execute whole transaction in one query)