|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Out of Memory
Date: Mar 11 1999 3:15PM
Adam.Vile@barclayscapital.com writes:
> We are running a stored procedure which returns 79,000 rows and are getting
> an "out of memory" error. Is it the case that nsql returns the whole array
> of references to the memory? If so how can we avoid this error? Does DBLib
> provide a buffering facility? Any suggestions (of a non-personal nature!)
> welcome.
Yes, nsql() and sql() store the entire result set in memory.
You should use dbcmd/dbresults/dbnextrow to do a row by row
retrieval. Alternatively, you could take a look at SybTools.pm (on my
web page, see .sig below) which implements a HashIter sub package that
goes something like this:
my $q = new SybTools::HashIter $sql;
while($row = $q->next) {
# do something with the data for this $row
}
Note that SybTools uses Sybase::CTlib, but it might give you some
ideas.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
|