Hallo there,
I've identified a problem with the DBD-Oracle 1.07 (the same problem occurs
with DBD-Oracle 1.06) and
the Oracle 8.1.6.0.0 client libraries connected to a 8.1.7.0.0 database.

Under Windows 2000, the process crashes with a general exception error
(0xC0000005, access violation)
while processing the prepare method of a instantiated dbi object, when the
processed statement
contains a field in the select list like:

$stmt = "
        select r.id,
                r.Vorzeichenbruttosumme *
                  sum ( decode(r.Abrechnungineuro, 'x',
r.Sonderrabatt1ResultEURO, r.Sonderrabatt1Result)   +
                        decode(r.Abrechnungineuro, 'x',
r.Sonderrabatt2ResultEURO, r.Sonderrabatt2Result)   +
                        decode(r.Abrechnungineuro, 'x',
r.StreckenrabattResultEURO, r.StreckenrabattResult) +
                        decode(r.Abrechnungineuro, 'x',
r.MengenrabattResultEURO, r.MengenrabattResult)     +
                        decode(r.Abrechnungineuro, 'x',
r.RegionalrabattResultEURO, r.RegionalrabattResult) +
                        decode(r.Abrechnungineuro, 'x',
r.ProduktionsrabattResultEURO, r.ProduktionsrabattResult) )
        from    Rechnung r
        where   r.id = 1
    group by r.ID,               r.Vorzeichenbruttosumme
";

The problem seems to lie in the call of:

OCIAttrGet_parmdp(imp_sth, fbh->parmdp, &fbh->name,   &atrlen,
OCI_ATTR_NAME,status);

(oci8.c line 842)

For the second field in the statement, OCIAttrGet_parmdp returns a 0 in
status, a 0 in attlen and a
string of "(null)" in fbh->name.
Subsequent calls to:

        fbh->name_sv = newSVpv(fbh->name,atrlen);
        fbh->name    = SvPVX(fbh->name_sv);

cause the error.

WORKAROUND:
I changed the oci8.c file as follows:

843,857c843,844
<
<     if(atrlen != 0)
<     {
<               fbh->name_sv = newSVpv(fbh->name,atrlen);
<     }
<     else
<     {
<         char tmp[16];
<
<         sprintf(tmp,"FIELD%d",i);
<         atrlen = strlen(tmp);
<         fbh->name_sv = newSVpv(tmp,atrlen);
<
<     }
<       fbh->name    = SvPVX(fbh->name_sv);
---
>       fbh->name_sv = newSVpv(fbh->name,atrlen);
>       fbh->name    = SvPVX(fbh->name_sv);

I can't remember any constraints to the field names of such a simple select
statement,
I've used this statement in many older versions of oraperl/perl, therefore
I'm wondering
how the oci-libaries have changed their behavior. The workaround is not very
smart, if someone
is using field aliases like "FIELD2", then this may create unpredicted
results.

In the enclosed file version.txt you may find my perl-configuration details.

In the enclosed file t2.pl you may find a sample code I've used to reproduce
the error.

Best regards,

Martin Busik

P.S. Please remove the
http://www.wmd.de/wmd/staff/pauck/misc/oracle_on_linux.html link from the
DBD-Oracle-1.07 README file. wmd does not exist any more.


--
moving objects GmbH
Lottestr. 55
D-22529 Hamburg
fon: +49 40 / 57 205 - 220
fax: +49 40 / 57 205 - 100
email: [EMAIL PROTECTED]
----------------------------- PERL ----------------------------------------
Summary of my perl5 (revision 5 version 6 subversion 1) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Od -MD -Zi -DDEBUGGING -DWIN32 -D_CONSOLE -DNO_STRICT  
 -DPERL_MSVCRT_READFIX',
    optimize='-Od -MD -Zi -DDEBUGGING',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='', ldflags ='-nologo -nodefaultlib -debug -pdb:none  
-libpath:"c:\perl\lib\CORE"  -machine:x86'
    libpth=D:\PROGRA~1\msdev\VC98\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib wsock32.lib 
mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib 
wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -pdb:none  
-libpath:"c:\perl\lib\CORE"  -machine:x86'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING
  Built under MSWin32
  Compiled at Jul  9 2001 11:55:53
  @INC:
    c:/perl/lib
    c:/perl/site/lib
    .

--------------------------------------- part of the Oracle.dll makefile 
-----------------------------------

# They may have been overridden via Makefile.PL or on the command line
AR = lib
CC = cl
CCCDLFLAGS =  
CCDLFLAGS =  
DLEXT = dll
DLSRC = dl_win32.xs
LD = link
LDDLFLAGS = -dll -nologo -nodefaultlib -debug -pdb:none  -libpath:"c:\perl\lib\CORE"  
-machine:x86
LDFLAGS = -nologo -nodefaultlib -debug -pdb:none  -libpath:"c:\perl\lib\CORE"  
-machine:x86
LIBC = msvcrt.lib
LIB_EXT = .lib
OBJ_EXT = .obj
OSNAME = MSWin32
OSVERS = 4.0
RANLIB = rem
SO = dll
EXE_EXT = .exe
FULL_AR = 


# --- MakeMaker constants section:
AR_STATIC_ARGS = cr
NAME = DBD::Oracle
DISTNAME = DBD-Oracle
NAME_SYM = DBD_Oracle
VERSION = 1.07
VERSION_SYM = 1_07
XS_VERSION = 1.07
INST_BIN = blib\bin
INST_EXE = blib\script
INST_LIB = blib\lib
INST_ARCHLIB = blib\arch
INST_SCRIPT = blib\script
PREFIX = c:\perl
INSTALLDIRS = site
INSTALLPRIVLIB = c:\perl\lib
INSTALLARCHLIB = c:\perl\lib
INSTALLSITELIB = c:\perl\site\lib
INSTALLSITEARCH = c:\perl\site\lib
INSTALLBIN = $(PREFIX)\bin
INSTALLSCRIPT = $(PREFIX)\bin
PERL_LIB = c:\perl\lib
PERL_ARCHLIB = c:\perl\lib
SITELIBEXP = c:\perl\site\lib
SITEARCHEXP = c:\perl\site\lib
LIBPERL_A = libperl.lib
FIRST_MAKEFILE = Makefile
MAKE_APERL_FILE = Makefile.aperl
PERLMAINCC = $(CC)
PERL_INC = C:\perl\lib\CORE
PERL = C:\perl\bin\perl.exe
FULLPERL = C:\perl\bin\perl.exe

VERSION_MACRO = VERSION
DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
XS_VERSION_MACRO = XS_VERSION
XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"

MAKEMAKER = 
MM_VERSION = 5.45

# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD)  !!! Deprecated 
from MM 5.32  !!!
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
# DLBASE  = Basename part of dynamic library. May be just equal BASEEXT.
FULLEXT = DBD\Oracle
BASEEXT = Oracle
PARENT_NAME = DBD
DLBASE = $(BASEEXT)
VERSION_FROM = Oracle.pm
INC = -Id:/programme/oracle/oci/include -Id:/programme/oracle/rdbms/demo 
-Ic:/perl/site/lib/auto/DBI
DEFINE = 
OBJECT = $(O_FILES)
LDFROM = $(OBJECT)
LINKTYPE = dynamic
--------------------------------------- EOF oracle.dll makefile 
-------------------------------------

t2.pl

Reply via email to