Database Transaction
Commit all records at once
Last updated
Commit all records at once
Last updated
Database transaction allows you to treat a set of functions as a whole. Meaning that every function must succeed properly in order for all of them to be executed. Usually you would use this if you have two or more functions that are mission critical.
Database transaction was created for financial systems. For example, during a transfer, if money is successfully withdrawn from one account but something goes wrong with the deposit to the second account, then you would want the entire transfer to be cancelled. Otherwise, the money would still be withdrawn from the first account even though it was never received by the second account.
Note regarding Database Transactions: Keep in mind that only database functions are used when determining if the database transaction should be applied. This means that things like creating and updating variables, external API requests, and other functions that are not adding or editing records will still execute regardless of the outcome of the database transaction.
Database Transaction: Commit all records at once.