I really hate studying from a book. My learning style is much more practial hands on. My mind just does not want to read and make notes on this boring technical book, and I can’t keep myself from getting side tracked.
Case in point, Page 235 of my LPCI 1 text book (awful by the way, don’t get LPIC-1 in depth by Michael Jang, its useless, honestly), I decide to browse through my photo archive after I pulled that shot out yesterday. And this is what I came up with:
Right, mind. Back to shell scripting. (While loops.)
Why should you not use your notepad as a coaster? This is why:
The notes did say this, before my lovely hot black coffee destroyed them:
== Start transaction
== End transaction, saving all changes
== Undo all changes that you’ve made in the transaction
What are they? In mySQL 5, with a table storage type of “innodb” you can use transactions. This means, that you can make a set of changes together, like recording the removal of a credit, and the adding of an advert to a website, at one instance, even if it’s multiple mysql transactions within one connection.
You do that, by sending the command (literally “BEGIN;” or “begin;”) to start a transaction, run all the queries you need to run, and then run the commit if you want the all the changes to take, or rollback if you don’t. If any one of the sql queries fails after you’ve made a begin, and it shouldn’t have, you can rollback *all* the changes you’ve made to the database. Obviously, this needs one mySQL connection, but if you’re using more than one each run of the program you’re using, I’d be very surprised.