On Wed, Jan 28, 2004 at 04:09:16PM +0000, Tim Bunce wrote:
> After 10 months of, er, stability, I'm very happy to release a new
> version of DBD::Oracle. This one should build more happily on more
> systems with more recent versions of Oracle.

The following patch is needed to make DBD::Oracle 1.15 run
with NLS_LANG=AMERICAN_AMERICA.UTF8 on database with character set
EE8ISO8859P2. It's inspired by Frank Adler's post

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&inlang=pl&selm=f3eafca5.0201300213.19e3914f%40posting.google.com

any by observing that other pieces of oci8.c multiply by 10, instead
of Frank's value of 2:

--- oci8.c.orig 2004-01-10 01:00:34.000000000 +0100
+++ oci8.c      2004-01-29 12:24:11.000000000 +0100
@@ -1067,7 +1067,7 @@
                avg_width = fbh->dbsize / 2;
                /* FALLTHRU */
        case  96:                               /* CHAR         */
-               fbh->disize = fbh->dbsize;
+               fbh->disize = fbh->dbsize * 10;
                fbh->prec   = fbh->disize;
                break;
        case  23:                               /* RAW          */


Without this patch, some of my selects fail with

ORA-24345: A Truncation or null fetch error occurred (DBD ERROR: ORA-01406 error on 
field 1 of 24, ora_type 1)

I believe that with more traditional setup with UTF-8 both database
and client charset the conversion doesn't take place and selects go
as expected.

My database is of version 8.0.5 and I tested with client libraries
from 9.2.0.0.0, perl 5.8.1. The DBD::Oracle was compiled with
-DUTF8_SUPPORT, the -D got there by default. The compile was clean.
It failed some tests in t/long.t but I believe we do not care about
those as the version of Oracle is too old and would probably use
a couple of Oracle patches in the first place (those I cannot apply
as the server is not under my (complete) control).

I'm adding output of $dbh->trace (column names were edited as I'm
not sure now sensitive the knowledge in the database schema is :-)
and perl -V. If a log of make / make test is needed, I can attach
it as well.



    DBI::db=HASH(0x81c5284) trace level set to 2 in DBI 1.39-ithread (pid 13661)    -> 
