Turning off autocommit in SQLYog

SQLYog (or perhaps more properly, MySQL itself), has an auto-commit feature turned on by default. This means that if you update or delete a row, you don't get a chance to roll back.

There are two solutions to this problem:

1. Use the 'autocommit' option

   set autocommit = 0;  
   select @@autocommit;
   .... <execute your SQL>
   commit;
   set autocommit = 1;

2. Use a transaction

   start transaction;
   .... <execute your SQL>   
   rollback;

These solutions will only work if the database backend is transactional (not all MySQL backends are transactional).

SQLYogAutoCommit (last edited 2008-07-09 06:21:36 by localhost)