OCILobWriteAppend in 8.1.7.x has various types of brokeness depending on the .x
I've a workaround from Jeff Urlwin for the next release.
Meanwhile you could try the attached patch.

Tim.

On Tue, Mar 02, 2004 at 01:06:46PM -0400, Cook, Adrian wrote:
> Hello,
>  
> I get an undefined reference linker error when I try to build DBD::Oracle 1.15 in 
> the Cygwin 1.5.7-1 environment running on Windows XP Pro. Specifically it is a 
> undefined reference to `_OCILobWriteAppend'. I found one posting on the web that 
> reported this specific problem but there was no suggested solution. I have the full 
> set of Oracle 8.1.7 client tools installed on my machine. I built liboci.a as 
> described in README.wingcc, placed it in /usr/local/lib and tried to rebuild after 
> doing a realclean but this did not help. I also set the ORACLE_HOME env variable 
> explicitly but this also did not help. The requested debugging info follows.
>  
> Thanks,
> Adrian
>  
> Details:
>  
> perl Makefile.PL:
>  
> Using DBI 1.41 (for perl 5.008002 on cygwin-thread-multi-64int) installed in 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI
>  Configuring DBD::Oracle ...
> >>> Remember to actually *READ* the README file!
>     Especially if you have any problems.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 452.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 452.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Use of uninitialized value in subroutine entry at 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/Win32/Registry.pm line 459.
> Using Oracle in D:/oracle/ora81
> WARNING: could not decode oracle version from
> D:/oracle/ora81/orainst/inspdver, or D:/oracle/ora81/install/unix.rgs
> or from ORACLE_HOME path D:/oracle/ora81.
> Oracle version based logic in Makefile.PL may produce erroneous results.
> Found oci directory
> Using OCI directory 'oci'
> Checking for functioning wait.ph
> 
> System: perl5.008002 cygwin_nt-5.0 troubardix 1.5.5(0.9432) 2003-09-20 16:31 i686 
> unknown unknown cygwin 
> Compiler:   gcc -O2 -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing
> Linker:     /usr/bin/ld
> Sysliblist: 
> 
> Warning: If you have problems you may need to rebuild perl with -Uusemymalloc.
> MakeMaker (v6.17)
> Checking if your kit is complete...
> Looks good
>   ABSTRACT_FROM => q[Oracle.pm]
>   AUTHOR => q[Tim Bunce ([EMAIL PROTECTED])]
>   DEFINE => q[ -DUTF8_SUPPORT]
>   DIR => []
>   EXE_FILES => [q[ora_explain]]
>   INC => q[-ID:/oracle/ora81/oci/include -ID:/oracle/ora81/rdbms/demo 
> -I/usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI]
>   LIBS => [q[-L/c/DBD-Oracle-1.15 -loci]]
>   NAME => q[DBD::Oracle]
>   OBJECT => q[$(O_FILES)]
>   PREREQ_PM => { DBI=>q[0] }
>   VERSION_FROM => q[Oracle.pm]
>   clean => { FILES=>q[Oracle.xsi dll.base dll.exp sqlnet.log libOracle.def 
> ora_explain mk.pm] }
>   dist => { DIST_DEFAULT=>q[clean distcheck disttest ci tardist], COMPRESS=>q[gzip 
> -v9], PREOP=>q[$(MAKE) -f Makefile.old distdir], SUFFIX=>q[gz] }
> Using PERL=/usr/bin/perl.exe
> Potential libraries are '-L/c/DBD-Oracle-1.15 -loci':
> '-loci' found at /c/DBD-Oracle-1.15/liboci.a
> LD_RUN_PATH=D:/oracle/ora81/lib:D:/oracle/ora81/rdbms/lib
> Using DBD::Oracle 1.15.
> Using DBD::Oracle 1.15.
> Using DBI 1.41 (for perl 5.008002 on cygwin-thread-multi-64int) installed in 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI
> Writing Makefile for DBD::Oracle
> ***  If you have problems...
>      read all the log printed above, and the README and README.help files.
>      (Of course, you have read README by now anyway, haven't you?)
>  
> make:
>  
> cp Oracle.pm blib/lib/DBD/Oracle.pm
> cp oraperl.ph blib/lib/oraperl.ph
> cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
> cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
> cp Oraperl.pm blib/lib/Oraperl.pm
> cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
> cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
> cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
> /usr/bin/perl.exe -p -e "s/~DRIVER~/Oracle/g" 
> /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI/Driver.xst > 
> Oracle.xsi
> /usr/bin/perl.exe /usr/lib/perl5/5.8.2/ExtUtils/xsubpp  -typemap 
> /usr/lib/perl5/5.8.2/ExtUtils/typemap -typemap typemap  Oracle.xs > Oracle.xsc && mv 
> Oracle.xsc Oracle.c
> gcc -c  -ID:/oracle/ora81/oci/include -ID:/oracle/ora81/rdbms/demo 
> -I/usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI 
> -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSEIMPORTLIB -O2   -DVERSION=\"1.15\" 
> -DXS_VERSION=\"1.15\"  "-I/usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE"  
> -DUTF8_SUPPORT Oracle.c
> gcc -c  -ID:/oracle/ora81/oci/include -ID:/oracle/ora81/rdbms/demo 
> -I/usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI 
> -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSEIMPORTLIB -O2   -DVERSION=\"1.15\" 
> -DXS_VERSION=\"1.15\"  "-I/usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE"  
> -DUTF8_SUPPORT dbdimp.c
> dbdimp.c: In function `ora_db_login6':
> dbdimp.c:307: warning: cast to pointer from integer of different size
> dbdimp.c:317: warning: cast to pointer from integer of different size
> dbdimp.c:321: warning: cast to pointer from integer of different size
> dbdimp.c:325: warning: cast to pointer from integer of different size
> dbdimp.c: In function `dbd_rebind_ph_char':
> dbdimp.c:1145: warning: cast from pointer to integer of different size
> gcc -c  -ID:/oracle/ora81/oci/include -ID:/oracle/ora81/rdbms/demo 
> -I/usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI 
> -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSEIMPORTLIB -O2   -DVERSION=\"1.15\" 
> -DXS_VERSION=\"1.15\"  "-I/usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE"  
> -DUTF8_SUPPORT oci7.c
> gcc -c  -ID:/oracle/ora81/oci/include -ID:/oracle/ora81/rdbms/demo 
> -I/usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int/auto/DBI 
> -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSEIMPORTLIB -O2   -DVERSION=\"1.15\" 
> -DXS_VERSION=\"1.15\"  "-I/usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE"  
> -DUTF8_SUPPORT oci8.c
> Running Mkbootstrap for DBD::Oracle ()
> chmod 644 Oracle.bs
> rm -f blib/arch/auto/DBD/Oracle/Oracle.dll
> LD_RUN_PATH="D:/oracle/ora81/lib:D:/oracle/ora81/rdbms/lib" ld2  -s -L/usr/local/lib 
> Oracle.o dbdimp.o oci7.o oci8.o  -o blib/arch/auto/DBD/Oracle/Oracle.dll  
> /usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE/libperl.dll.a 
> -L/c/DBD-Oracle-1.15 -loci   
> gcc -shared -o  Oracle.dll -Wl,--out-implib=libOracle.dll.a -Wl,--export-all-symbols 
> -Wl,--enable-auto-import -Wl,--stack,8388608 \
> -s -L/usr/local/lib Oracle.o dbdimp.o oci7.o oci8.o  
> /usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE/libperl.dll.a 
> -L/c/DBD-Oracle-1.15 -loci
> Creating library file: libOracle.dll.a
> Oracle.o(.text+0x7a01):Oracle.c: undefined reference to `_OCILobWriteAppend'
> collect2: ld returned 1 exit status
> perlld: *** system() failed to execute
> gcc -shared -o  Oracle.dll -Wl,--out-implib=libOracle.dll.a -Wl,--export-all-symbols 
> -Wl,--enable-auto-import -Wl,--stack,8388608 \
> -s -L/usr/local/lib Oracle.o dbdimp.o oci7.o oci8.o  
> /usr/lib/perl5/5.8.2/cygwin-thread-multi-64int/CORE/libperl.dll.a 
> -L/c/DBD-Oracle-1.15 -loci
> make: *** [blib/arch/auto/DBD/Oracle/Oracle.dll] Error 1
>  
> perl -V:
> 
> Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
>   Platform:
>     osname=cygwin, osvers=1.5.5(0.9432), archname=cygwin-thread-multi-64int
>     uname='cygwin_nt-5.0 troubardix 1.5.5(0.9432) 2003-09-20 16:31 i686 unknown 
> unknown cygwin '
>     config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads -Doptimize=-O2 
> -Dman3ext=3pm'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
>     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=define use64bitall=undef uselongdouble=undef
>     usemymalloc=y, bincompat5005=undef
>   Compiler:
>     cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing',
>     optimize='-O2',
>     cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing'
>     ccversion='', gccversion='3.3.1 (cygming special)', gccosandvers=''
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
>     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
>     ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', 
> lseeksize=8
>     alignbytes=8, prototype=define
>   Linker and Libraries:
>     ld='ld2', ldflags =' -s -L/usr/local/lib'
>     libpth=/usr/local/lib /usr/lib /lib
>     libs=-lgdbm -ldb -lcrypt -lgdbm_compat
>     perllibs=-lcrypt -lgdbm_compat
>     libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
>     gnulibc_version=''
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
>     cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'
> 
> Characteristics of this binary (from libperl): 
>   Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT USE_LARGE_FILES 
> PERL_IMPLICIT_CONTEXT
>   Built under cygwin
>   Compiled at Nov  7 2003 12:06:28
>   %ENV:
>     CYGWIN=""
>   @INC:
>     /usr/lib/perl5/5.8.2/cygwin-thread-multi-64int
>     /usr/lib/perl5/5.8.2
>     /usr/lib/perl5/site_perl/5.8.2/cygwin-thread-multi-64int
>     /usr/lib/perl5/site_perl/5.8.2
>     /usr/lib/perl5/site_perl
> .
>  
> perl Makefile.PL -s _OCILobWriteAppend (last part of output):    
> 
>  
> 
> Searching for symbol '_OCILobWriteAppend' in D:/oracle/ora81 ...
>   searching oracle lib/liboci.a ...
>   searching oracle lib/*.dll ...
> nm: lib/*.dll: No such file or directory
>   searching oracle */lib/*.[ao] ...
> nm: */lib/*.[ao]: No such file or directory
> Search done.
> (Please only include the 'interesting' parts when mailing.)
> 
> 
Author: timbo
Date: Sat Feb 28 06:41:52 2004
New Revision: 169

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/Oracle.xs
Log:
Added alternative implementation for ora_lob_append for Oracle < 9.0
using OCILobGetLength() and OCILobWrite() thanks to Jeff Urlwin.


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes    (original)
+++ dbd-oracle/trunk/Changes    Sat Feb 28 06:41:52 2004
@@ -10,6 +10,8 @@
     $dbh->{ora_ph_csform} = SQLCS_NCHAR;
     $sth->bind_param(..., { ora_csform=>SQLCS_NCHAR });
     this is still a work-in-progress, help welcome.
+  Added alternative implementation for ora_lob_append for Oracle < 9.0
+    using OCILobGetLength() and OCILobWrite() thanks to Jeff Urlwin.
   Added $dbh->{ora_parse_error_offset} docs thanks to Andy Hassall.
   Added $dbh->reauthenticate($user,$pass) docs thanks to Andy Hassall.
   Corrected typo in ora_lob_read() example thanks to Johannes Wierny.

Modified: dbd-oracle/trunk/Oracle.xs
==============================================================================
--- dbd-oracle/trunk/Oracle.xs  (original)
+++ dbd-oracle/trunk/Oracle.xs  Sat Feb 28 06:41:52 2004
@@ -157,26 +157,57 @@
     STRLEN data_len; /* bytes not chars */
     dvoid *bufp;
     sword status;
