|
|
sybperl-l Archive
Up Prev Next
From: "Johnson, Phil" <Phil dot Johnson at fmr dot com>
Subject: Problems understanding error handling
Date: Jul 17 1998 6:40PM
I've been having some trouble understanding the whole error message handling
spiel.
For the longest time, I've just been putting dbmsghandle("message_handler")
at the top of my perl scripts and it has served me well.
Now, I need to actually trap an error (namely: Sybase error: Unable to
connect: SQL Server is unavailable or does not exist.). If I can't connect,
then I must start up the Sybase NetGateway process via a system call.
Here is how I connect to a Sybase NetGateway:
$d = new Sybase::DBlib 'blar', 'bload', 'DCAT_DAL1_G_SYG';
$ref = $d->sql("exec sgw_status clients");
for $line (@$ref) {
do_stuff;
}
So how do I trap the error that is generated by the $d = new Sybase::DBlib
call?
Would I get into sybutil.pl and copy out the message_handler routine and
fiddle with it so it returns a value rather than just printing the error
message?
Please pardon my ignorance, but I just don't seem to be able to grasp the
whole concept of error handling from within sybase. I'm also not all that
experienced with sybperl either (the only sybperl stuff I use is sql() and
the dbmsghandle routine).
I'd appreciate any info to point me in the correct direction.
Thanks
Phil
|