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: 88185
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: Nobody in particular
Requestors: Heinrich.Mislik [...] univie.ac.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: UTF-8 flag incorrect with multiple connections
Date: Tue, 27 Aug 2013 18:07:38 +0200
To: bug-DBD-Oracle [...] rt.cpan.org
From: "Heinrich Mislik" <Heinrich.Mislik [...] univie.ac.at>
When opening multiple connections with utf-8 and non utf-8 charactersets, the utf-8 flag is sometimes not correctly set. The charset is stored in a global variable resulting in the value of the last opened connection used. The charset should be stored with the connection. Here is sample code: use warnings; use strict; use DBI; my ($db,$user,$pass) = qw(somedb someuser somepass); my $dbh1 = DBI->connect("dbi:Oracle:$db", $user, $pass, {ora_charset=>'we8iso8859p15'}); my $x = $dbh1->selectrow_array("select chr(50084) from dual"); warn "$x->",utf8::is_utf8($x),"\n"; my $dbh2 = DBI->connect("dbi:Oracle:$db", $user, $pass, {ora_envhp => 0,ora_charset=>'al32utf8'}); $x = $dbh2->selectrow_array("select chr(50084) from dual"); warn "$x->",utf8::is_utf8($x),"\n"; $x = $dbh1->selectrow_array("select chr(50084) from dual"); warn "$x->",utf8::is_utf8($x),"\n"; DBI->connect("dbi:Oracle:$db", $user, $pass, {ora_envhp => 0,ora_charset=>'we8iso8859p15'}); $x = $dbh2->selectrow_array("select chr(50084) from dual"); warn "$x->",utf8::is_utf8($x),"\n"; print "$DBD::Oracle::VERSION\n"; __END__ On a terminal not capable of utf-8 This prints: ä-> À->1 ä->1 À-> 1.66 perl -V Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.18-308.1.1.el5, archname=x86_64-linux- thread-multi uname='linux x86-001.build.bos.redhat.com 2.6.18-308.1.1.el5 #1 smp fri feb 17 16:51:01 est 2012 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer- size=4 -m64 -mtune=generic -DDEBUGGING=-g -Dversion=5.10.1 - Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local - Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 - Dprivlib=/usr/share/perl5 -Darchlib=/usr/lib64/perl5 - Dvendorlib=/usr/share/perl5/vendor_perl - Dvendorarch=/usr/lib64/perl5/vendor_perl -Dinc_version_list=5.10.0 - Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles - Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow - Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n - Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr - Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto - Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict- aliasing -pipe -fstack-protector -I/usr/local/include - D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe - fstack-protector -I/usr/local/include' ccversion='', gccversion='4.4.6 20110731 (Red Hat 4.4.6-3)', 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='gcc', ldflags =' -fstack-protector' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.12' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E - Wl,-rpath,/usr/lib64/perl5/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,- D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer- size=4 -m64 -mtune=generic' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE Built under linux Compiled at May 2 2012 10:29:48 @INC: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . uname -a Linux katzi.cc.univie.ac.at 2.6.32-358.0.1.el6.x86_64 #1 SMP Wed Feb 20 11:05:23 EST 2013 x86_64 x86_64 x86_64 GNU/Linux Oracle version: oracle instantclient 11.2.0.3 Thanks Heinrich -- Heinrich Mislik Zentraler Informatikdienst der Universitaet Wien A-1010 Wien, Universitaetsstrasse 7 Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140
On Tue Aug 27 12:07:56 2013, Heinrich.Mislik@univie.ac.at wrote: Show quoted text
> When opening multiple connections with utf-8 and non utf-8 > charactersets, the utf-8 flag is sometimes not correctly set. The > charset is stored in a global variable resulting in the value of the > last opened connection used. The charset should be stored with the > connection. > > Here is sample code: > > use warnings; > use strict; > use DBI; > > my ($db,$user,$pass) = qw(somedb someuser somepass); > > my $dbh1 = DBI->connect("dbi:Oracle:$db", $user, $pass, > {ora_charset=>'we8iso8859p15'}); > my $x = $dbh1->selectrow_array("select chr(50084) from dual"); > warn "$x->",utf8::is_utf8($x),"\n"; > > my $dbh2 = DBI->connect("dbi:Oracle:$db", $user, $pass, > {ora_envhp => 0,ora_charset=>'al32utf8'}); > $x = $dbh2->selectrow_array("select chr(50084) from dual"); > warn "$x->",utf8::is_utf8($x),"\n"; > > $x = $dbh1->selectrow_array("select chr(50084) from dual"); > warn "$x->",utf8::is_utf8($x),"\n"; > > DBI->connect("dbi:Oracle:$db", $user, $pass, > {ora_envhp => 0,ora_charset=>'we8iso8859p15'}); > > $x = $dbh2->selectrow_array("select chr(50084) from dual"); > warn "$x->",utf8::is_utf8($x),"\n"; > > print "$DBD::Oracle::VERSION\n"; > __END__ > > On a terminal not capable of utf-8 This prints: > > ä-> > À->1 > ä->1 > À-> > 1.66 >
You can try https://github.com/mjegh/DBD-Oracle/tree/rt88185 but read the comment as that branch is not buildable without adding a line to Oracle.pm for the version. Also, I'd not install it, just test it out with: cd DBD-Oracle perl Makefile.PL make make test perl -Iblib/lib -Iblib/arch myscript.pl It passes your example but you might want to try it with whatever you were really doing. Martin -- Martin J. Evans Wetherby, UK
From: bohica [...] ntlworld.com
On Tue Dec 17 12:20:04 2013, MJEVANS wrote: Show quoted text
> On Tue Aug 27 12:07:56 2013, Heinrich.Mislik@univie.ac.at wrote:
> > When opening multiple connections with utf-8 and non utf-8 > > charactersets, the utf-8 flag is sometimes not correctly set. The > > charset is stored in a global variable resulting in the value of the > > last opened connection used. The charset should be stored with the > > connection. > > > > Here is sample code: > > > > use warnings; > > use strict; > > use DBI; > > > > my ($db,$user,$pass) = qw(somedb someuser somepass); > > > > my $dbh1 = DBI->connect("dbi:Oracle:$db", $user, $pass, > > {ora_charset=>'we8iso8859p15'}); > > my $x = $dbh1->selectrow_array("select chr(50084) from dual"); > > warn "$x->",utf8::is_utf8($x),"\n"; > > > > my $dbh2 = DBI->connect("dbi:Oracle:$db", $user, $pass, > > {ora_envhp => 0,ora_charset=>'al32utf8'}); > > $x = $dbh2->selectrow_array("select chr(50084) from dual"); > > warn "$x->",utf8::is_utf8($x),"\n"; > > > > $x = $dbh1->selectrow_array("select chr(50084) from dual"); > > warn "$x->",utf8::is_utf8($x),"\n"; > > > > DBI->connect("dbi:Oracle:$db", $user, $pass, > > {ora_envhp => 0,ora_charset=>'we8iso8859p15'}); > > > > $x = $dbh2->selectrow_array("select chr(50084) from dual"); > > warn "$x->",utf8::is_utf8($x),"\n"; > > > > print "$DBD::Oracle::VERSION\n"; > > __END__ > > > > On a terminal not capable of utf-8 This prints: > > > > ä-> > > À->1 > > ä->1 > > À-> > > 1.66 > >
> > You can try https://github.com/mjegh/DBD-Oracle/tree/rt88185 but read > the comment as that branch is not buildable without adding a line to > Oracle.pm for the version. Also, I'd not install it, just test it out > with: > > cd DBD-Oracle > perl Makefile.PL > make > make test > perl -Iblib/lib -Iblib/arch myscript.pl > > It passes your example but you might want to try it with whatever you > were really doing. > > Martin
Did this work for you. Yanick is about to do a new release so it would be useful to know. Martin -- Martin J. Evans Wetherby, UK
On Thu Jan 09 15:23:53 2014, MJEVANS wrote: Show quoted text
> > You can try https://github.com/mjegh/DBD-Oracle/tree/rt88185 but read > > the comment as that branch is not buildable without adding a line to > > Oracle.pm for the version. Also, I'd not install it, just test it out > > with: > > > > cd DBD-Oracle > > perl Makefile.PL > > make > > make test > > perl -Iblib/lib -Iblib/arch myscript.pl > > > > It passes your example but you might want to try it with whatever you > > were really doing. > > > > Martin
> > Did this work for you. Yanick is about to do a new release so it would > be useful to know. > > Martin
Any chance you could test the above so we can incorporate it in the next release? Martin -- Martin J. Evans Wetherby, UK