At 11:42 +0100 10/18/04, Colm G. Connolly wrote:
Hi all,

I'm working with tables stored by the InnoDB engine and would like to
be able to commit only if there are no errors generated by a group of
statements like this.

/* -*- sql -*- */
SET AUTOCOMMIT=0;
use db1;
begin work;
sql statement 1;
sql statement 2;
.
.
.
sql statement n;

At this point I'd like to say, in sql,
if no errors then
   commit;
else
   rollback
end

From what I read in the manual I can do one or the other (commit or
rollback) but there didn't seem to be a way of conditionally doing one
or the other of them.

That's correct. You handle the logic of checking for errors and committing or rolling back using your programming language (or rather, in the MySQL API for your programming language).

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to