PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
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
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com