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: partridge at boston dot com (Kyle Partridge)
Subject: Re: Problem running program written under CTlib
Date: Sep 30 1997 4:50PM

Michael Peppler wrote:

> You must be calling ct_results once too many.
>
> What does your code look like?
>

Here is the test program I have been trying to debug:

#!/usr/local/bin/perl -w

use lib "/usr/local/sybase/lib";
use lib "/usr/local/sybase/devlib";
use lib "/usr/local/sybase/include";
use lib "/home/sybase/sybperl-2.07/CTlib";
use lib "/tech/bgeplib";

use strict;

use Sybase::CTlib;

my $handle = Sybase::CTlib->ct_connect('user', 'password', 'SQL1');

my $sql_statement = "insert into utility..inventory
values (14, 'Latest and Greatest Thing', 3, 14.95)";

my $ret_proc = "text";
my $rval = undef;
my $results_type = undef;
my $ret_val = undef;
my $type = "insert";
if (!($sql_statement =~ /^[Ii]nsert/))
    {
          print "This is not an insert statement.\n";
     }

$ret_val = $handle->ct_sql("$sql_statement");

while (($rval = $handle->ct_results($results_type)) == CS_SUCCEED)
{
     RES_TYPE:
      {
            if ($results_type == CS_CMD_SUCCEED)
            {
                   $_ = $ret_proc;
                   if ("text")
                   {
                            print STDOUT "$type successful.\n";
                   }
                   elsif ("html")
                   {
                            print "\n";
                   }

                   my $row_count = $handle->ct_res_info(CS_ROW_COUNT);
                   if ("text")
                   {
                            print STDOUT "$row_count row(s)
affected.\n";
                     }
                            elsif ("html")
                   {
                    print "\n";
                     }
                     last RES_TYPE;
             }
             if ($results_type == CS_CMD_FAIL)
            {
                      if ("text")
                      {
                            print STDOUT "$type command failed.\n";
                       }
                       elsif ("html")
                       {
                            print "\n";
                       }
                       last RES_TYPE;
              }
              if ($results_type == CS_CMD_DONE)
              {
                       last RES_TYPE;
              }
        }
}
exit 0;
---------------------------------------------------------
B. Kyle Partridge  Programmer  http://www.boston.com
Boston Globe Electronic Publishing
699 Boylston Street, 4th Floor
Boston, MA    (617) 929-7174 (no voicemail)
partridge@boston.com
---------------------------------------------------------
The ideas, thoughts, values and feelings themselves
cannot be separated from the manner in which they
are conveyed.