8 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};
10 #warn "$dsn $user $pass";
12 plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test'
17 my $storage_type = '::DBI::MSSQL';
18 $storage_type = '::DBI::Sybase::MSSQL' if $dsn =~ /^dbi:Sybase:/;
19 # Add more for others in the future when they exist (ODBC? ADO? JDBC?)
21 DBICTest::Schema->storage_type($storage_type);
22 DBICTest::Schema->compose_connection( 'MSSQLTest' => $dsn, $user, $pass );
24 my $dbh = MSSQLTest->schema->storage->dbh;
26 $dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL
29 $dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(255));");
31 MSSQLTest::Artist->load_components('PK::Auto::MSSQL');
34 my $new = MSSQLTest::Artist->create( { name => 'foo' } );
35 ok($new->artistid, "Auto-PK worked");
39 MSSQLTest::Artist->create( { name => 'Artist ' . $_ } );
42 my $it = MSSQLTest::Artist->search( { },
45 order_by => 'artistid'
49 is( $it->count, 3, "LIMIT count ok" );
50 ok( $it->next->name, "iterator->next ok" );
53 is( $it->next, undef, "next past end of resultset ok" );