0

What is the most optimally way to emulate "transactions" in conjunction MyISAM+PHP ( giving the opportunity to have "start","commit","rollback" "transactions" with DB) ? Or advise any ready solution for it. Due to implementation of the system is not possible change MyISAM to InnoDB on this moment.

Thanks.

voodoo417
  • 11,861
  • 3
  • 36
  • 40
  • 2
    There are no transactions in MyISAM. And you will not be able to "emulate" that because MyISAM supports only exclusive locking mode (unlike InnoDB, which supports row blocking mode - and transactions as well). Unless you're using MySQL<4.1 I strongly recommend you to use InnoDB for transactional DB – Alma Do Jan 12 '14 at 12:22
  • @Alma Do I know it all. I ask, can anyone come across such an issue. You think it impossible? – voodoo417 Jan 12 '14 at 12:32
  • 1
    Yes, it's impossible to fullfill all requirements for transaction: atomicity, consistency, isolation and durability. You'll fail at least at "Isolation" requirement (due to exclusive table locking) – Alma Do Jan 12 '14 at 12:37
  • @Alma Do Thanks for answers.But, example: I start insert "related" values in 5 "related" tables (MyISAM).Do 5 query. I can control "processing" of this queries in PHP. Imagine, fifth value didnt insert.I know other four inserted "entity" (their ids,for examle). And now i can delete these rows. Do like "rollback".Now I'm looking for any most simple way to create "wrapper" ( like transaction ) for these block of queries. – voodoo417 Jan 12 '14 at 13:06
  • Now imagine that another instance of script will do the same. And you must keep isolation & atomicity. How you'll achieve that? Yes, the only answer in MyISAM is: lock tables. But when you'll do that, you'll affect other instances and that is imminent (because they're using same tables). And so on - many examples may be shown – Alma Do Jan 12 '14 at 13:14
  • possible duplicate of [MyIsam engine transaction support](http://stackoverflow.com/questions/8036005/myisam-engine-transaction-support) – krokodilko Jan 12 '14 at 14:11

0 Answers0