9 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ADO_${_}" } qw/DSN USER PASS/};
11 plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ADO_DSN}, _USER and _PASS to run this test'
12 unless ($dsn && $user);
16 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
17 $schema->storage->ensure_connected;
19 isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server' );
21 $schema->storage->dbh_do (sub {
22 my ($storage, $dbh) = @_;
23 eval { $dbh->do("DROP TABLE artist") };
26 artistid INT IDENTITY NOT NULL,
28 rank INT NOT NULL DEFAULT '13',
29 charfield CHAR(10) NULL,
35 my $new = $schema->resultset('Artist')->create({ name => 'foo' });
36 ok($new->artistid > 0, 'Auto-PK worked');
38 # make sure select works
39 my $found = $schema->resultset('Artist')->search({ name => 'foo' })->first;
40 is $found->artistid, $new->artistid, 'search works';
42 # test large column list in select
43 $found = $schema->resultset('Artist')->search({ name => 'foo' }, {
44 select => ['artistid', 'name', map "'foo' foo_$_", 0..50],
45 as => ['artistid', 'name', map "foo_$_", 0..50],
47 is $found->artistid, $new->artistid, 'select with big column list';
48 is $found->get_column('foo_50'), 'foo', 'last item in big column list';
50 # create a few more rows
52 $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
55 # test multiple active cursors
56 my $rs1 = $schema->resultset('Artist')->search({}, { order_by => 'artistid' });
57 my $rs2 = $schema->resultset('Artist')->search({}, { order_by => 'name' });
60 ok eval { $rs2->next }, 'multiple active cursors';
65 if (my $dbh = eval { $schema->storage->_dbh }) {
66 eval { $dbh->do("DROP TABLE $_") }