Subject: | DBD-Oracle 1.16 Oracle data corruption |
#!/usr/local/bin/perl -w
#
# Not sure how to describe bug; run the enclosed code
# compare print out on line pack "C*" I know pack C* is weird to do
# but it clearly shows that Oracle data is corrupted
#
# If i run unpack "A*" pack a* etc on the Oracle data the problem
# goes away
#
# this script gives an idea of what I am seeing
# it happens on solaris 10 Intel and Solaris 8 on Sparc
# when I rollback to DBD-Oracle 1.14 the behavior goes away
# on all systems
#
# I am running against Oracle 9 & 10 databases and using Oracle 9 software
# on Sparc 8 and Oracle 10g on Solaris Intel 10 for the DBD build
#
# connections are to remote databases using SQL*Net
# NLS_LANG AMERICAN_AMERICA.UTF8
#
# I get the error on these versions of perl -v 5.005_03, 5.8.7
#
use strict;
use warnings;
use DBI;
# any database 9i,10g
my $dbh=DBI->connect("dbi:Oracle:",'scott/tiger@test',) or die "error 1\n"; my ($s1,$s2)=getData();
$dbh->disconnect;
processString($s1);
processString($s2);
sub processString
{
my $string=shift;
print "$string\n"; # data LOOKs OKAY
# $string = pack ("a*",$string); # this will clean the data
# $string = pack ("A*",$string); # this will clean the data
# $string = unpack ("a*",$string); # this will clean the data
# $string = unpack ("A*",$string); # this will clean the data
$string = pack "C*", $string; # this will give an error
# Argument "\x{4d}\x{51} ..." isn't a numeric for Oracle
# Argument "MQC" isn't a numeric for clean data
}
sub getData
{
my ($s1,$s2,$sth);
$sth=$dbh->prepare(" SELECT 'BUNCE' from dual "); # hard code result
$sth->execute;
$s1=$sth->fetchrow();
$sth->finish;
$s2='BUNCE'; # hard code result
print "EQUAL\n" if ( $s1 eq $s2); #
return ($s1,$s2);
}
#
# If there is any other information I can provide please let me know
#