Re: DBD::Oracle and $sth->{PRECISION}



On Thu, Oct 13, 2005 at 09:32:33AM +0100, Tim Bunce wrote:
> On Thu, Oct 13, 2005 at 01:15:21AM -0400, Eric Lenio wrote:
> > Hi,
> >
> > In perl 5.8.3, DBD::Oracle 1.14, DBI 1.47 I get expected values when I look at
> > $sth->{PRECISION} to retrieve the lengths of varchar2 columns for a given
> > table.
> >
> > I'm now testing perl 5.8.7, DBD::Oracle 1.16, and DBI 1.48 and with the same
> > table the values in $sth->{PRECISION} for varchar2's are all quadruple what
> > they are above. Can anyone shed any light on what might cause this? It seems
> > to affect all tables.
>
> Probably due to character set related changes in recent releases.
>
> The best thing to do would be to add some tests to one of the test files
> (t/*.t) that demonstrates the problem. Pick a file to change (ie t/20select.t),
> copy it (t/20select.t.orig), add the new test, check it fails (make test),
> then post the output of "diff -u t/20select.t.orig t/20select.t".
>
> Please also post the two lines of client and server character set
> details output by make test.
>
> Tim.
>

Diff file is attached. Basically I added a test to check the PRECISION
of the 2nd column in the test table, which I believe is supposed to be
10.

With this new test I get this during 'make test':

t/20select..............# failed test 12 at line 109.
# failed test 24 at line 109.
# failed test 36 at line 109.
FAILED tests 12, 24, 36-38
Failed 5/35 tests, 85.71% okay
t/21nchar............... Database and client versions and character sets:
Database 9.2.0.3.0 CHAR set is AL32UTF8 (Unicode), NCHAR set is UTF8 (Unicode)
Client 9.2.0.3 NLS_LANG is 'AMERICAN_AMERICA.AL32UTF8', NLS_NCHAR is '<unset>'

FYI I have another Oracle instance on the same machine which if I use this
instance instead of the original one used above the tests all pass.
--- t/20select.t.orig	Thu Oct 13 09:32:29 2005+++ t/20select.t	Thu Oct 13 09:55:25 2005
@@ -54,7 +54,7 @@
 my $sz = 8;
 
 my $tests = 2;
-my $tests_per_set = 11;
+my $tests_per_set = 12;
 $tests += @test_sets * $tests_per_set;
 print "1..$tests\n";
 
@@ -106,6 +106,7 @@
      cdif($tmp->[1][1], $data1, "Len ".length($tmp->[1][1])) );
   ok(0, $tmp->[2][1] =~ m/$data2/,
      cdif($tmp->[2][1], $data2, "Len ".length($tmp->[2][1])) );
+  ok(0, $sth->{PRECISION}->[1] == 10);
   
   
 } # end of run_select_tests


Relevant Pages

  • Re: DBD::Oracle and $sth->{PRECISION}
    ... > table the values in $sth->for varchar2's are all quadruple what ... Probably due to character set related changes in recent releases. ... The best thing to do would be to add some tests to one of the test files ...
    (perl.dbi.users)
  • Re: DBD::Oracle and $sth->{PRECISION}
    ... >>> Probably due to character set related changes in recent releases. ... >>> details output by make test. ... >> FYI I have another Oracle instance on the same machine which if I use this ... Here is the char set details for the instance that passes the tests: ...
    (perl.dbi.users)