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: Monty Scroggins <Monty dot Scroggins at wcom dot com>
Subject: Re: How to handle 4 resluts sets?
Date: May 8 2000 3:04PM

I believe this is how you do it...   You have to use an outer loop to
collect
all of the resultsets...


   #until no result sets are pending
   while($dbh->dbresults != NO_MORE_RESULTS) {
      #for each row returned for each result set
      while (@dbdata=$dbh->dbnextrow) {
         ...blah blah...
         }#while (@dbdata=$dbh->dbnextrow)
   }#while


Monty


----- Original Message -----
From: 
To: "SybPerl Discussion List" 
Sent: Monday, May 08, 2000 9:42 AM
Subject: How to handle 4 resluts sets?


> Hello
>
> I have been using sybperl for some time now... and I have never had to
> retrieve more than one result set. Over the weekend I was hammering out
some
> code and I ran into this problem sp_help "". Now we all know
the
> sp_help returns 4 result sets - this is code I am using:
>
> use Sybase::DBlib;
> #"Some code here ****
>
> $dbh->dbcmd("sp_help $table_name[$i]");
> $Exec_status = $dbh->dbsqlexec;
> $Results_status = $dbh->dbresults;
>
> while(%Table_data = $dbh->dbnextrow(1))
> {
>
>             $Column_name = $Table_data{Column_name};
>         $Type = $Table_data{Type};
>         $Length = $Table_data{Length};
>
>         print OUTFILE "$table_name[$i],$Column_name,$Type,$Length\n";
>
> }
>
> #"Some More code here ****
>
> The code above works no problem with 1 result set but 2+ result sets it
spits
> out some error messages or loses the second, third etc. result set... This
> more of curious question on how to handle more than one result set - do I
> need to start using dbpoll and dbsqlok? If someone could point me in
correct
> direction - it would be appreciated.
>
> Thanxs
> Leigh
>