Forum Moderators: open

Message Too Old, No Replies

Transaction Curiosity

with ASP/mySQL

         

txbakers

3:34 am on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have four InnoDB tables, each with a separate query.

I start with "START TRANSACTION", execute that, then end with "COMMIT" and an execute.

In between are the four queries with an execute.

Normally, if one fails processing stops and none of the queries get executed because it never reaches the Commit.

Tonight one failed but the other three executed.

I'm not clear on error handling in ASP with javascript so I've never coded for the "rollback" assuming that if it never reached commit......

has anyone run into this?

aspdaddy

7:01 am on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use something like this at the bottom of procedures. Otherwise you get uncommited transactions in the database. I dont know how serious that is is MySQL.

if @@Error <> 0
COMMIT TRANSACTION
Else
ROLLBACK TRANSACTION

txbakers

9:42 am on Jul 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it's very serious.

That's I why I probably need an IF ELSE to execute a rollback.

Does anyone know the syntax for error catching in multiple queries in JavaScript?