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 MBAY dot NET>
Subject: Re: Linux and conversion from DBlib to CTlib
Date: Mar 12 1998 1:20AM

Rob Truban wrote:
> 
> I made the following script on a Solaris Box and I now have CTlib up and
> running (I think!) on a Linux Box.  I wanted to know what the equivilent
> CT functions are to get the same functionality.  I'm sending my original
> DBlib version and not my hacked up CT version.


#!/apps/perl/perl5 -w

use strict;
use Sybase::CTlib

use Getopt::Long;

my $dbh = new Sybase::CTlib 'my_id', 'my_passwd', $server;

$dbh->ct_execute("select oidc = oidclass, oidi = oidinst, Circ_name =
name,
domain = domain,
Op_State = operationalState, Admin_State = administrativeState,
AssetDescclass = assetDescNameclass, AssetDescinst = assetDescNameinst,
Container = containerNamesString,
reqCirc = reqCircuitNamename, aEndClass = aEndpointNameclass,
aEndinst = aEndpointNameinst, aBW = aBandwidthValue,
zEndclass = zEndpointNameclass, zEndinst = zEndpointNameinst,
zBW = zBandwidthValue, circMode = circuitMode,
Xmitdirection = transmissionDirection, containType = containmentType,
circGroupclass = circuitGroupNameclass,
circGroupinst = circuitGroupNameinst, parentclass = parentNameclass,
parentname = parentNamename,
parentinst = parentNameinst, capT = capacityTotal,
capA = capacityAvail, capR = capacityReserved
from nmccCircuitMOTable\n");

my $restype = 0;

while($dbh->ct_results($restype) == CS_SUCCEED) {
   next unless $dbh->ct_fetchable($restype);

   my $output = "circuit_table.txt";

   open (OUTPUT, ">>$output")|| die "Could not open file $output :
$!\n";

   my %dat;
   while(%dat = $dbh->ct_fetch(1)) {
      print OUTPUT "$.$dat{oidc}% $dat{oidi}% $dat{Circ_name}%
$dat{domain}%
$dat{Op_State}% $dat{Admin_State}% $dat{AssetDescclass}%
$dat{AssetDescinst}% $dat{Container}% $dat{reqCirc}% $dat{aEndclass}%
$dat{aEndinst}% $dat{aBW}% $dat{zEndclass}% $dat{aEndinst}% $dat{zBW}%
$dat{circMode}% $dat{Xmitdirection}% $dat{containType}%
$dat{circGroupclass}% $dat{circGroupinst}% $dat{parentclass}%
$dat{parentinst}% $dat{parentname}% $dat{capT}% $dat{capA}% $dat{capA}%
$dat{capR} \n";
    }
}



Michael

-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@datamig.com    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com