From: Peter Rabbitson Date: Mon, 4 Apr 2011 07:28:18 +0000 (+0200) Subject: Some test fixes and TODOs for older Oracle versions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=538878de87e46f970e8575baa7caa16bb1da60d7;p=dbsrgits%2FDBIx-Class-Historic.git Some test fixes and TODOs for older Oracle versions --- diff --git a/t/73oracle.t b/t/73oracle.t index 8bab7af..84847ae 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -73,10 +73,7 @@ my $v = do { sprintf('%d.%03d', $1, $2); }; -# while 8i (8.1) does not document support for ansi joins, and the the drivers do not use -# them because performance sucks, there is strong evidence they are in fact supported -# means we can test 'em :) -my $test_server_supports_only_orajoins = $v < 8.001; +my $test_server_supports_only_orajoins = $v < 9; # TODO find out which version supports the RETURNING syntax # 8i (8.1) has it and earlier docs are a 404 on oracle.com @@ -89,8 +86,8 @@ is ( ); ########## -# recyclebin sometimes comes in the way -my $on_connect_sql = ["ALTER SESSION SET recyclebin = OFF"]; +# the recyclebin (new for 10g) sometimes comes in the way +my $on_connect_sql = $v >= 10 ? ["ALTER SESSION SET recyclebin = OFF"] : []; # iterate all tests on following options my @tryopt = ( diff --git a/t/inflate/datetime_oracle.t b/t/inflate/datetime_oracle.t index a9148a4..c6c1324 100644 --- a/t/inflate/datetime_oracle.t +++ b/t/inflate/datetime_oracle.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::Exception; use lib qw(t/lib); use DBICTest; @@ -24,12 +25,18 @@ $ENV{NLS_COMP} = "BINARY"; my $schema = DBICTest::Schema->connect($dsn, $user, $pass); +# older oracles do not support a TIMESTAMP datatype +my $timestamp_datatype = ($schema->storage->_server_info->{normalized_dbms_version}||0) < 9 + ? 'DATE' + : 'TIMESTAMP' +; + # Need to redefine the last_updated_on column my $col_metadata = $schema->class('Track')->column_info('last_updated_on'); $schema->class('Track')->add_column( 'last_updated_on' => { data_type => 'date' }); $schema->class('Track')->add_column( 'last_updated_at' => { - data_type => 'timestamp' }); + data_type => $timestamp_datatype }); my $dbh = $schema->storage->dbh; @@ -38,7 +45,12 @@ my $dbh = $schema->storage->dbh; eval { $dbh->do("DROP TABLE track"); }; -$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE, last_updated_at TIMESTAMP)"); +$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE, last_updated_at $timestamp_datatype)"); + +TODO: { +local $TODO = 'FIXME - something odd is going on with Oracle < 9 datetime support' + if ($schema->storage->_server_info->{normalized_dbms_version}||0) < 9; +lives_ok { # insert a row to play with my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07', last_updated_at => '2009-05-03 21:17:18.5' }); @@ -90,6 +102,8 @@ is( $track->last_updated_at, $timestamp, 'DateTime round-trip as TIMESTAMP' ); is( int $track->last_updated_at->nanosecond, int 500_000_000, 'TIMESTAMP nanoseconds survived' ); +} 'dateteime operations executed correctly' } # end of lives_ok/TODO block + done_testing; # clean up our mess