X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FOracle.pm;h=e792c49d890b51ab42810edfce6188764846c623;hb=53c4835c7c3e764f0881b196fb29f348916e8411;hp=2d983d38672c94dee2ed69ce54231b8a27f0c8b8;hpb=023596033b27c52ba85a41181004cf960d84fb75;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 2d983d3..e792c49 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -8,7 +8,7 @@ use Try::Tiny; use DBIx::Class::Schema::Loader::Utils qw/sigwarn_silencer/; use namespace::clean; -our $VERSION = '0.07036_03'; +our $VERSION = '0.07040'; =head1 NAME @@ -126,8 +126,7 @@ EOF push @{$constr_names{$constr_name}}, $constr_col; } - my @uniqs = map { [ $_ => $constr_names{$_} ] } keys %constr_names; - return \@uniqs; + return [ map { [ $_ => $constr_names{$_} ] } sort keys %constr_names ]; } sub _table_comment { @@ -185,7 +184,7 @@ EOF $sth->execute($table->name, $table->schema); while (my ($trigger_body) = $sth->fetchrow_array) { - if (my ($seq_schema, $seq_name) = $trigger_body =~ /(?:\."?(\w+)"?)?"?(\w+)"?\.nextval/i) { + if (my ($seq_schema, $seq_name) = $trigger_body =~ /(?:"?(\w+)"?\.)?"?(\w+)"?\.nextval/i) { if (my ($col_name) = $trigger_body =~ /:new\.(\w+)/i) { $col_name = $self->_lc($col_name); @@ -199,6 +198,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 +231,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) {