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
#!/bin/sh
/usr/local/bin/mysql dbname <<_EOF_
load data infile 'fname' into table tablename;
_EOF_
cntafter=`/usr/local/bin/mysql -s dbname <<_EOF_
select count(*) from tablename;
_EOF_`
/usr/local/bin/mysql dbname <<_EOF_
update tablename set field1='something' where field2=0;
_EOF_
--
Later
Mogens Melander mailto:mogens@stripped
http://www.fumlersoft.dk http://www.trader.dk
http://www.birkerod.dk http://tux.trader.dk
| Thread |
|---|
| • status from mysql client | Mogens Melander | 18 Feb |