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 MBAY dot NET>
Subject: Re: ct_sql and v2.08
Date: Dec 3 1997 12:20AM

Ronald Page wrote:
> In the "CHANGES" file for Sybperl v2.08 (I'm running Perl 5.004_001), I
> notice:
> "Fixed Sybase::CTlib::ct_sql() to set $dbh->{RC} to CS_FAIL when an
> error occurs in the processing."
> I installed 2.08 and it seems to be working as before.  I get a return
> code of -205 for everything.  Specifically, I am doing an INSERT, and
> want to check the return code for failure.  Here is an example:
>       $ref = $dbh->ct_sql("insert into TEST (test) values (1)");
>       print "$dbh->{'RC'} \n";
> In stepping through, I notice the $rc is set correctly until
> the final line of output is read by:
>     while(($rc = $db->ct_results($res_type)) == &CS_SUCCEED) {
> Inserts that succeed get set the same rc as ones that don't (I haven't
> tested return codes on Selects).  What am I doing wrong?  TIA.

Actually they don't.

If ct_results() returns a result type of CS_CMD_FAIL then a flag
is set in ct_sql() which forces  RC to be CS_FAIL.

What does the SQL look like that fails?

Michael Peppler       -||-  Data Migrations Inc.  -||-