DBD::Sybase segmentation fault

"TOM, ALBERT K \(SBCSI\)" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <2CC47BB54B06014D9112ECF399D1462F0D7854@cafrfd1msgusr02.ITServices.sbc.com>
Hi,
I'm getting a segmentation fault when I use 'set rowcount 50' to
limit the number of rows returned.
If 'set rowcount 50' is removed, then no segmentation fault.
If 'set rowcount 50' in included and a print to stdout is executed
before connecting to Sybase, then no segmentation fault.

Here is my environment
(1) SunOS fstst05 5.10 Generic_118822-25 sun4u sparc SUNW,Sun-Fire-V890
(2) Sun Workshop compiler
    cc: Sun C 5.8 2005/10/13
(3) Perl 5.8.7 using 64 bit addressing.
(4) DBI "VERSION: 1.50"
(5) DBD-Sybase-1.07_01
(6) Sybase open client 12.5

Make Test worked except:
(1) t/exec
    I don't have a database where I can create proc.
    I'm only allowed to select from tables.
(2) t/xblob
    I don't have create table privilege.

The code that causes the segmentation fault follows.
The segmentation fault occurs after the 'end of script' is printed.

Thank you for any help you can provide.
Albert Tom

#!/usr/local/cm58/bin/perl -w
use blib '/appl_dsl/at2191/dbd_syb/DBD-Sybase-1.07_01/blib';
use DBI qw(:sql_types :utils);
sub undent($);
sub sql_err;
# print "to stdout\n";    if write to stdout occurs before connection to
Sybase
#                         there is no segmentation fault & core dump.

$db = 'server=SOCDB01;database=cascview';
$usr = 'dbtool';
$psw = 'xxxx';

$ENV{SYBASE} = '/usr/local/opt/sybase/12.5';
$ENV{SYBASE_OCS} = 'OCS-12_5';

$dbh = DBI->connect("dbi:Sybase:$db",
                     $usr,
                     $psw,
                     { RaiseError => 0,
                       PrintError => 1,
                       AutoCommit => 0
                     }
                   ) ||
           die "Database connection not made: $DBI::errstr";
print "Database Name is $dbh->{Name}\n";

$dbh->do('set rowcount 50') || sql_err(__LINE__);

$sth1 = $dbh->prepare(undent <<'++') || sql_err(__LINE__);
    select *
      from Card
++
$sth1->execute || sql_err(__LINE__);
$ct = 0;
while (my @a = $sth1->fetchrow_array) { 
  print +(join '|', @a[0..5]), "\n";
  $ct++;
} 
$sth1->err and sql_err(__LINE__);
print "rows count [$ct] \n";
$dbh->disconnect;
print "end of script\n";

sub sql_err {
print "sql error\n";
my $msg = shift @_;
print $msg, "\n" if $msg;
print "sqlcode = $DBI::err\n";
print "$DBI::errstr\n";
if ($dbh->rollback) {
   print "RollBack successful\n";
} else {
   print "RollBack failed\n";
}
$dbh->disconnect if $dbh;
exit;
}

sub undent($) {
  (my $text = shift) =~ s/^ {1,8}//mg;
  return $text;
}
__END__
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.