Skip to content. | Skip to navigation

Sections
You are here: Home thumper Notes / mySQL Transactions
Personal tools
  • Log in
Document Actions

Notes / mySQL Transactions

Why should you not use your notepad as a coaster? This is why:

Notes


The notes did say this, before my lovely hot black coffee destroyed them:

"begin" == Start transaction
"commit"
== End transaction, saving all changes
"rollback"
== 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.

The URL to Trackback this entry is:
http://trollstomper.org.uk/Members/thumper/the-kirrus-blog/notes-mysql-transactions/tbping
« January 2009 »
Su Mo Tu We Th Fr Sa
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Recent entries
Move Pending 27 Apr
General Update Ramble 25 Apr
Centos 09 Apr
Away 04 Apr
Redunancy 03 Apr
Life, Earth and Philoso 29 Mar
Handy Gedit Features. 01 Mar
Buy Duracell batteries online
Buy Duracell batteries online from Buyabattery.co.uk. Our approach to internet sales is very simple. See online for more information today!
Web Page Design
With our novel approach to web page design, you can alter the contents of your website. Click here to use our extraordinary service!
IT support London >>
Don't get second grade support for your IT needs. Get the experts.
About this blog
Kirrus's web log about web design, the internet, linux/ubuntu, plone, and life in general.
 
(no ads)
Buy Duracell batteries online
Buy Duracell batteries online from Buyabattery.co.uk. Our approach to internet sales is very simple. See online for more information today!
Web Page Design
With our novel approach to web page design, you can alter the contents of your website. Click here to use our extraordinary service!
IT support London >
Don't get second grade support for your IT needs. Get the experts.