in reply to prepare statement within DBI
$sth = $dbh->prepare("select count(*) from table_one"); $sth->execute(); $row1 = $sth->fetchrow_array; $sth = $dbh->prepare("select count(*) from table_two"); $sth->execute(); $row2 = $sth->fetchrow_array;
Unrelated comment: with DBIx::Simple, you can save yourself some typing.
or even, giving up a lot of speed:$db->query('select count(*) from table_one')->into($row1); $db->query('select count(*) from table_two')->into($row2);
$db->select(table_one => '*')->into($row1); $db->select(table_two => '*')->into($row2);
DBIx::Simple caches queries automatically, so there is no need to separate prepare and execute yourself.
Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: prepare statement within DBI
by sharkey (Scribe) on Aug 27, 2004 at 04:26 UTC | |
by Juerd (Abbot) on Aug 27, 2004 at 05:35 UTC |