[svn:dbd-oracle] r15381 - in dbd-oracle/trunk: . lib/DBD t

[email protected] Mon, 10 Sep 2012 02:01:35 -0700 (PDT)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: mjevans
Date: Mon Sep 10 02:01:28 2012
New Revision: 15381

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/lib/DBD/Oracle.pm
   dbd-oracle/trunk/t/rt13865.t   (contents, props changed)

Log:
Added fixes for rt 78700 from Douglas Wilson


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Mon Sep 10 02:01:28 2012
@@ -29,6 +29,9 @@
 
   - fixed some compiler warnings for %lf (Martin J. Evans)
 
+  - fixed RT78700 - column_info reports wrong size for char semantic
+    char type columns (Douglas Wilson).
+
   [CHANGE IN BEHAVIOUR]
 
   - ora_taf and ora_taf_sleep were redundant and have been removed.

Modified: dbd-oracle/trunk/lib/DBD/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/lib/DBD/Oracle.pm	(original)
+++ dbd-oracle/trunk/lib/DBD/Oracle.pm	Mon Sep 10 02:01:28 2012
@@ -662,6 +662,9 @@
          , 'FLOAT'    , tc.DATA_PRECISION
          , 'DATE'     , 19
          , 'VARCHAR2' , tc.CHAR_LENGTH
+         , 'CHAR'     , tc.CHAR_LENGTH
+         , 'NVARCHAR2', tc.CHAR_LENGTH
+         , 'NCHAR'    , tc.CHAR_LENGTH
          , tc.DATA_LENGTH
          )                   COLUMN_SIZE
        , decode( tc.DATA_TYPE

Modified: dbd-oracle/trunk/t/rt13865.t
==============================================================================
--- dbd-oracle/trunk/t/rt13865.t	(original)
+++ dbd-oracle/trunk/t/rt13865.t	Mon Sep 10 02:01:28 2012
@@ -1,3 +1,4 @@
+# $Id$
 use strict;
 
 use DBI;
@@ -17,7 +18,7 @@
     plan skip_all => q{requires permissions 'CREATE TABLE' and 'DROP TABLE'};
 }
 
-plan tests => 5;
+plan tests => 9;
 
 $dbh->do( 'DROP TABLE RT13865' );
 
@@ -29,31 +30,50 @@
     COL_DECIMAL NUMBER(9,2),
     COL_FLOAT FLOAT(126),
     COL_VC2   VARCHAR2(67),
-    COL_VC2_69CHAR  VARCHAR2(69 CHAR)
-) 
+    COL_VC2_69CHAR  VARCHAR2(69 CHAR),
+    COL_NVC2  NVARCHAR2(69),
+    COL_NC    NCHAR(69),
+    COL_CHAR  CHAR(67),
+    COL_CHAR_69CHAR  CHAR(69 CHAR)
+)
 END_SQL
 
 my $col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_INTEGER' );
 
-is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 38, 
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 38,
     "INTEGER is alias for NUMBER(38)";
 
 $col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_NUMBER_37' );
-is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 37, 
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 37,
     "NUMBER(37)";
 
 $col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_NUMBER' );
-cmp_ok $col_h->fetchrow_hashref->{COLUMN_SIZE}, '>', 0, 
+cmp_ok $col_h->fetchrow_hashref->{COLUMN_SIZE}, '>', 0,
     "NUMBER";
 
 $col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_VC2' );
-is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 67, 
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 67,
     "VARCHAR(67)";
 
 $col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_VC2_69CHAR' );
-is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 69, 
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 69,
     "VARCHAR(69)";
 
+$col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_NVC2' );
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 69,
+    "NVARCHAR2(69)";
+
+$col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_NC' );
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 69,
+    "NCHAR(69)";
+
+$col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_CHAR' );
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 67,
+    "CHAR(67)";
+
+$col_h = $dbh->column_info( undef, undef, 'RT13865', 'COL_CHAR_69CHAR' );
+is $col_h->fetchrow_hashref->{COLUMN_SIZE} => 69,
+    "CHAR(69)";
 
 $dbh->do( 'DROP TABLE RT13865' );