I'm having trouble with Perl scripts that to a select of a date field,
specifically in the enclosed test, a timestamp(6).

Attached are the files requested in the README.

I'm using Red Hat Linux 7.1 and Oracle 9.0.1.  Perl is 5.6.0, DBI is
1.21, DBD-Oracle 1.12.

When I select a timestamp field, I get a segmentation fault.

Note: I set my default date/time formats to something other than normal.
   In addition, I'm using an spfile, and can't change them back:

NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'

Badtime is a sample script.  dead1.txt is the output of that script.
dead2.txt is the output, run against a DBD-Oracle compiled with -g,
complete with the stack trace.  I created an install.txt, as requested, 
(with the output of perl Makefile.PL -V) but couldn't send it as it made 
the message too large.  I did send a perl -v.

It looks like the problem is deep in the bowels of Oracle, which makes
me think my change of the format has something to do with this.

Please help...as the sample script shows, I discovered a workaround
(to_char), but I'd like to help resolve this.  I'd love to help out in
any way.

Kevin

#!/usr/bin/perl

use strict;

use DBI;

our $dbname = 'pllogs';
our $dbuser = 'xxx';
our $dbpass = 'xxx';

our $dbh = DBI->connect("dbi:Oracle:$dbname",
                        $dbuser, $dbpass,
                        { AutoCommit => 0,
                          PrintError => 0})
or die $DBI::errstr;

my ($stat_sth, @data);

print "First test\n";
$stat_sth = $dbh->prepare("select TO_CHAR(ctime, 'YYYY-MM-DD HH24:MI:SS'), tablename ".
                          "from batch.lastexport ")
or die $DBI::errstr;
$stat_sth->execute();
while (@data = $stat_sth->fetchrow())
{
    print $data[0]."\t".$data[1]."\n";
}
$stat_sth->finish();
print "First test done\n";

print "Second test\n";
$stat_sth = $dbh->prepare("select ctime, tablename ".
                          "from batch.lastexport ")
or die $DBI::errstr;
$stat_sth->execute();
while (@data = $stat_sth->fetchrow())
{
    print $data[0]."\t".$data[1]."\n";
}
$stat_sth->finish();
print "Second test done\n";

Script started on Thu Feb 21 21:18:06 2002
]0;kwhite@wakko:~[kwhite@wakko kwhite]$ ./badtime
First test
2002-02-21 00:00:00     pllogs.connection
2002-02-21 00:00:00     pllogs.ipf
First test done
Second test
Segmentation fault
]0;kwhite@wakko:~[kwhite@wakko kwhite]$ 
Script done on Thu Feb 21 21:18:11 2002

Script started on Thu Feb 21 21:19:17 2002
]0;kwhite@wakko:~[kwhite@wakko kwhite]$ ./badtime
First test
2002-02-21 00:00:00     pllogs.connection
2002-02-21 00:00:00     pllogs.ipf
First test done
Second test
Segmentation fault (core dumped)
]0;kwhite@wakko:~[kwhite@wakko kwhite]$  gdb --core=core --exec=/usr/bin/perl
GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux".

warning: core file may not match specified executable file.
Core was generated by `/usr/bin/perl ./badtime'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBI/DBI.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBI/DBI.so
Reading symbols from 
/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/Oracle/Oracle.so...done.
Loaded symbols for /usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBD/Oracle/Oracle.so
Reading symbols from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0...done.
Loaded symbols for /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
Reading symbols from /opt/oracle/product/9.0.1/lib/libwtc9.so...done.
Loaded symbols for /opt/oracle/product/9.0.1/lib/libwtc9.so
Reading symbols from /lib/i686/libpthread.so.0...done.

warning: Unable to set global thread event mask: generic error
[New Thread 1024 (LWP 11613)]
Error while reading shared library symbols:
Cannot enable thread event reporting for Thread 1024 (LWP 11613): generic error
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /lib/libnss_nisplus.so.2...done.
Loaded symbols for /lib/libnss_nisplus.so.2
Reading symbols from /lib/libnss_dns.so.2...done.
Loaded symbols for /lib/libnss_dns.so.2
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
#0  0x408a1d52 in LdiDateFromArray () from 
/opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
(gdb) bt
#0  0x408a1d52 in LdiDateFromArray () from 
/opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#1  0x406441ea in kpcxk2u () from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#2  0x406612c9 in ttccfpg () from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#3  0x406606a6 in ttcfour () from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#4  0x4042f7e1 in kpufCopyPrefRows () from 
/opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#5  0x4043063e in kpufch0 () from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#6  0x4043208b in kpufch () from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#7  0x4039f505 in OCIStmtFetch () from /opt/oracle/product/9.0.1/lib/libclntsh.so.9.0
#8  0x4021d022 in ora_st_fetch (sth=0x8183278, imp_sth=0x81ff0c0) at oci8.c:1074
#9  0x40211ee4 in XS_DBD__Oracle__st_fetchrow_array (cv=0x81e0380) at Oracle.xsi:343
#10 0x40201477 in XS_DBI_dispatch () from 
/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/DBI/DBI.so
#11 0x0809d4bc in ?? () at eval.c:41
#12 0x08097e28 in ?? () at eval.c:41
#13 0x0805bfba in ?? () at eval.c:41
#14 0x0805bd2b in ?? () at eval.c:41
#15 0x08059a21 in ?? () at eval.c:41
#16 0x4007c507 in __libc_start_main (main=0x80599b0, argc=2, ubp_av=0xbffff8f4, 
init=0x8058b80, fini=0x80de810, 
    rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffff8ec) at 
../sysdeps/generic/libc-start.c:129
(gdb) quit
]0;kwhite@wakko:~[kwhite@wakko kwhite]$ 
Script done on Thu Feb 21 21:19:54 2002

Script started on Thu Feb 21 21:39:13 2002
]0;kwhite@wakko:~/build/perl/DBD-Oracle-1.12[kwhite@wakko DBD-Oracle-1.12]$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.6-3.1enterprise, archname=i386-linux
    uname='linux stripples.devel.redhat.com 2.4.6-3.1enterprise #1 smp tue jul 24 
14:03:17 edt 2001 i686 unknown '
    config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc 
-Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dd_dosuid 
-Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm 
-Uuselargefiles'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=undef 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O2 -march=i386 -mcpu=i686', gccversion=2.96 20000731 (Red Hat 
Linux 7.1 2.96-96)
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccflags ='-fno-strict-aliasing -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options:
  Built under linux
  Compiled at Aug  9 2001 22:48:52
  @INC:
    /usr/lib/perl5/5.6.0/i386-linux
    /usr/lib/perl5/5.6.0
    /usr/lib/perl5/site_perl/5.6.0/i386-linux
    /usr/lib/perl5/site_perl/5.6.0
    /usr/lib/perl5/site_perl
    .
]0;kwhite@wakko:~/build/perl/DBD-Oracle-1.12[kwhite@wakko DBD-Oracle-1.12]$ 
Script done on Thu Feb 21 21:39:16 2002

Reply via email to