+    ub4 startp;
     CODE:
     bufp = SvPV(data, data_len);
     amtp = data_len;
     /* if locator is CLOB and data is UTF8 and not in bytes pragma */
     /* if (0 && SvUTF8(data) && !IN_BYTES) { amtp = sv_len_utf8(data); }  */
 #ifdef OCI_V8_SYNTAX
+#ifdef OCI_HTYPE_DIRPATH_FN_CTX /* Oracle is >= 9.0 */
     OCILobWriteAppend_log_stat(imp_dbh->svchp, imp_dbh->errhp, locator,
-           &amtp, bufp, (ub4)data_len, OCI_ONE_PIECE,
-           NULL, NULL,
-           0 /* indicate UTF8? */, SQLCS_IMPLICIT, status);
-#else
-    status = OCI_ERROR;
-#endif
+                              &amtp, bufp, (ub4)data_len, OCI_ONE_PIECE,
+                              NULL, NULL,
+                              0 /* indicate UTF8? */, SQLCS_IMPLICIT, status);
     if (status != OCI_SUCCESS) {
-        oci_error(dbh, imp_dbh->errhp, status, "OCILobWriteAppend");
-       ST(0) = &sv_undef;
+       oci_error(dbh, imp_dbh->errhp, status, "OCILobWriteAppend");
+       ST(0) = &sv_undef;
     }
     else {
-       ST(0) = &sv_yes;
+       ST(0) = &sv_yes;
+    }
+#else
+    OCILobGetLength_log_stat(imp_dbh->svchp, imp_dbh->errhp, locator, &startp, 
status);
+    if (status != OCI_SUCCESS) {
+       oci_error(dbh, imp_dbh->errhp, status, "OCILobGetLength");
+       ST(0) = &sv_undef;
+    } else {
+       /* start one after the end -- the first position in the LOB is 1 */
+       startp++;
+       OCILobWrite_log_stat(imp_dbh->svchp, imp_dbh->errhp, locator,
+                           &amtp, startp,
+                           bufp, (ub4)data_len, OCI_ONE_PIECE,
+                           NULL, NULL,
+                           0 /* indicate UTF8? */, SQLCS_IMPLICIT, status);
+       if (status != OCI_SUCCESS) {
+         oci_error(dbh, imp_dbh->errhp, status, "OCILobWrite");
+         ST(0) = &sv_undef;
+       }
+       else {
+         ST(0) = &sv_yes;
+       }
     }
+#endif
+#else
+    status = OCI_ERROR;
+    /*
+     * make the error indicator a bit more generic, since this point
+     * just knows we don't have OIC_V8_SYNTAX.  May help during debug
+     */
+    oci_error(dbh, imp_dbh->errhp, status, "ora_lob_append");
+    ST(0) = &sv_undef;
+#endif
+
 
 void
 ora_lob_read(dbh, locator, offset, length)

Reply via email to