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: "Hidenori at Khadi Ogawa" <hidenori dot ogawa at toppan dot co dot jp>
Subject: Bad free() in special date handling mode (UseDateTime=1)
Date: Nov 26 1998 8:07AM

Hi All,

Bad free() occurs by a script attached below in Solaris. More
embarrassingly, as using it as CGI in Linux, it occurs httpd's
Segmentation Fault. :(

Sybase::CTlib::DateText may have a problem... I could avoid it
by
regarding 1900/1/1 as null, but it still occurs by other unknown
reason.

If datetime -> string converter returns hour and minute (I could
get
only '99/01/01'), I will comment out the line
'$dbh->{UseDateTime} =
1'. I need hour and minute...

Anyone have a suggestion as what I do?

---- environment
Solaris 2.5 / perl 5.004_04 / sybperl 2.09.5 / apache 1.3.0
Linux RedHat 5.2 / perl 5.004_04 / sybperl 2.10 / apache 1.3.3

# change .+_FOO to your suitable.
---- log
% sqsh -S SERVER_FOO -U USER_FOO -P PASSWORD_FOO -D DB_FOO -i
test.sql
startdate=99/01/01 id=1
startdate= id=2
Died at test.pl line 11.
Bad free() ignored during global destruction.
---- test.pl
#!/usr/local/bin/perl
use Sybase::CTlib;
$dbh = Sybase::CTlib->ct_connect("USER_FOO", "PASSWORD_FOO",
"SERVER_FOO");
$dbh->ct_sql("use DB_FOO");
$dbh->{UseDateTime} = 1;
$dbh->ct_execute("select * from TABLE_FOO");
while (1) {
    $rc = $dbh->ct_results($restype);
    last unless $rc == &CS_SUCCEED;
    next unless $dbh->ct_fetchable($restype);
    while (%r = $dbh->ct_fetch(1)) {
 foreach (keys %r) {
 printf("%s=%s ", $_, $r{$_}); }
 printf("\n");
    }
}
1;
---- test.sql
create table TABLE_FOO (id int, startdate datetime NULL)
go
insert into TABLE_FOO (id,startdate) values (1,"1999-1-1
1:23:34am")
insert into TABLE_FOO (id,startdate) values (2,NULL)
go

--
Hidenori@Khadi Ogawa
mailto:hidenori.ogawa@toppan.co.jp