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: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Trapping Errors with Sybperl
Date: Aug 7 2000 3:10PM

Chen, Charley writes:
 > Hi,
 > I'm new to the list and new to sybperl.  So this question may seem stupid.
 > I am trying to fix a perl script that is wrapper for isql.  However it
 > doesn't seem to trap errors properly.  For example if I pass in a simple
 > sql:
 > 	Select 1/0

This error is flagged in the msg handler as error 3607.

You can verify this with the following little script:


use Sybase::DBlib;

dbmsghandle(sub { print "msg: @_\n"; });
dberrhandle(sub { print "err: @_\n"; });

$dbh = new Sybase::DBlib 'sa';

$dbh->dbcmd("select 1/0");

which outputs:

troll (8:07AM):47 > perl ~/tmp/ 
msg:  5701 2 0 Changed database context to 'master'.   3
msg:  5703 1 0 Changed language setting to 'us_english'.   3
msg: Sybase::DBlib=HASH(0x81684b8) 3607 0 0 Divide by zero occurred.   1

The reason it does not show when using the handlers in is
that the "severity" value appears to be 0, which seems strange. The
handler in ignores all messages with severity < 10.

Michael Peppler         -||-  Data Migrations Inc.    -||-
Int. Sybase User Group  -||-
Sybase on Linux mailing list: