Omid Nazifi
Omid Nazifi

Reputation: 5234

When are rules of Rollback, commit and begin in mysql used?

I was reading a article that saw rules rollback, commit and begin.

I don't know these rules what is used?

are there a friend that describe me?

Upvotes: 0

Views: 475

Answers (1)

Anders Abel
Anders Abel

Reputation: 69270

begin, commit and rollback controls a transaction. Everything done within a transaction is either saved together (through commit) or not saved at all (if doing rollback).

This can be used if several updates are done which should only get effect if all are successful. If you wrap them in a transaction you can then commit all the changes if they are successful, or rollback all of them if any step along the way fails.

More details can be found in Transactions in MySQL.

Upvotes: 2

Related Questions