From: Rafael Kitover Date: Mon, 10 May 2010 14:53:12 +0000 (-0400) Subject: more Oracle type info fixes X-Git-Tag: 0.07000~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c22571bbcdd910b099726e551bdb4d45be6e744;hp=007e35115cb7dd95dd4205cebb4dee1c8af2a744;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 7e0b33e..b2e1f5a 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -200,6 +200,18 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK $info->{size} = [ $day_precision, $second_precision ]; } } + elsif (lc($info->{data_type}) eq 'float') { + $info->{original}{data_type} = 'float'; + $info->{original}{size} = $info->{size}; + + if ($info->{size} <= 63) { + $info->{data_type} = 'real'; + } + else { + $info->{data_type} = 'double precision'; + } + delete $info->{size}; + } elsif (lc($info->{data_type}) eq 'urowid' && $info->{size} == 4000) { delete $info->{size}; } @@ -207,6 +219,14 @@ AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIK $info->{data_type} = 'datetime'; $info->{original}{data_type} = 'date'; } + elsif (lc($info->{data_type}) eq 'binary_float') { + $info->{data_type} = 'real'; + $info->{original}{data_type} = 'binary_float'; + } + elsif (lc($info->{data_type}) eq 'binary_double') { + $info->{data_type} = 'double precision'; + $info->{original}{data_type} = 'binary_double'; + } if (eval { lc(${ $info->{default_value} }) eq 'sysdate' }) { $info->{original}{default_value} = $info->{default_value}; diff --git a/t/13db2_common.t b/t/13db2_common.t index c21fec8..4cbb7fd 100644 --- a/t/13db2_common.t +++ b/t/13db2_common.t @@ -14,7 +14,7 @@ my $tester = dbixcsl_common_tests->new( password => $password, null => '', data_types => { - 'timestamp default current timestamp' => { data_type => 'timestamp', default_value => \'current_timestamp' } + 'timestamp DEFAULT CURRENT TIMESTAMP' => { data_type => 'timestamp', default_value => \'current_timestamp' } }, ); diff --git a/t/14ora_common.t b/t/14ora_common.t index 1a67123..639e416 100644 --- a/t/14ora_common.t +++ b/t/14ora_common.t @@ -50,7 +50,7 @@ my $tester = dbixcsl_common_tests->new( # Numeric Types # - # everything is alised to NUMBER + # integer/decimal/numeric is alised to NUMBER # 'decimal' => { data_type => 'integer' }, 'dec' => { data_type => 'integer' }, @@ -68,8 +68,15 @@ my $tester = dbixcsl_common_tests->new( 'int' => { data_type => 'integer' }, 'smallint' => { data_type => 'integer' }, - 'binary_float' => { data_type => 'binary_float' }, - 'binary_double' => { data_type => 'binary_double' }, + 'binary_float' => { data_type => 'real', original => { data_type => 'binary_float' } }, + 'binary_double' => { data_type => 'double precision', original => { data_type => 'binary_double' } }, + + # these are not mentioned in the summary chart, must be aliased + real => { data_type => 'real', original => { data_type => 'float', size => 63 } }, + 'float(63)' => { data_type => 'real', original => { data_type => 'float', size => 63 } }, + 'float(64)' => { data_type => 'double precision', original => { data_type => 'float', size => 64 } }, + 'float(126)' => { data_type => 'double precision', original => { data_type => 'float', size => 126 } }, + float => { data_type => 'double precision', original => { data_type => 'float', size => 126 } }, # Blob Types 'raw(50)' => { data_type => 'raw', size => 50 },