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: Louis Proyect <lnp3 at columbia dot edu>
Subject: Basic ct_lib stuff
Date: Oct 6 1999 8:18PM

Speaking as somebody who has been weaned from the old-style &sql syntax
into db_lib and now ct_lib, it might be helpful if I supplied what I am
using for basic ct_sql and error-handling. I find that the message_handler
works fine for errors, if you test for a condition code > 10. It appears
that anything to 10 is an error-free call.

=========

use Sybase::CTlib;
 
ct_callback(CS_SERVERMSG_CB, "srv_cb");
 
@res = $dbh->ct_sql("select Extract_Date_Time from SL_DETAIL_DOLLAR");
$last_master_file_update = @res[0];
print "Date of last master file update is @$last_master_file_update\n";
 
sub srv_cb {
             my($dbh, $number, $severity, $state, $line, $server,
                $proc, $msg) = @_;
             if ($severity > 10)
                 {print "ERROR OCCURRED: \n";
                  print "@_\n";}
             CS_SUCCEED;
         }