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: Callbacks in Sybase::Simple
Date: Jan 15 2001 4:52PM writes:
 > I have a problem which I hope someone out there can help me with. I have 
 > extended the Sybase::Simple class and provided a new one for my 
 > application called DBConnection as per code below:-

 > If I run the following code:-
 > {
 >   my $dbh = DBConnection->new ($user, $passwd, $server);
 >   $dbh->ExecSql("use mydatabase");
 >   $dbh->ExecSql("some sql that causes an insert of a duplicate row into a 
 > table");
 > }
 > I get the following results:
 > printCallback: 5701 Changed database context to 'mydatabase'.
 > Can't locate auto/Sybase/CTlib/ in @INC (@INC 

The problem is that the $dbh that is passed to the callback function
is blessed into the Sybase::CTlib class, rather than the "real" class
of the dbh object. This happens because a new CS_COMMAND struct is
created if "extended error" information is available, so that you can
fetch this information from within the server message callback.

This is a bug. The CTlib.xs ct_connect() call needs to "remember" the
"package" parameter in the ConInfo variable, and then use this same
value when it creates a temporary variable to pass as the first param
to the servermsg_cb() perl callback.

The fix should be fairly simple, I think.

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