<!-- Presentation generated by Internet Assistant for Microsoft PowerPoint 97 -->
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for Microsoft PowerPoint 97">
<TITLE>A connect_cached() example</TITLE>
</HEAD>
<BODY >
<CENTER>
<TABLE WIDTH=100%>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<A HREF="sld001.htm">First</A>
<A HREF="sld024.htm">Previous</A>
<A HREF="sld026.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="tsld025.htm">Text</A>
</TD> </TR>
<TR> <TD WIDTH=100% ALIGN=CENTER>
<IMG SRC="img025.gif" usemap="#Objmap" WIDTH=800 HEIGHT=600 BORDER=0>
</TD> </TR>
</TABLE>
<P>Slide 25 of 80</P>
</CENTER>
<!-- <UL>
<H2>A connect_cached() example</H2>
</UL></P>
<P><UL>
<LI><H2>Compare and contrast...
</H2>
<UL>
my $dbh = DBI->connect(
);
<BR><BR>sub lookup_foo_1 {
<BR> my ($id) = @_;
<BR> $sth = $dbh->prepare_cached("select foo from table where id=?");
<BR> return $dbh->selectrow_array($sth, $id);
<BR>}
</UL></UL><UL>
<LI><H2>with...
</H2>
<UL>
sub lookup_foo_2 {
<BR><BR> my ($id) = @_;
<BR> my $dbh = DBI->connect_cached(
);
<BR> $sth = $dbh->prepare_cached("select foo from table where id=?");
<BR> return $dbh->selectrow_array($sth, $id);
<BR>}
<BR>
</UL></UL><UL>
<H2>Clue: what happens if the database is restarted?
</H2>
</UL><UL>
<H2>.</H2>
</UL></P>
<P> -->
</Body>
</HTML>