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: "Salvi, Stefano" <Stefano dot Salvi at disney dot com>
Subject: Re[4]: Open Client needed?
Date: Jul 8 1999 9:45AM

     Thank you,
     
     I suspected that the solution would involve something like a callback, 
     but being my obtuse old self didn't think that print messages 
     classified as Server Messages.
     
     Once again,
     
     thank you,
     
     Stefano Salvi


______________________________ Reply Separator _________________________________
Subject: Re: Re[2]: Open Client needed?
Author:  David.Whitsed@hr-m.b-m.defence.gov.au at ~DISNEY-SMTP
Date:    07/07/99 17:36


You need to install a callback procedure for server messages and 
catch messages with severity = 10 and message number = 0
     
eg.
     
    # install ct-lib callbacks
    ct_callback(CS_SERVERMSG_CB, \&server_cb);
     
sub server_cb
{
    my($cmd, $number, $severity, $state, $line, $server, $proc, $msg) =
@ARG;
     
    # catch output from sql print statements 
    if($number == 0 && $severity == 10){
        print STDERR "$msg\n";
    }
     
    # don't worry about info messages (severity 10) 
    return $DB_OK if($severity < 11);
     
    printf STDERR "\nServer message: (In server_cb)\n"; 
    printf STDERR "Message number: %ld, Severity %ld, ",
               $number, $severity;
    printf STDERR "State %ld, Line %ld\n",
               $state, $line;
     
    if (defined($cmd)) {
     printf STDERR "cmd: %s\n", $cmd;
    }
     
    if (defined($server)) {
     printf STDERR "Server '%s'\n", $server;
    }
     
    if (defined($proc)) {
     printf STDERR " Procedure '%s'\n", $proc;
    }
     
    printf STDERR "Message String: %s\n", $msg;
     
    # set these global variables so that other routines 
    #can tell that an error has occurred.
     
    $svr_msg = $number;
    $svr_severity = $severity;
     
    # callbacks MUST return CS_SUCCEED
    CS_SUCCEED;
}