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: Jie Gao <J dot Gao at isu dot usyd dot edu dot au>
Subject: ct_sql error checking
Date: Jul 25 1999 8:58AM

Hi All,

I have been trying to get error checking for ct_sql work, but I am
lost:

I'm using an insert statement, like:

    $statem = "INSERT into afm.em (em_id, phone, email) VALUES ('john', '15655', 'johne@xxx.xxx.xx')";
    $ret = $dbh->ct_sql($statem);

What I use to check whether the transaction is successful, is the
following (what I understand it to be from reading the Sybase::CTlib
manual:

    $row_count = $dbh->{'ROW_COUNT'};
    $rc = $dbh->{'RC'};

    print STDERR "rowcount = \"$row_count\"\n";
    print STDERR "rc = \"$rc\"\n";

    $dbh->ct_sql('commit');

    $row_count = $dbh->{'ROW_COUNT'};
    $rc = $dbh->{'RC'};

    print STDERR "rowcount commit = \"$row_count\"\n";
    print STDERR "rc commit = \"$rc\"\n";


Now, when it is successful, I get:

    rowcount = "-1"
    rc = "-205"
    rowcount commit = "-1"
    rc commit = "-205"


when it's not, it's:

    rowcount = "-1"
    rc = "0"
    rowcount commit = "-1"
    rc commit = "-205"

Can anyone explain this to me? Or what I have done wrong here?


Thanks,


Jie