mysql - Transaction necessary for single update query? -


i have mysql query on innodb table this:

update items set qty = qty + 5 item_id = 1234 limit 1; 

do need use transaction this? undesirable happen not using transaction?

nothing serious can happen. default, mysql wraps single update/insert/delete commands in transaction. if goes wrong in update, transaction should rolled correctly.

you need transactions when combining multiple changes , want them take effect "at same time" or "not @ all".

you can read more in documentation.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -