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: Michael Peppler <mpeppler at peppler dot org>
Subject: RE: Trapping Sybase errors...
Date: Feb 10 2000 4:20PM

Amit Agarwal writes:
 > 
 > i would like to unsubscribe, how do i go about doing that

send mail to listproc@list.cren.net with 
unsubscribe sybperl-l
in the body of the message.

 > 
 > > -----Original Message-----
 > > From:	Troy Taylor [SMTP:ttaylor@JCLLC.COM]
 > > Sent:	Thursday, February 10, 2000 8:30 PM
 > > To:	SybPerl Discussion List
 > > Subject:	RE: Trapping Sybase errors...
 > > 
 > > Thanks Jamie....
 > >  
 > > Troy
 > > 
 > > 	-----Original Message-----
 > > 	From: Jamie Belanger [mailto:jamie_belanger@globalcrossing.com]
 > > 	Sent: Thursday, February 10, 2000 7:01 AM
 > > 	To: SybPerl Discussion List
 > > 	Subject: RE: Trapping Sybase errors...
 > > 	
 > > 	
 > > 	As far as I know, just CTlib, but that's the only one I ever use. ;)
 > > 	 
 > > 
 > > 	Jamie Belanger 
 > > 	Sys Admin, Global Crossing 
 > > 	(319) 298-1489 or ext. 489 
 > > 	 
 > > 
 > > 	 
 > > 
 > > 		-----Original Message-----
 > > 		From: Troy Taylor [mailto:ttaylor@JCLLC.COM]
 > > 		Sent: Wednesday, February 09, 2000 5:06 PM
 > > 		To: SybPerl Discussion List
 > > 		Subject: RE: Trapping Sybase errors...
 > > 		
 > > 		
 > > 		Is this just for CTlib or also for DBlib?
 > > 		 
 > > 		Thanks!
 > > 		 
 > > 		Troy
 > > 
 > > 			-----Original Message-----
 > > 			From: Jamie Belanger
 > > [mailto:jamie_belanger@globalcrossing.com]
 > > 			Sent: Wednesday, February 09, 2000 3:47 PM
 > > 			To: SybPerl Discussion List
 > > 			Subject: RE: Trapping Sybase errors...
 > > 			
 > > 			
 > > 
 > > 			You add client and server callbacks... Here's an
 > > example of how to do it: 
 > > 	
 > > ----------------------------------------------------------------- 
 > > 
 > > 			#Place this somewhere at the top of your script 
 > > 			#error handling (stolen from those who came before) 
 > > 			ct_callback(CS_CLIENTMSG_CB, \&msg_cb); 
 > > 			ct_callback(CS_SERVERMSG_CB, "srv_cb"); 
 > > 
 > > 	
 > > ################################################################## 
 > > 			# error handling sub routines (stolen from those who
 > > came before) 
 > > 	
 > > ################################################################## 
 > > 
 > > 			sub msg_cb 
 > > 			{ 
 > > 			        my($layer, $origin, $severity, $number,
 > > $msg, $osmsg) = @_; 
 > > 
 > > 			        printf STDERR "\nOpen Client Message: (In
 > > msg_cb)\n"; 
 > > 			        printf STDERR "Message number: LAYER = (%ld)
 > > ORIGIN = (%ld)", $layer, $origin; 
 > > 			        printf STDERR "SEVERITY = (%ld) NUMBER =
 > > (%ld)\n", $severity, $number; 
 > > 			        printf STDERR "Message String: %s\n", $msg; 
 > > 			        if (defined($osmsg)) 
 > > 			        { 
 > > 			                printf STDERR "Operating System
 > > Error: %s\n", $osmsg; 
 > > 			        } 
 > > 			        CS_SUCCEED; 
 > > 			} 
 > > 
 > > 			sub srv_cb 
 > > 			{ 
 > > 			        my($cmd, $number, $severity, $state, $line,
 > > $server, $proc, $msg) = @_; 
 > > 			        printf STDERR "\nServer message: (In
 > > srv_cb)\n"; 
 > > 			        printf STDERR "Message number: %ld, Severity
 > > %ld, ", $number, $severity; 
 > > 			        printf STDERR "State %ld, Line %ld\n",
 > > $state, $line; 
 > > 			        
 > > 			        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;
 > > CS_SUCCEED; 
 > > 			} 
 > > 
 > > 
 > > 			Jamie Belanger 
 > > 			Sys Admin, Global Crossing 
 > > 			(319) 298-1489 or ext. 489 
 > > 			 
 > > 
 > > 
 > > 
 > > 			-----Original Message----- 
 > > 			From: Fuerte, Hector BGI SF [
 > > ] 
 > > 			Sent: Wednesday, February 09, 2000 4:26 PM 
 > > 			To: SybPerl Discussion List 
 > > 			Subject: Trapping Sybase errors... 
 > > 
 > > 
 > > 			Hi! 
 > > 			  
 > > 			How do you trap this sql error in Perl: 
 > > 			  
 > > 			Msg 2601, Level 14, State 3: 
 > > 			Server 'SA_SBU', Line 1: 
 > > 			Attempt to insert duplicate key row in object
 > > 't_web_xing_stats_hist' with 
 > > 			unique index 'XPKt_web_xing_stats_hist' 
 > > 			Command has been aborted. 
 > > 			(0 rows affected) 
 > > 			  
 > > 			thanks. 
 > > 			Hector 
 > > 			  
 > > 
 > 

-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com