The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

<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-&#062connect(…);
<BR><BR>sub lookup_foo_1 {
<BR>    my ($id) = @_;
<BR>    $sth = $dbh-&#062prepare_cached("select foo from table where id=?");
<BR>    return $dbh-&#062selectrow_array($sth, $id);
<BR>}
<BR>
</UL></UL><UL>
<LI><H2>with...
</H2>
<UL>
sub lookup_foo_2 {
<BR><BR>    my ($id) = @_;
<BR>    my $dbh = DBI-&#062connect_cached(…);
<BR>    $sth = $dbh-&#062prepare_cached("select foo from table where id=?");
<BR>    return $dbh-&#062selectrow_array($sth, $id);
<BR>}
<BR>
</UL></UL><UL>
<H2>Clue: what happens if the database is restarted?</H2>
</UL></P>
<P></P> 
<P>
<TABLE>
  <TD HEIGHT=100 WIDTH=100> <A HREF="tsld032.htm">Previous slide</A> </TD>
  <TD HEIGHT=100 WIDTH=100> <A HREF="tsld034.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="sld033.htm">View graphic version</A> </TD>
</TABLE>
<BR>
</P>



</Body>
</HTML>