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: Hrvoje Niksic <hniksic at iskon dot hr>
Subject: Data retrieval
Date: Nov 15 1999 10:30AM

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.