Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Callbacks in Sybase::Simple
Date: Jan 15 2001 4:52PM
> 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
> 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 Peppler - Data Migrations Inc. - email@example.com
http://www.mbay.net/~mpeppler - firstname.lastname@example.org
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: email@example.com