|
|
sybperl-l Archive
Up Prev Next
From: r huber <rhuber135 at yahoo dot com>
Subject: Very Odd Problem
Date: Mar 29 2004 6:58PM
The following code appears to work as expected:
1 #!/usr/local/bin/perl
2
3 # Subroutines
4
5 #
6 sub msg_cb {
7 my($layer, $orgin, $severity, $number,
$msg, $omsg, $dbh) = @_;
8
9 print "msg_cb \@_ ==>$layer, $orgin,
$severity, $number, $msg, $omsg, $dbh<==\n";
10
11 print "===> sub msg_cb called\n";
12 }
13 #
14 sub srv_cb{
15 my($dbh, $number, $severity, $state,
$line, $server, $proc, $msg) = @_;
16
17 print "srv_cb \@_ ==>$dbh, $number,
$severity, $state, $line, $server, $proc, $msg<==\n";
18
19 if( $number != 5701 ){
20 print "hello world\n";
21 printf "error message is 0x%x\n",
$number;
22 }
23 else{
24 print "goodby world\n";
25 printf "error message is 0x%x\n",
$number;
26 }
27 }
28
29 # Main
30
31 use Sybase::CTlib;
32
33 ct_callback(CS_CLIENTMSG_CB, \&msg_cb);
34 ct_callback(CS_SERVERMSG_CB, "srv_cb");
35
36
37 $dbh= Sybase::CTlib->ct_connect( "user",
"passwd", "server" );
38
39 print "\n\$dbh = $dbh\n";
40
41 @dat = $dbh->ct_sql("use database");
42 if($dbh->{'RC'} == CS_FAIL) {
43 die "Can not access database\n";
44 }
If lines 23 thru 26 are commented out the code fails
in that the connect does not return a database handle.
Any ideas as to what is going on.
Thanks,
Robert
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
|