<!-- Presentation generated by Internet Assistant for Microsoft PowerPoint 97 -->
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for Microsoft PowerPoint 97">
<TITLE>Let the DBI cache your handles</TITLE>
</HEAD>
<BODY >
<CENTER>
<TABLE WIDTH=100%>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<A HREF="sld001.htm">First</A>
<A HREF="sld021.htm">Previous</A>
<A HREF="sld023.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="tsld022.htm">Text</A>
</TD> </TR>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<IMG SRC="img022.gif" usemap="#Objmap" WIDTH=800 HEIGHT=600 BORDER=0>
</TD> </TR>
</TABLE>
<P>Slide 22 of 80</P>
</CENTER>
<!-- <UL>
<H2>Let the DBI cache your handles</H2>
</UL></P>
<P><UL>
<LI><H2>Sometimes it's not easy to hold all your handles
</H2>
<UL>
<LI>e.g., library code to lookup values from the database
<LI>
</UL></UL><UL>
<LI><H2>The prepare_cached() method gives you a client side statement handle cache:
</H2>
<UL>
<BR><BR>sub lookup_foo {
<BR> my ($dbh, $id) = @_;
<BR> $sth = $dbh->prepare_cached("select foo from table where id=?");
<BR> return $dbh->selectrow_array($sth, $id);
<BR>}
<BR>
</UL></UL><UL>
<LI><H2>Can avoid the need for global statement handle variables
</H2>
<UL>
<LI>which can cause problems in some situations, see later</UL></UL></P>
<P> -->
</Body>
</HTML>