Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Milan Mikic" <Milan dot Mikic at gartmore dot com>
Subject: Re: Error handling
Date: Mar 26 1998 9:14AM


not to my knowledge. Here it is:

# @(#)    1.5  10/18/95
# Copyright (c) 1994
#   Michael Peppler and ITF Management SA
#   You may copy this under the terms of the GNU General Public License,
#   or the Artistic License, copies of which should have accompanied
#   your Perl kit.

# A couple of utility stuff for both Sybase::DBlib and Sybase::Sybperl

sub message_handler
    my ($db, $message, $state, $severity, $text, $server, $procedure,
     = @_;

    # Don't display 'informational' messages:
    if ($severity > 10)
     print STDERR ("Sybase message ", $message, ", Severity ", $severity,
            ", state ", $state);
     print STDERR ("\nServer `", $server, "'") if defined ($server);
     print STDERR ("\nProcedure `", $procedure, "'") if defined
     print STDERR ("\nLine ", $line) if defined ($line);
     print STDERR ("\n    ", $text, "\n\n");

# &dbstrcpy returns the command buffer.

         my ($lineno, $cmdbuff) = (1, undef);

         $cmdbuff = &Sybase::DBlib::dbstrcpy($db);

         foreach $row (split (/\n/, $cmdbuff))
          print STDERR (sprintf ("%5d", $lineno ++), "> ", $row, "\n");
    elsif ($message == 0)
     print STDERR ($text, "\n");


sub error_handler {
    my ($db, $severity, $error, $os_error, $error_msg, $os_error_msg)
     = @_;
    # Check the error code to see if we should report this.
    if ($error != SYBESMSG) {
     print STDERR ("Sybase error: ", $error_msg, "\n");
     print STDERR ("OS Error: ", $os_error_msg, "\n") if defined


&dbmsghandle ("message_handler");
&dberrhandle ("error_handler");

1; on 25/03/98 17:01:22

Please respond to

cc:    (bcc: Milan Mikic/GB/GARTMORE)
Subject:  Re: Error handling

Milan Mikic wrote:
> Dear All,
> Here is a peace of code trying to use example of error/message handling
> supplied with Sybperl 2.03. Does anyone have an idea why it does not
> out any error messages, knowing that table dfdfdf does not exist in the
> database.
Your code definitely produces the correct error message here.
I've looked at the 2.03 code and I can't see why it wouldn't
print the error.
Has the file been modified locally?
Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-

Gartmore Investment Management plc is an appointed representative of
Gartmore Investment Ltd (GIL) which is regulated by IMRO and the
Personal Investment Authority. GIL represents only the NatWest and Gartmore
Marketing Group for life assurance, pensions, unit trusts, other regulated
collective investment schemes and investment services.