X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F746mssql.t;h=3e70574e4bf3d9bf6276050e4ad8952c1c3148de;hb=2ce08f975f976b1de7a8f4461c0fa052e77ee489;hp=52b535772316597fcbda0a31be66c81436e1f4a7;hpb=c1cac6332247a092ddc886c52607b24104c3fb46;p=dbsrgits%2FDBIx-Class.git diff --git a/t/746mssql.t b/t/746mssql.t index 52b5357..3e70574 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -17,20 +17,28 @@ my $schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1}); $schema->storage->ensure_connected; isa_ok( $schema->storage, 'DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server' ); -my $dbh = $schema->storage->dbh; +$schema->storage->dbh_do (sub { + my ($storage, $dbh) = @_; + eval { $dbh->do("DROP TABLE artist") }; + $dbh->do(<<'SQL'); -eval { $dbh->do("DROP TABLE artist") }; - - $dbh->do(<<''); CREATE TABLE artist ( artistid INT IDENTITY NOT NULL, - name VARCHAR(255), - charfield CHAR(10), + name VARCHAR(100), + rank INT NOT NULL DEFAULT '13', + charfield CHAR(10) NULL, primary key(artistid) ) +SQL + +}); + my %seen_id; +# fresh $schema so we start unconnected +$schema = DBICTest::Schema->connect($dsn, $user, $pass, {AutoCommit => 1}); + # test primary key handling my $new = $schema->resultset('Artist')->create({ name => 'foo' }); ok($new->artistid > 0, "Auto-PK worked"); @@ -58,6 +66,7 @@ is( $it->next, undef, "next past end of resultset ok" ); # clean up our mess END { + my $dbh = eval { $schema->storage->_dbh }; $dbh->do('DROP TABLE artist') if $dbh; }