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::Sybase;";
18 plan skip_all => 'needs DateTime and DateTime::Format::Sybase for testing';
24 $schema = DBICTest::Schema->clone;
26 $schema->connection($dsn, $user, $pass, {
28 on_connect_call => [ 'datetime_setup' ],
33 ['DATETIME', 'last_updated_at', '2004-08-21T14:36:48.080Z'],
35 ['SMALLDATETIME', 'small_dt', '2004-08-21T14:36:00.000Z'],
38 for my $dt_type (@dt_types) {
39 my ($type, $col, $sample_dt) = @$dt_type;
41 eval { $schema->storage->dbh->do("DROP TABLE track") };
42 $schema->storage->dbh->do(<<"SQL");
44 trackid INT IDENTITY PRIMARY KEY,
50 ok(my $dt = DateTime::Format::Sybase->parse_datetime($sample_dt));
53 ok( $row = $schema->resultset('Track')->create({
57 ok( $row = $schema->resultset('Track')
58 ->search({ trackid => $row->trackid }, { select => [$col] })
61 is( $row->$col, $dt, 'DateTime roundtrip' );
68 if (my $dbh = eval { $schema->storage->_dbh }) {
69 $dbh->do('DROP TABLE track');