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: CTlib.pm error
Date: Nov 10 2004 7:07PM

On Wed, 2004-11-10 at 19:50, Sabherwal, Balvinder (MBS) wrote:
> Thanks Michael, This helps to identify the problem. One thing more I'd like
> to know is how to print these messages to the output file?
> 
> Will something like this work where FH is the file handle?
> 
> ct_callback(CS_SERVERMSG_CB, sub { print FH "@_\n"; });
> ct_callback(CS_CLIENTMSG_CB, sub { print FH "@_\n"; });

Yes.

Note that this prints everything, and is just a quick-n-dirty shorthand
useful when debugging.

Michael


> -----Original Message-----
> From: Michael Peppler [mailto:mpeppler@peppler.org] 
> Sent: Wednesday, November 10, 2004 11:59 AM
> To: Sabherwal, Balvinder (MBS)
> Cc: 'sybperl-l@peppler.org'
> Subject: RE: CTlib.pm error
> 
> On Wed, 2004-11-10 at 17:50, Sabherwal, Balvinder (MBS) wrote:
> > I do have ct_callback() in the script if that is what you are referring to
> > ad-hoc error handler and it's printing the error messages returned by
> srv_cb
> > and msg_cb. The script dies just before the error check which is the line
> > ct_sql(). It's not going pass this line so I can't print the error
> messages
> > in the script.
> 
> Try rewriting that section to do the following:
> 
> my $dbdata;
> ct_callback(CS_SERVERMSG_CB, sub { print "@_\n"; });
> ct_callback(CS_CLIENTMSG_CB, sub { print "@_\n"; });
> $dbhS->ct_execute($execsql);
> while($dbhS->ct_results($restype) == CS_SUCCEED) {
>     next unless($dbhS->ct_fetchable($restype));
>     while(@data = $dbhS->ct_fetch) {
>         push(@$dbdata, [@data]);
>     }
> }
> 
> this code *should* produce the same results as your ct_sql() call, and
> it should be easier to figure out where it is dying.
> 
> Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                       http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.peppler.org/resume.html