A connect_cached() example
Compare and contrast...
my $dbh = DBI->connect(…);
sub lookup_foo1 {
my ($id) = @_;
$sth = $dbh->prepare_cached("select foo from table where id=?");
return $dbh->selectrow_array($sth, $id);
}
with
sub lookup_foo2 {
my ($id) = @_;
my $dbh = DBI->connect_cached(…);
$sth = $dbh->prepare_cached("select foo from table where id=?");
return $dbh->selectrow_array($sth, $id);
}