hi..

i'm trying to understand if there's a difference/better reason for doing
transactions using either of the following psuedo approaches...

approach 1 does the commit inside the eval block, whereas approach 2 has the
commit outside the eval block... i've seen sample code with transactions
handled both ways...

approach 1:
eval
{
   $dbh->do("do something");

   # got this far means no errors
   # commit
   $dbh->commit();
};

# check errors/rollback
if ($@)
{
   $dbh->rollback();
}


approach 2:
eval
{
   $dbh->do("do something");
};

# check errors/rollback
if ($@)
{
   $dbh->rollback();
}
else
{
   # commit
   $dbh->commit();
}


any comments/criticisms/thoughts/etc...

thanks...

-bruce


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

Reply via email to