On Tue, 26 Jun 2001, Steven Lembark wrote:

> > What about SELECT statements, though? The selectrow_array functions aren't
> > adequate for this, because they can only be used to return the first row.
>
> The last version of DBI came with "selectall_*", no?

Is this reasonably efficient for tables that have thousands of rows? e.g.

$rows = $dbh->selectall_hashref("SELECT ...");
for my $row (@{$rows}) {
  do something with $row
}

versus:

$sth = $dbh->prepare("SELECT ...");
$sth->execute;
while ($row = $sth->fetchrow_hashref) {
  do something with $row
}

Doesn't the first way have to retrieve all the results of the SELECT
query, but the second way has the option of stopping part way through if
it finds out that it doesn't need anymore data? (Or am I misunderstanding
how this works?)

-Philip Mak ([EMAIL PROTECTED])

Reply via email to