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: Curtis Johnson <Curtis dot Johnson at OAG dot STATE dot TX dot US>
Subject: Re: standard execution of stored proc
Date: Jun 17 1998 9:41PM

Regarding DBlib v. CTlib:

I am fairly familiar with the Dblib method of
         $dbh->dbcmd("declare \@err_msg varchar(20)") ;
         $dbh->dbcmd("exec ag_ins_hnp .....

        $dbh->dbcmd(", \@err_msg output");
        $status=$dbh->dbsqlexec ;

        if ($status == 0) { # check status for problem
           $res = "Problem Running Stored Procedure ag_ins_hnp" ;
           .............
        } else {
           # Fetch Results
           while ($dbh->dbresults != 2) {
              while (%out = $dbh->dbnextrow(1) ) {
              }
           }
           %out = $dbh->dbretdata(1) ;
           # Get the stored proc return values
           if ($dbh->dbhasretstat == 1) {
              if ($dbh->dbretstatus == 0) {
                 $hnp_count++ ;
                 #  All is OK
              }
              else {
                # Return status is non-zero, Uh Oh ;-(
                $res = "$out{'Par 1'}" ;
                $msg = "Error running ag_ins_hng -- $res \n" ;
                ..........
              }
           }  else { # dbhasretstat didn't return 1 -- why?
              # do something here
        ....................
           }
        }
      }

In this case, I know it is over-kill since I either get a result or an error message in err_msg..  

How would I do something like this with nsql or CTlib?  Is there more documentation on these
than exists on Peppler's page?

thanks
Curtis Johnson