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
);
##########
-# 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 = (
use warnings;
use Test::More;
+use Test::Exception;
use lib qw(t/lib);
use DBICTest;
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;
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' });
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