Using DBI-1.20 and DBD:Oracle-1.12. No install problems with either of these modules. Using perl-5.6. Output of 'perl -V' attached at end of message.
I tried building with 'perl Makefile.PL -p' but that caused errors in 'make test' in the longs section. 'perl Makefile.PL -nob' did not alter the segfault problem in any way. Output of 'perl Makefile.PL -v' is available from http://modernnoise.com/~graeme/makefile.txt I won't append that here ;) Output of 'maketest' is available from http://modernnoise.com/~graeme/maketest.txt. Could all this be related to the libclntsh.so issue in README.help? I'm attempting to use a CURSOR expression inside a SELECT statement. I know it works because I've tried it both from sqlplus and via PHP. Lets say we have a user and a duty table: create table family (id number, name varchar2(32)); create table duties (id number, user_id number, duty varchar2(32)); and we preload some data: insert into family values (1, 'thies'); insert into duties values (1, 1, 'cook'); insert into duties values (1, 1, 'make tea'); insert into duties values (1, 1, 'fix the code'); insert into family values (2, 'antje'); insert into duties values (1, 2, 'change dipers'); insert into duties values (1, 2, 'bring kid to school'); we can now say (in sqlplus): select id,name,CURSOR(select duty from duties where duties.user_id = family.id) as duties from family; I've attached all required output below. The perl script to make this happen looks like. The script dies at $sth->fetchrow_array --- snip! --- #!/usr/bin/perl use strict; use Getopt::Std; use DBI; $ENV{ORACLE_HOME} = "/home/oracle/product/816"; my $DB_SID = "ORCL"; my $DB_USER = "dev"; my $DB_PASS = "dev"; my $debug = 1; my ($dbh, $sql, $sth); print STDERR ('CONNECT ',$DB_USER,'/',$DB_PASS,'@',$DB_SID,"\n") if $debug; $dbh = DBI->connect( "dbi:Oracle:$DB_SID", $DB_USER, $DB_PASS ) or die( "Trouble in databaseland\n" ); $dbh->{RaiseError} = 1; $sql = "select id,name,CURSOR(select duty from duties where duties.user_id = family.id) as duties from family"; print STDERR "$sql\n" if $debug; $sth = $dbh->prepare("$sql"); $sth->execute() or die ("fuffed at line __line__"); while ( my @row = $sth->fetchrow_array ) { my ($name, $duties) = @row; print "$name\n"; } $sth->finish(); $dbh->disconnect(); --- snip! --- Finally(!) here's the backtrace from the core file: -- snip! -- Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libnsl.so.1...done. Reading symbols from /lib/libdb.so.3...done. Reading symbols from /usr/lib/libgdbm.so.2...done. Reading symbols from /lib/libdl.so.2...done. Reading symbols from /lib/libm.so.6...done. Reading symbols from /lib/libc.so.6...done. Reading symbols from /lib/libcrypt.so.1...done. Reading symbols from /lib/ld-linux.so.2...done. Reading symbols from /usr/lib/gconv/ISO8859-1.so...done. Reading symbols from /usr/local/lib/perl5/site_perl/5.6.0/i686-linux/auto/DBI/DBI.so...done. Reading symbols from /usr/local/lib/perl5/site_perl/5.6.0/i686-linux/auto/DBD/Oracle/Oracle.so...done. Reading symbols from /home/oracle/product/816/lib/libclntsh.so.8.0...done. Reading symbols from /home/oracle/product/816/lib/libwtc8.so...done. Reading symbols from /lib/libpthread.so.0...done. Reading symbols from /lib/libnss_files.so.2...done. #0 0x403c52e5 in kpudc2r () from /home/oracle/product/816/lib/libclntsh.so.8.0 (gdb) bt #0 0x403c52e5 in kpudc2r () from /home/oracle/product/816/lib/libclntsh.so.8.0 #1 0x4051d15e in kpcxk2u () from /home/oracle/product/816/lib/libclntsh.so.8.0 #2 0x40531f50 in ttccfpg () from /home/oracle/product/816/lib/libclntsh.so.8.0 #3 0x40531696 in ttcfour () from /home/oracle/product/816/lib/libclntsh.so.8.0 #4 0x403c7fdc in kpufCopyPrefRows () from /home/oracle/product/816/lib/libclntsh.so.8.0 #5 0x403c8289 in kpufch0 () from /home/oracle/product/816/lib/libclntsh.so.8.0 #6 0x403c9243 in kpufch () from /home/oracle/product/816/lib/libclntsh.so.8.0 #7 0x4037b415 in OCIStmtFetch () from /home/oracle/product/816/lib/libclntsh.so.8.0 #8 0x401f1bec in ora_st_fetch () from /usr/local/lib/perl5/site_perl/5.6.0/i686-linux/auto/DBD/Oracle/Oracle.so #9 0x401e9a29 in XS_DBD__Oracle__st_fetchrow_array () from /usr/local/lib/perl5/site_perl/5.6.0/i686-linux/auto/DBD/Oracle/Oracle.so #10 0x401db5c7 in XS_DBI_dispatch () from /usr/local/lib/perl5/site_perl/5.6.0/i686-linux/auto/DBI/DBI.so #11 0x8096305 in Perl_pp_entersub () #12 0x809139d in Perl_runops_standard () #13 0x805bbd0 in S_run_body () #14 0x805b97b in perl_run () #15 0x80598a1 in main () #16 0x400ab9cb in __libc_start_main (main=0x8059840 <main>, argc=3, argv=0xbffffad4, init=0x8058aa4 <_init>, fini=0x80d16ac <_fini>, rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffacc) at ../sysdeps/generic/libc-start.c:92 -- snip! -- $ perl -V Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=linux, osvers=2.2.14-5.0, archname=i686-linux uname='linux ratbox 2.2.14-5.0 #1 tue mar 7 21:07:39 est 2000 i686 unknown ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) cppflags='-fno-strict-aliasing -I/usr/local/include' ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' 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=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt libc=/lib/libc-2.1.3.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: USE_LARGE_FILES Built under linux Compiled at Nov 13 2000 11:36:16 @INC: /usr/local/lib/perl5/5.6.0/i686-linux /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl Cheers, Graeme
