From: Peter Rabbitson Date: Thu, 29 Jan 2009 09:14:31 +0000 (+0000) Subject: Sanify 746mssql.t X-Git-Tag: v0.08011~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89a113984a8a0967d146d8179b0bcbfe6e580d95;p=dbsrgits%2FDBIx-Class.git Sanify 746mssql.t --- diff --git a/t/746mssql.t b/t/746mssql.t index 52b5357..802e469 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -17,11 +17,11 @@ 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), @@ -29,6 +29,10 @@ CREATE TABLE artist ( primary key(artistid) ) +SQL + +}); + my %seen_id; # test primary key handling @@ -58,6 +62,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; }