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: "W dot Phillip Moore" <wpm at ms dot com>
Subject: Out of Memory
Date: Mar 16 1999 8:27PM

>>>>> "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
	}

I'm turning this code loose on my user/developer community here at
MSDW, and once I am confident the patch won't embarrass me in public,
I'll post it here.

W. Phillip Moore                                          Phone: 212-762-2433
Vice President, Infrastructure Development                  FAX: 212-762-0174
Morgan Stanley Dean Witter                                 E-mail: wpm@ms.com
750 7th Ave, NY, NY 10019