9 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_ASA_${_}" } qw/DSN USER PASS/};
13 'Set $ENV{DBICTEST_SYBASE_ASA_DSN}, _USER and _PASS to run this test' .
14 "\nWarning: This test drops and creates a table called 'track'";
16 eval "use DateTime; use DateTime::Format::Strptime;";
18 plan skip_all => 'needs DateTime and DateTime::Format::Strptime for testing';
24 $schema = DBICTest::Schema->clone;
26 $schema->connection($dsn, $user, $pass, {
27 on_connect_call => [ 'datetime_setup' ],
32 ['TIMESTAMP', 'last_updated_at', '2004-08-21 14:36:48.080444'],
33 # date only (but minute precision according to ASA docs)
34 ['DATE', 'small_dt', '2004-08-21 00:00:00.000000'],
37 for my $dt_type (@dt_types) {
38 my ($type, $col, $sample_dt) = @$dt_type;
40 eval { $schema->storage->dbh->do("DROP TABLE track") };
41 $schema->storage->dbh->do(<<"SQL");
43 trackid INT IDENTITY PRIMARY KEY,
49 ok(my $dt = $schema->storage->datetime_parser->parse_datetime($sample_dt));
52 ok( $row = $schema->resultset('Track')->create({
56 ok( $row = $schema->resultset('Track')
57 ->search({ trackid => $row->trackid }, { select => [$col] })
60 is( $row->$col, $dt, 'DateTime roundtrip' );
67 if (my $dbh = eval { $schema->storage->_dbh }) {
68 $dbh->do('DROP TABLE track');