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: @@error
Date: Jun 18 2004 2:38PM

On Fri, 2004-06-18 at 16:24, Huber, Robert J (Force 3) wrote:
> Thanks for the helpful response!
> 
> This however takes me to my next problem: the "argument list" for the server
> call back module. When I print out the value of each argument the $srv
> argument (see below) is not set to the server the database handle, $dbh, was
> setup to connect to. The value of $srv is a valid server name in our system.
> I printed out the entire environment hash (%ENV) and nowhere can this value
> be found.

Hmmm - do you have an actual example?

In general the $srv name will come from the server, based on the server
name that has been assigned (with sp_addserver, for example):

#!/usr/bin/perl

use Sybase::CTlib;

sub srv_cb {  
  my ($dbh, $errno, $sev, $state, $line, $srv, $proc, $msg) = @_;

  print "srv = $srv\n";

  return CS_SUCCESS;
}


ct_callback(CS_SERVERMSG_CB, \&srv_cb);

my $dbh = new Sybase::CTlib 'sa', '', 'test';

__END__

prints "srv = troll".

Why?

Because the entry for "test" in the local interfaces file points to the
server called "troll":

[22] test.master.1> select @@servername;
                                
 ------------------------------
 troll
 
(1 row affected)

Does this clear things up a bit?

Michael


> -----Original Message-----
> From: owner-sybperl-l@peppler.org [mailto:owner-sybperl-l@peppler.org]On
> Behalf Of Michael Peppler
> Sent: Thursday, June 17, 2004 1:23 PM
> To: SYBPERL-L mailing list (E-mail)
> Subject: RE: @@error
> 
> =========snip
> 
> sub srv_cb {
>   my ($dbh, $errno, $sev, $state, $line, $srv, $proc, $msg) = @_;
> 
> =========snip
-- 
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