7 use DBIx::Class::Optional::Dependencies ();
11 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSACCESS_ODBC_${_}" } qw/DSN USER PASS/};
12 my ($dsn2, $user2, $pass2) = @ENV{map { "DBICTEST_MSACCESS_ADO_${_}" } qw/DSN USER PASS/};
14 plan skip_all => 'Test needs ' .
15 (join ' and ', map { $_ ? $_ : () }
16 DBIx::Class::Optional::Dependencies->req_missing_for('test_dt'),
17 (join ' or ', map { $_ ? $_ : () }
18 DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_msaccess_odbc'),
19 DBIx::Class::Optional::Dependencies->req_missing_for('test_rdbms_msaccess_ado')))
21 DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt') && (
22 $dsn && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_msaccess_odbc')
24 $dsn2 && DBIx::Class::Optional::Dependencies->req_ok_for('test_rdbms_msaccess_ado'))
25 or (not $dsn || $dsn2);
27 plan skip_all => <<'EOF' unless $dsn || $dsn2;
28 Set $ENV{DBICTEST_MSACCESS_ODBC_DSN} and/or $ENV{DBICTEST_MSACCESS_ADO_DSN} (and optionally _USER and _PASS) to run these tests.
29 Warning: this test drops and creates the table 'track'.
33 [ $dsn, $user || '', $pass || '' ],
34 [ $dsn2, $user2 || '', $pass2 || '' ],
37 for my $connect_info (@connect_info) {
38 my ($dsn, $user, $pass) = @$connect_info;
42 my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {
43 on_connect_call => 'datetime_setup',
47 my $guard = Scope::Guard->new(sub { cleanup($schema) });
49 try { local $^W = 0; $schema->storage->dbh->do('DROP TABLE track') };
50 $schema->storage->dbh->do(<<"SQL");
52 trackid AUTOINCREMENT PRIMARY KEY,
55 last_updated_at DATETIME
59 ok(my $dt = DateTime->new({
68 ok(my $row = $schema->resultset('Track')->create({
69 last_updated_at => $dt,
72 ok($row = $schema->resultset('Track')
73 ->search({ trackid => $row->trackid }, { select => ['last_updated_at'] })
76 is($row->last_updated_at, $dt, "DATETIME roundtrip" );
84 # have to reconnect to drop a table that's in use
85 if (my $storage = eval { $schema->storage }) {
88 $storage->dbh->do('DROP TABLE track');