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: "Ruth Geever" <geever at nortelnetworks dot com>
Subject: CTLib Callback Msg; can this access the SQL statement being execu ted
Date: May 17 1999 8:50AM

Hello,

I'm using Sybperl with Sybase Open Client 11.1.1;
When an error occurs, I want to display the SQL statement that caused the
error. However, I cannot access the SQL statement that caused the error in
the callback subroutine.

Here's the code:

use Sybase::CTlib;

# Connect to database
$dbhandle = new Sybase::CTlib $userid, $userpwd, $dss, $dsn;

# Set message callback
ct_callback(CS_CLIENTMSG_CB, \&msgCB);
ct_callback(CS_SERVERMSG_CB, \&msgCB);

# Execute SQL statement
my $sqlString = "Select * from customer";
my $status = $dbhandle->ct_execute($sqlString);
print "ERROR: Cannot execute SQL statement(status): $sqlString" if ($status
== CS_FAIL || $status == CS_CANCELED);


sub msgCB
{
	my $ctlib = shift;
	my ($number, $severity, $origin, $layer, $something, $somethingelse,
$msg, $osmsg) = @_;

	my $q = new CGI;
	print $q->header(),
		$q->start_html(),
		$q->h1('Sybase Error'),
		'',
		'',
		'',
		'';
	print ''
if defined($osmsg);
	print	'
Open Client Message:
Message Number:LAYER = ',$layer,' ORIGIN = ',$origin,'
SEVERITY = ',$severity,' NUMBER = ',$number,'
Message String:',$msg,'
Operating System Error:',$osmsg,'
'; $q->end_html(); exit; return CS_SUCCEED; } Thanks in advance. Regards, Ruth