MYSQL PHP PDO order of statements in a transaction -
i using innodb in mysql , accessing table php pdo.
i need lock table, select , then, depending on result of either insert row or not. since want have table locked short time possible, can this?
prepare select prepare insert begin transaction lock table execute select if reservation time available execute insert unlock table commit
or prepares have inside transaction? or have after lock?
should transaction include insert, or make difference?
begintransaction
turns off autocommit mode, affects queries commit changes. means prepared statements, select
, , lock tables
not affected transactions @ all. in fact, if you're doing single insert
there's no need use transaction; need use them if wanted multiple write queries atomically.
Comments
Post a Comment