<!-- Presentation generated by Internet Assistant for Microsoft PowerPoint 97 -->
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for Microsoft PowerPoint 97">
<TITLE>Transactions - How the DBI helps</TITLE>
</HEAD>
<BODY >
<CENTER>
<TABLE WIDTH=100%>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<A HREF="sld001.htm">First</A>
<A HREF="sld039.htm">Previous</A>
<A HREF="sld041.htm">Next</A>
<A HREF="sld080.htm">Last</A>
<A HREF="index.htm">Index</A>
<A HREF="http://dbi.perl.org">Home</A>
<A HREF="tsld040.htm">Text</A>
</TD> </TR>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<IMG SRC="img040.gif" usemap="#Objmap" WIDTH=800 HEIGHT=600 BORDER=0>
</TD> </TR>
</TABLE>
<P>Slide 40 of 80</P>
</CENTER>
<!-- <UL>
<H2>Transactions - How the DBI helps</H2>
</UL></P>
<P><UL>
<LI><H2>Tools of the trade:
</H2>
<UL>
<LI>Set AutoCommit off, and RaiseError on
<LI>Wrap eval {
} around the code
<LI>Use $dbh->commit; and $dbh->rollback;
<UL>
<LI>
</UL></UL></UL><UL>
<LI><H2>Disable AutoCommit via $dbh->{AutoCommit} = 0;
</H2>
<UL>
<LI>to enable transactions and thus rollback-on-error
</UL></UL><UL>
<LI><H2>Enable RaiseError via $dbh->{RaiseError} = 1;
</H2>
<UL>
<LI>to automatically 'throw an exception' after an error
</UL></UL><UL>
<LI><H2>Add surrounding eval {
}
</H2>
<UL>
<LI>catches the exception, the error text is stored in $@
</UL></UL><UL>
<LI><H2>Test $@ and $dbh->rollback() if set
</H2>
<UL>
<LI>note that a failed statement doesnt automatically trigger a transaction rollback</UL></UL></P>
<P> -->
</Body>
</HTML>