List:General Discussion« Previous MessageNext Message »
From:Mogens Melander Date:February 18 2000 4:48pm
Subject:status from mysql client
View as plain text  
Hi all,

I'm not shure if this has anything to do with MySQl, but here
goes anyway.

Every night i (crond) run a series of queries on a database, 
importing, updating and consolidating on different tables.

Sometimes one or more query fails and the data 
will get messed up, leaving a lot of manual cleaning up for me.

I need some way to know that a query failed, so that i can
perform a rollback to where i where before the batch started.

The rollback will be relatively simple if i can catch an error
when it occours, but rather difficult if i have to wait until
the batch has completed.

So, is there anyway to know if a query failed. The script is
something like the folowing.

Btw. i'm running MySQL 3.23.8-alpha on Linux Slackware 3.6->7.0

/usr/local/bin/mysql dbname <<_EOF_
load data infile 'fname' into table tablename;

cntafter=`/usr/local/bin/mysql -s dbname <<_EOF_
select count(*) from tablename;

/usr/local/bin/mysql dbname <<_EOF_
update tablename set field1='something' where field2=0;

      Mogens Melander              mailto:mogens@stripped
status from mysql clientMogens Melander18 Feb