RE: Column headings question

"Louis Proyect" <[email protected]> Thu, 8 Oct 2009 12:53:34 -0400
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <2690DBBEF4364D45B0E834208CDD712E0300B422@CUIT-EXCHANGE2.ais.columbia.edu>
Thanks for all the suggestions. I found some code on a very old query
here that worked for me:

http://www.peppler.org/archive/sybperl-l/1997/11/1123.html

$X->ct_execute("exec stored_procedure");

while(($rc = $X->ct_results($restype)) == CS_SUCCEED) {
    next if($restype == CS_CMD_DONE || $restype == CS_CMD_FAIL ||
            $restype == CS_CMD_SUCCEED);
    if(@names = $X->ct_col_names()) {
       foreach $row (@names)
       {@column_names[$cntr] = $row;
        $cntr++;}
    }
    while(@dat = $X->ct_fetch)
    {$cc_count = @dat;
     if ($cc_count > 1)
     {@results = @dat;}
    }
}

Next I will correlate @column_names and @results, which contains the
data.

I should have mentioned, btw, that I needed to do this because the
results from the stored procedure contains over 100 separate columns and
I did not want to hard-code them in the script.

If anybody has any suggestions about tightening the code, I'd appreciate
them.

I have been working in sybperl for over 15 years now and there are still
lots of things that I feel like a newbie on--like this.