From: Rafael Kitover Date: Mon, 10 May 2010 16:35:50 +0000 (-0400) Subject: more Oracle type info fixes X-Git-Tag: 0.07000~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ea15dfe3e9a63998ff72e90c86e6a829e69127c;p=dbsrgits%2FDBIx-Class-Schema-Loader.git more Oracle type info fixes --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index b2e1f5a..59c34f1 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -163,9 +163,12 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK $info->{size} = $info->{size} / 2; } elsif (lc($info->{data_type}) eq 'number') { - $info->{data_type} = 'numeric'; + $info->{original}{data_type} = 'number'; + $info->{data_type} = 'numeric'; if (eval { $info->{size}[0] == 38 && $info->{size}[1] == 0 }) { + $info->{original}{size} = $info->{size}; + $info->{data_type} = 'integer'; delete $info->{size}; } diff --git a/t/14ora_common.t b/t/14ora_common.t index 3bdbe55..0f8b6ae 100644 --- a/t/14ora_common.t +++ b/t/14ora_common.t @@ -52,21 +52,21 @@ my $tester = dbixcsl_common_tests->new( # # integer/decimal/numeric is alised to NUMBER # - 'decimal' => { data_type => 'integer' }, - 'dec' => { data_type => 'integer' }, - 'numeric' => { data_type => 'integer' }, + 'integer' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } }, + 'int' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } }, + 'smallint' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } }, - 'decimal(3)' => { data_type => 'numeric', size => [3,0] }, - 'dec(3)' => { data_type => 'numeric', size => [3,0] }, - 'numeric(3)' => { data_type => 'numeric', size => [3,0] }, + 'decimal' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } }, + 'dec' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } }, + 'numeric' => { data_type => 'integer', original => { data_type => 'number', size => [38,0] } }, - 'decimal(3,3)' => { data_type => 'numeric', size => [3,3] }, - 'dec(3,3)' => { data_type => 'numeric', size => [3,3] }, - 'numeric(3,3)' => { data_type => 'numeric', size => [3,3] }, + 'decimal(3)' => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } }, + 'dec(3)' => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } }, + 'numeric(3)' => { data_type => 'numeric', size => [3,0], original => { data_type => 'number' } }, - 'integer' => { data_type => 'integer' }, - 'int' => { data_type => 'integer' }, - 'smallint' => { data_type => 'integer' }, + 'decimal(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } }, + 'dec(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } }, + 'numeric(3,3)' => { data_type => 'numeric', size => [3,3], original => { data_type => 'number' } }, 'binary_float' => { data_type => 'real', original => { data_type => 'binary_float' } }, 'binary_double' => { data_type => 'double precision', original => { data_type => 'binary_double' } },