Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Out of Memory
Date: Mar 17 1999 1:16AM

W. Phillip Moore writes:
 > >>>>> "Michael" == Michael Peppler  writes:
 > Michael> Yes, nsql() and sql() store the entire result set in memory.
 > Inspired by this depressing statement, I've just submitted a patch to
 > Michael which will enhance nsql() to accept a CODE reference which
 > will be called for each row of data retreived, preventing the results
 > from accumulating en masse in a single array, thus wiping out all of
 > your systems physical and virtual memory.
 > This allows you to say:
 > 	$db->nsql("select * from really_huge_table","HASH",\&parse_rows);
 > where each row will be passed to &parse_rows as a hash:
 > 	sub parse_rows {
 > 	    my %data = @_;
 > 	    # have fun wtih %data, a single row from really_huge_table
 > 	}

Note that DBlib::sql and CTlib::ct_sql have similar functionality (I'd 
temporarily forgotten ;-)

Anyway, Phil's sent me a patch, so this will no doubt be available in
nsql() in the next release of sybperl. (whenever that is)

Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-
Sybase on Linux mailing list: