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: Re: Data retrieval
Date: Nov 15 1999 3:28PM

Hrvoje Niksic writes:
 > Based on the code in some examples, people at my company use the
 > following construct to retrieve data from a select:
 > 
 > $dbh->ct_execute("select ...");
 > 
 > while($dbh->ct_results($restype) == CS_SUCCEED) {
 >   next unless $dbh->ct_fetchable($restype);
 >   while (my %data = $dbh->ct_fetch(1)) {
 >     # ... code here ...
 >   }
 > }
 > 
 > Having two while loops for looping through one set of rows seems kind
 > of ugly.  Is it possible to have only one loop?  I guess I could write
 > a function that calls ct_results(), ct_fetchable(), and ct_fetch(),
 > but it might be non-trivial because the function should remember its
 > state information somewhere.
 > 
 > I was wondering if there was any existing functionality to do that.

You could check out the SybTools.pm module, on my web page.

Other than that - the above loop is what *must* happen, although there 
are of course lot's of ways to code it...

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