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

How to logout from a login page in asp.net -

PHP Error "Undefined index" -