Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How implement Rollback feature?

I want to create a C# application in which copy some files in two diffrent folders(already contains older version files) and also run sql scripts. During whole process if any exception generate i need to rollback all the changes.

For sql scripts, transation can be used but how implement files copying process with rollback?

like image 655
Nakul Chaudhary Avatar asked Nov 12 '09 07:11

Nakul Chaudhary


People also ask

How does rollback work?

In SQL, ROLLBACK is a command that causes all data changes since the last BEGIN WORK , or START TRANSACTION to be discarded by the relational database management systems (RDBMS), so that the state of the data is "rolled back" to the way it was before those changes were made.

How does rollback work in SQL?

Rolls back an explicit or implicit transaction to the beginning of the transaction, or to a savepoint inside the transaction. You can use ROLLBACK TRANSACTION to erase all data modifications made from the start of the transaction or to a savepoint. It also frees resources held by the transaction.

What is rollback software?

A DBMS feature that reverses the current transaction out of the database, returning the data to its former state. A rollback is performed when processing a transaction fails at some point, and it is necessary to start over.

Can we rollback committed transaction?

No, you can't undo, rollback or reverse a commit.


1 Answers

You can take advantage of Transactional NTFS if possible. If not, then you can keep a list of the operations you did and do the reverse of it when a rollback is needed.

like image 88
idursun Avatar answered Oct 12 '22 08:10

idursun