From: Dagfinn Ilmari Mannsåker Date: Tue, 19 Nov 2013 18:36:01 +0000 (+0000) Subject: Fix national character type sizes on DBD::Oracle >= 1.52 X-Git-Tag: 0.07038~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08ae3055941b3b62146caefb0e4a2084aa5ae21a;hp=347cd75b3369d0160a3a83ecfa1c37ed76f2d45c;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Fix national character type sizes on DBD::Oracle >= 1.52 Older versions erroneously reported the size in bytes (using UTF-16), not characters. --- diff --git a/Changes b/Changes index a25b74e..8f85e17 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - Fix MySQL column info detection with multiple schemas (RT#82358) - Fix skip count for Oracle multi-schema tests - Actually test data types that require separate tables + - Fix national character type sizes on DBD::Oracle >= 1.52 0.07037 2013-10-30 - Allow overriding individual moniker parts diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 1c5b432..2b5c7eb 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -199,6 +199,9 @@ EOF } } + # Old DBD::Oracle report the size in (UTF-16) bytes, not characters + my $nchar_size_factor = $DBD::Oracle::VERSION >= 1.52 ? 1 : 2; + while (my ($col, $info) = each %$result) { no warnings 'uninitialized'; @@ -229,7 +232,7 @@ EOF $info->{size} = $info->{size}[0] / 8; } else { - $info->{size} = $info->{size} / 2; + $info->{size} = $info->{size} / $nchar_size_factor; } } elsif ($info->{data_type} =~ /^(?:var)?char2?\z/i) {