8 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ODBC_${_}" } qw/DSN USER PASS/};
10 plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test'
11 unless ($dsn && $user);
15 my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1});
17 $schema->storage->ensure_connected;
18 isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' );
20 my $dbh = $schema->storage->dbh;
22 eval { $dbh->do("DROP TABLE artist") };
26 artistid INT IDENTITY NOT NULL,
34 # test primary key handling
35 my $new = $schema->resultset('Artist')->create({ name => 'foo' });
36 ok($new->artistid > 0, "Auto-PK worked");
38 $seen_id{$new->artistid}++;
42 $new = $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
43 is ( $seen_id{$new->artistid}, undef, "id for Artist $_ is unique" );
44 $seen_id{$new->artistid}++;
47 my $it = $schema->resultset('Artist')->search( {}, {
49 order_by => 'artistid',
52 is( $it->count, 3, "LIMIT count ok" );
53 is( $it->next->name, "foo", "iterator->next ok" );
55 is( $it->next->name, "Artist 2", "iterator->next ok" );
56 is( $it->next, undef, "next past end of resultset ok" );
61 $dbh->do('DROP TABLE artist') if $dbh;