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: Callbacks in Sybase::Simple
Date: Jan 15 2001 4:52PM

Andrew.Crossland@citicorp.com 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/printCallback.al 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
-- 
Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
http://www.mbay.net/~mpeppler - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com