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: "Mark A dot Downing" <mdowning at rdatasys dot com>
Subject: Re: Examples
Date: Oct 28 1998 6:51PM

At 04:33 PM 10/27/98 -0600, you wrote:
>Do you have any examples using Apache::Sybase::CTLIB?
>
>Or can you point me to a URL that can be of assistance in using Perl and
>Sybase?

###!/usr/local/bin/perl <- commented out due to the use of mod-perl
 
use strict;
use Apache::Sybase::CTlib;
use Sybase::CTlib;

print "Content-type: text/html\n\n";

my $uid = 'user';
my $pwd = 'password';
my $srv = 'server';
my $db = 'database';
my $X = Apache::Sybase::CTlib->connect($uid, $pwd, $srv, $db);
my $sql = "select count(*) from table";

my $restype;
my $rcount;
my @dat;

$X->ct_execute($sql);
while($X->ct_results($restype) == CS_SUCCEED) {
           next if($restype == CS_CMD_DONE ||
                        $restype == CS_CMD_FAIL ||
                        $restype == CS_CMD_SUCCEED);
          while(@dat = $X->ct_fetch) {
          $rcount = $dat[0]; }
}

print "There are $rcount rows in table\n";
exit;


This is not pretty, but it works.
See also, http://www.mbay.net/~mpeppler/  for more sybperl info.

--Mark




----- 
Mark A. Downing                       Relational Data Systems
Phone:(714)263-3899 x157         30 Executive Park, Suite 260 
Reply to: mdowning@rdatasys.com              Irvine, CA 92714
http://www.rdatasys.com/