Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.

Report information
The Basics
Id: 71819
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: Nobody in particular
Requestors: rbo [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.32
Fixed in: 1.47_00



Subject: bind_param_inout swap return values
Hi, DBD::Oracle bind_param_inout swap return values if: - $max_len is greater or equal then 3584 - minimum one bind_param - minimum two bind_param_inout - return value type is number, no matter which column typ See example.pl for more details. Cheers, robert
Subject: example.pl
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use DBI; my $dbh = DBI->connect(); my $table_name = 'bin_param_bug' . time(); $dbh->do(qq{ CREATE TABLE $table_name ( name varchar2(10), col_one varchar2(10), col_two varchar2(10) ) }); $dbh->do(qq{ CREATE OR REPLACE TRIGGER ai_$table_name BEFORE INSERT ON $table_name FOR EACH ROW BEGIN SELECT 1,2 INTO :new.col_one,:new.col_two FROM dual; END; }); my $sth = $dbh->prepare(qq{ INSERT INTO $table_name(name) VALUES (:name) RETURNING col_one, col_two INTO :col_one, :col_two }); $sth->bind_param(":name", 'name'); # $max_len <= 3583 # $max_len >= 3584 $sth->bind_param_inout(":col_one", \my $col_one, 3584); $sth->bind_param_inout(":col_two", \my $col_two, 100); $sth->execute; print "col_one should be 1 but is: $col_one\n"; print "col_two should be 2 but is: $col_two\n"; $dbh->do(qq{DROP TABLE $table_name CASCADE CONSTRAINTS}); __END__ > ./example.pl col_one should be 1 but is: 2 col_two should be 2 but is: 1 Oracle Server Version: PRODUCT VERSION STATUS --------------------------------------- ---------- ---------------- NLSRTL 11.2.0.2.0 Production Oracle Database 11g Enterprise Edition 11.2.0.2.0 64bit Production PL/SQL 11.2.0.2.0 Production TNS for Linux: 11.2.0.2.0 Production 4 rows selected (0.05 seconds) DBD::Oracle: 1.32 Oracle client version: 10204c_i386 Client OS: ProductName: Mac OS X ProductVersion: 10.7.2 BuildVersion: 11C74 Perl Version: Summary of my perl5 (revision 5 version 12 subversion 3) configuration: Platform: osname=darwin, osvers=11.0, archname=darwin-thread-multi-2level uname='darwin fifth.apple.com 11.0 darwin kernel version 11.0.0: sun may 29 13:02:55 pdt 2011; root:xnu-1699.22.44~4release_x86_64 x86_64 ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=llvm-gcc-4.2' hint=recommended, useposix=true, d_sigaction=define 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='llvm-gcc-4.2', ccflags ='-arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include', optimize='-Os', cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='llvm-gcc-4.2 -mmacosx-version-min=10.7', ldflags ='-arch x86_64 -arch i386 -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-arch x86_64 -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Locally applied patches: /Library/Perl/Updates/<version> comes before system perl directories installprivlib and installarchlib points to the Updates directory Built under darwin Compiled at Jun 13 2011 14:45:32 %ENV: PERL5LIB="/Users/rbo/Perl/main-ll/lib/perl5/darwin-thread-multi-2level:/Users/rbo/Perl/main-ll/lib/perl5" PERL_AUTOINSTALL_PREFER_CPAN="1" PERL_LOCAL_LIB_ROOT="/Users/rbo/Perl/main-ll" PERL_MB_OPT="--install_base /Users/rbo/Perl/main-ll" PERL_MM_OPT="INSTALL_BASE=/Users/rbo/Perl/main-ll" @INC: /Users/rbo/Perl/main-ll/lib/perl5/darwin-thread-multi-2level /Users/rbo/Perl/main-ll/lib/perl5/darwin-thread-multi-2level /Users/rbo/Perl/main-ll/lib/perl5 /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3/darwin-thread-multi-2level /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .
On Thu Oct 20 12:46:32 2011, rbo wrote: Show quoted text
> DBD::Oracle bind_param_inout swap return values if: > - $max_len is greater or equal then 3584 > - minimum one bind_param > - minimum two bind_param_inout > - return value type is number, no matter which column typ > > See example.pl for more details.
I can reproduce this, but the max_len limit is exactly 4000 here instead of 3584. DBI 1.616 DBD::Oracle 1.32 Oracle instant client: 10.2.0.4.0 perl: Summary of my perl5 (revision 5 version 14 subversion 0) configuration: Platform: osname=linux, osvers=2.6.38-8-generic, archname=x86_64-linux uname='linux europium 2.6.38-8-generic #42-ubuntu smp mon apr 11 03:31:24 utc 2011 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/danielt/perl5/perlbrew/perls/perl-5.14.0' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.5.2', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/lib/x86_64-linux-gnu /lib64 /usr/lib64 libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.13' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF Built under linux Compiled at May 16 2011 18:13:30 %ENV: PERLBREW_PATH="/home/danielt/perl5/perlbrew/bin:/home/danielt/perl5/perlbrew/perls/perl-5.14.0/bin" PERLBREW_PERL="perl-5.14.0" PERLBREW_ROOT="/home/danielt/perl5/perlbrew" PERLBREW_VERSION="0.20" PERL_CPANM_OPT="--prompt --skip-installed --mirror http://www.chemmedia.de/mirrors/CPAN/" @INC: /home/danielt/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0/x86_64-linux /home/danielt/perl5/perlbrew/perls/perl-5.14.0/lib/site_perl/5.14.0 /home/danielt/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/x86_64-linux /home/danielt/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0 .
It works fine for me: martin@bragi:~/svn/dbd-oracle/trunk$ perl rt71819.pl col_one should be 1 but is: 1 col_two should be 2 but is: 2 and also if I change max_len to much greater than 3583 - e.g., 5000. I don't see how the max len can make any difference here but I will be happy to be proved wrong. With Oracle Instant Client 11.2 and Oracle 11.1 and DBI 1.616 and DBD::Oracle 1.28 and perl 5.10.1. Can you try with: my $sth = $dbh->prepare(qq{ INSERT INTO $table_name(name) VALUES (?) RETURNING col_one, col_two INTO ?, ? }); $sth->bind_param(1, 'name'); # $max_len <= 3583 # $max_len >= 3584 $sth->bind_param_inout(2, \my $col_one, 3584); $sth->bind_param_inout(3, \my $col_two, 100); $sth->execute; Does that make a difference? Martin -- Martin J. Evans Wetherby, UK
On Thu Oct 20 14:03:01 2011, MJEVANS wrote: Show quoted text
> my $sth = $dbh->prepare(qq{ INSERT INTO $table_name(name) VALUES (?) > RETURNING col_one, col_two INTO ?, ? }); > > $sth->bind_param(1, 'name'); > # $max_len <= 3583 # $max_len >= 3584 > > $sth->bind_param_inout(2, \my $col_one, 3584); > $sth->bind_param_inout(3, \my $col_two, 100); > $sth->execute;
To me, it didn't made a difference, but upgrading the oracle client helped. With 11.2.0.2.0 I can't reproduce the bad behavior. bye, Danijel
On Fri Oct 21 08:58:03 2011, DATA wrote: Show quoted text
> On Thu Oct 20 14:03:01 2011, MJEVANS wrote:
> > my $sth = $dbh->prepare(qq{ INSERT INTO $table_name(name) VALUES (?) > > RETURNING col_one, col_two INTO ?, ? }); > > > > $sth->bind_param(1, 'name'); > > # $max_len <= 3583 # $max_len >= 3584 > > > > $sth->bind_param_inout(2, \my $col_one, 3584); > > $sth->bind_param_inout(3, \my $col_two, 100); > > $sth->execute;
> > To me, it didn't made a difference, but upgrading the oracle client > helped. With 11.2.0.2.0 I can't reproduce the bad behavior. > > bye, > > Danijel
So would be ok if I just documented this as a problem in certain (older) versions of Oracle Client then wrote this rt off. Martin -- Martin J. Evans Wetherby, UK
On Thu Nov 17 14:24:47 2011, MJEVANS wrote: Show quoted text
> So would be ok if I just documented this as a problem in certain (older) > versions of Oracle Client then wrote this rt off.
Excuse the late response. Documentation is enough. Thanks!
On Sat May 05 03:48:49 2012, rbo wrote: Show quoted text
> On Thu Nov 17 14:24:47 2011, MJEVANS wrote:
> > So would be ok if I just documented this as a problem in certain (older) > > versions of Oracle Client then wrote this rt off.
> > Excuse the late response. Documentation is enough. > > Thanks!
Documented in the troubleshooting guide in the next release. Martin -- Martin J. Evans Wetherby, UK