August 11th, 2009, 02:20 PM
but what if i just want to test a query
the scenario is as following:
i have all tables in MyISAM and it doesn't support transactions.
I have to run a transaction so I first test queries if they throw some error
if they dont then execute else fail gracefully
any idea how to do it?
August 11th, 2009, 04:31 PM
I suggest that you change your tables to InnoDB that supports transactions instead.
Because trying to do what you want in MyISAM will require you to 1. put a write lock on _all_ tables that are involved in your "transaction".
2. then selecting and checking these tables until you are sure that your real queries are going to work.
3. then run the real queries
4. and drop the write lock
And in the end it will still not be transaction safe if there is some problem with a power outage or crashing OS etc.