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: Lal dot Bandaru at Ebay dot Sun dot COM (Lal B Bandaru)
Subject: fetching columns???
Date: Feb 27 1998 10:35PM

Hi,

I am trying to write a sybperl routine to process the results returned
by ct_results() call. I want to store it a nxn matrix where I can
easily get data of any column/row in program later.

My problem is I am able to fetch only row by row. Is there a way to
fetch column by column in a row?

Code is like this:

   while (($ret_code = $dbh->ct_results($res_type)) == CS_SUCCEED)
   {
         if ($res_type == CS_ROW_RESULT) {

            $num_cols = $dbh->ct_res_info(CS_NUMDATA);
            print "num_cols = $num_cols\n\n";

            # Skip non-fetchable results:
            next unless $dbh->ct_fetchable($res_type);

            # Retrieve actual data rows:
            $i = 0;
            while( @row_fetched = $dbh->ct_fetch) {
               print "row fetched: @row_fetched\n";
               $result_set[$i++] = @row_fetched;
            }
         }
   }
   
   
Regards,
Lal.