Concurrent mutiuser access php+mysql -
im going develop stock maintaining system using php+mysql. runs on server machine, many users can update stock data. (in/out)
im working on system. have following problems.
user opens record “a”. ex- val=10 user b opens record “a”. ex - val=10 user saves changes record “a”. ex - val=10+2=12 (add 3 items, stock should 12) user b saves changes record “a”. ex - here need record "a" value = 12, b update val=12+3=15. (then add 3 items final stock 15) in example, user a’s changes lost – replaced user b’s changes. i know mysql innodb facilitate row level locking. question ,
is innodb engine concurrent control ; , enough (innodb) avoid "lost update" problem. or need coding avoid problem.
is enough please tell me how innodb works previous example. (lost update)
(sorry bad english)
thanks
innodb allows concurrent access, user a , user b handling same data. user a update row based on his/her data, user b can same -- resulting in user a's loss of data.
you should consider alternative, if every update vital keep. example, if both users updating blog article, make new table holds these edits. both user's edits preserved, despite when retrieved article content. when article retrieved, can check when recent edit occurred , retrieve that instead.
Comments
Post a Comment