Using InnoDB rollback as application wide undo?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Using InnoDB rollback as application wide undo?

Post by alex.barylski »

So, I just enabled InnoDB (for whatever reason the MySQL default is NOT the default on Ubuntu :P )

Anyways, rollback sounds promising...and makes total sense for a CMS...what I want to know now is...is there anyway I can add a comment to *every* transaction (system supplied or user) and how can I list all changes made in a chronological order, so a user may see what changes have occured and undo them as desired/required?

Cheers :)
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Transaction does not exist after it was committed. You're stabbing in the wrong direction.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Log them separately as say, the last query performed during the transaction.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

I'm reading up on InnoDB tables as we speak, but still don't understand either of you :P

Can you elaborate a little please?

Once I COMMIT, rollback doesn't exist? So COMMIT/ROLLBACK isn't really for versioning...but rather just a single UNDO for when things go horribly wrong - like power failure, etc???

I can't keep a log of transactions attach a comment to each and display those comments, allowing a user to undo/redo certain operations???

Bummer :roll:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Transactions are a instance-only way of being able to undo a block of queries if something fails and the data would be corrupted otherwise. Once the transaction is committed, it's gone. The server may log it separately on it's own, but that is outside of the database itself.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Thats what I thought...shoot :x
Post Reply