<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft Internet Assistant for PowerPoint 97">
<TITLE>A connect_cached() example</TITLE>
</HEAD>
<BODY >
<H1>A connect_cached() example</H1>
<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></P>
<P>
<TABLE>
<TD HEIGHT=100 WIDTH=100> <A HREF="tsld024.htm">Previous slide</A> </TD>
<TD HEIGHT=100 WIDTH=100> <A HREF="tsld026.htm">Next slide</A> </TD>
<TD HEIGHT=100 WIDTH=150> <A HREF="tsld001.htm">Back to first slide</A> </TD>
<TD HEIGHT=100 WIDTH=150> <A HREF="sld025.htm">View graphic version</A> </TD>
</TABLE>
<BR>
</P>
</Body>
</HTML>