selectall_arrayref for DBD::Oracle::db (DBI::db=HASH(0x81c4ad4)~0x81c5284 '
        select * from ccap.ccap_fak_load
        ') thr#804bd58
1   -> prepare for DBD::Oracle::db (DBI::db=HASH(0x81c5284)~INNER '
        select * from ccap.ccap_fak_load
        ' undef) thr#804bd58
    fbh 1: 'F1'    NO null , otype   2->  5, dbsize 22/134, p0.s0
    fbh 2: 'F2'  NULLable, otype   2->  5, dbsize 22/134, p0.s0
    fbh 3: 'F3' NO null , otype   1->  5, dbsize 2/3, p2.s0
    fbh 4: 'F4'        NULLable, otype   2->  5, dbsize 22/134, p0.s0
    fbh 5: 'F5'   NO null , otype   2->  5, dbsize 22/134, p4.s0
    fbh 6: 'F6'  NULLable, otype   2->  5, dbsize 22/134, p0.s0
    fbh 7: 'F7' NO null , otype   1->  5, dbsize 2/3, p2.s0
    fbh 8: 'F8'        NULLable, otype   2->  5, dbsize 22/134, p0.s0
    fbh 9: 'F9'   NO null , otype   2->  5, dbsize 22/134, p4.s0
    fbh 10: 'F10'   NULLable, otype   1->  5, dbsize 20/21, p20.s0
    fbh 11: 'F11'  NO null , otype  12->  5, dbsize 7/76, p75.s0
    fbh 12: 'F12'  NO null , otype  12->  5, dbsize 7/76, p75.s0
    fbh 13: 'F13' NULLable, otype  12->  5, dbsize 7/76, p75.s0
    fbh 14: 'F14'      NO null , otype   1->  5, dbsize 3/4, p3.s0
    fbh 15: 'F15'    NO null , otype   1->  5, dbsize 20/21, p20.s0
    fbh 16: 'F16'     NULLable, otype   1->  5, dbsize 255/256, p255.s0
    fbh 17: 'F17'     NULLable, otype   1->  5, dbsize 255/256, p255.s0
    fbh 18: 'F18'      NULLable, otype   1->  5, dbsize 20/21, p20.s0
    fbh 19: 'F19'       NULLable, otype   1->  5, dbsize 6/7, p6.s0
    fbh 20: 'F20'  NO null , otype   1->  5, dbsize 1/2, p1.s0
    fbh 21: 'F21'      NO null , otype   1->  5, dbsize 1/2, p1.s0
    fbh 22: 'F22'   NULLable, otype   1->  5, dbsize 2000/2001, p2000.s0
    fbh 23: 'F23'     NULLable, otype   2->  5, dbsize 22/134, p0.s0
    fbh 24: 'F24'     NULLable, otype   2->  5, dbsize 22/134, p0.s0
    fbh 25: 'F25'  NULLable, otype   1->  5, dbsize 255/256, p255.s0
1   <- prepare= DBI::st=HASH(0x81c5380) at oracle_utf8_select line 14
    dbd_st_execute SELECT (out0, lob0)...
    dbd_st_execute SELECT returned (SUCCESS, rpc0, fn4, out0)
    !! ERROR: 24345 'ORA-24345: A Truncation or null fetch error occurred (DBD ERROR: 
ORA-01406 error on field 15 of 25, ora_type 1)'
    <- selectall_arrayref= [ ARRAY(0x8211c34) ] at oracle_utf8_select line 14
1   -> FETCH for DBD::Oracle::db (DBI::db=HASH(0x81c5284)~INNER 'ParamValues') 
thr#804bd58
       error: 24345 'ORA-24345: A Truncation or null fetch error occurred (DBD ERROR: 
ORA-01406 error on field 15 of 25, ora_type 1)'
1   <- FETCH= undef at oracle_utf8_select line 14
DBD::Oracle::db selectall_arrayref failed: ORA-24345: A Truncation or null fetch error 
occurred (DBD ERROR: ORA-01406 error on field 15 of 25, ora_type 1) [for
Statement "
        select * from ccap.ccap_fak_load
        "] at ./oracle_utf8_select line 14.
DBD::Oracle::db selectall_arrayref failed: ORA-24345: A Truncation or null fetch error 
occurred (DBD ERROR: ORA-01406 error on field 15 of 25, ora_type 1) [for
Statement "
        select * from ccap.ccap_fak_load
        "] at ./oracle_utf8_select line 14.
    -> DESTROY for DBD::Oracle::st (DBI::st=HASH(0x81c53f8)~INNER) thr#804bd58
       error: 24345 'ORA-24345: A Truncation or null fetch error occurred (DBD ERROR: 
ORA-01406 error on field 15 of 25, ora_type 1)'
    <- DESTROY= undef
    -> DESTROY for DBD::Oracle::db (DBI::db=HASH(0x81c5284)~INNER) thr#804bd58
Issuing rollback() for database handle being DESTROY'd without explicit disconnect().
       error: 24345 'ORA-24345: A Truncation or null fetch error occurred (DBD ERROR: 
ORA-01406 error on field 15 of 25, ora_type 1)'
    <- DESTROY= undef


# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.4.21-2.elsmp, archname=i386-linux-thread-multi
    uname='linux daffy.perf.redhat.com 2.4.21-2.elsmp #1 smp wed sep 17 15:00:55 edt 
2003 i686 i686 i386 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dversion=5.8.1 
-Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. 
-Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr 
-Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.1 -Duseshrplib -Dusethreads 
-Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm 
-Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 
-Uversiononly -Dinc_version_list=5.8.0/i386-linux-thread-multi 5.8.0 
-Dpager=/usr/bin/less -isr'
    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=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
    optimize='-O2 -g -pipe -march=i386 -mcpu=i686',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='3.3.1 20030930 (Red Hat Linux 3.3.1-6)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    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, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/usr/lib/perl5/5.8.1/i386-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
 
 
Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Oct 15 2003 10:52:47
  @INC:
    /usr/lib/perl5/5.8.1/i386-linux-thread-multi
    /usr/lib/perl5/5.8.1
    /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.1
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.1
    /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.0
    /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.8.1/i386-linux-thread-multi
    /usr/lib/perl5/5.8.1
    .


-- 
------------------------------------------------------------------------
 Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
 .project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
                Only self-confident people can be simple.

Reply via email to