<!-- Presentation generated by Internet Assistant for Microsoft PowerPoint 97 -->
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for Microsoft PowerPoint 97">
<TITLE>Picking up the Pieces</TITLE>
</HEAD>
<BODY >
<CENTER>
<TABLE WIDTH=100%>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<A HREF="sld001.htm">First</A>
<A HREF="sld045.htm">Previous</A>
<A HREF="sld047.htm">Next</A>
<A HREF="sld102.htm">Last</A>
<A HREF="index.htm">Index</A>
<A HREF="dbi.perl.org">Home</A>
<A HREF="tsld046.htm">Text</A>
</TD> </TR>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<IMG SRC="img046.gif" usemap="#Objmap" WIDTH=800 HEIGHT=600 BORDER=0>
</TD> </TR>
</TABLE>
<P>Slide 46 of 102</P>
</CENTER>
<!-- <UL>
<H2>Picking up the Pieces</H2>
</UL></P>
<P><UL>
<LI><H2>So, what went wrong?
</H2>
<UL>
$@
<BR><UL>
<LI>holds the text of the error message
</UL>if ($DBI::err && $@ =~ /^(\S+) (\S+) failed: /)
<UL>
<LI>then it was probably a DBI error
<LI>and $1 is the driver class (e.g. DBD::foo::db), $2 is the name of the method (e.g. prepare)
</UL>$DBI::lasth
<UL>
<LI>holds last DBI handle used (not recommended for general use)
</UL>$h->{Statement}
<UL>
<LI>holds the statement text associated with the handle (even if its a database handle)
<LI>
</UL></UL></UL><UL>
<LI><H2>$h->{ShowErrorStatement} = 1
</H2>
<UL>
<LI>appends $h->{Statement} to RaiseError/PrintError messages:
<LI>DBD::foo::execute failed: duplicate key [for ``insert
]
<LI>for statement handles it also includes the $h->{ParamValues} if available.
<LI>Makes error messages much more useful. Better than using $DBI::lasth
<LI>Many drivers should enable it by default. Inherited by child handles.</UL></UL></P>
<P> -->
</Body>
</HTML>