in reply to sql record sets
Rather than fetch the data a row at a time using $sth->fetchrow, you might fetch all of the data ahead of time, with something like $sth->fetchall_arrayref. Then you can do pretty much whatever you like with them.
If the data are too large to fit comfortably in memory, this isn't the right approach. In that case, you're probably better off doing multiple queries (if you prepare the query ahead of time using $dbh->prepare, you may save some time over doing a $dbh->query every time).
Update: D'oh! That's fetchall_arrayref, not fetchrow_arrayref. Thanks pope and Flexx!
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: sql record sets
by pope (Friar) on Sep 16, 2002 at 07:45 UTC | |
by Flexx (Pilgrim) on Sep 16, 2002 at 17:15 UTC |