From: Peter Rabbitson Date: Thu, 13 Aug 2009 05:42:51 +0000 (+0000) Subject: Adjust the storage DESTROY and the tests to accomodate the new global RaiseError=1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a4c1d89695fc181340e6eb5d469485798f067e7;p=dbsrgits%2FDBIx-Class-Historic.git Adjust the storage DESTROY and the tests to accomodate the new global RaiseError=1 --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 4f280ee..333bf19 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -2431,8 +2431,13 @@ sub lag_behind_master { sub DESTROY { my $self = shift; - return if !$self->_dbh; - $self->_verify_pid; + $self->_verify_pid if $self->_dbh; + + # some databases need this to stop spewing warnings + if (my $dbh = $self->_dbh) { + eval { $dbh->disconnect }; + } + $self->_dbh(undef); } diff --git a/t/745db2.t b/t/745db2.t index 3f635f8..3ba8579 100644 --- a/t/745db2.t +++ b/t/745db2.t @@ -85,5 +85,6 @@ is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); # clean up our mess END { + my $dbh = eval { $schema->storage->_dbh }; $dbh->do("DROP TABLE artist") if $dbh; } diff --git a/t/746db2_400.t b/t/746db2_400.t index 21c72df..359c13e 100644 --- a/t/746db2_400.t +++ b/t/746db2_400.t @@ -82,6 +82,6 @@ is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); # clean up our mess END { + my $dbh = eval { $schema->storage->_dbh }; $dbh->do("DROP TABLE artist") if $dbh; } - diff --git a/t/92storage.t b/t/92storage.t index 94bdfd3..c8a0bba 100644 --- a/t/92storage.t +++ b/t/92storage.t @@ -93,6 +93,7 @@ my $invocations = { 'bar', undef, { + %{$storage->_default_dbi_connect_attributes || {} }, PrintError => 0, AutoCommit => 1, }, @@ -122,8 +123,8 @@ my $invocations = { args => [ { on_connect_do => [qw/a b c/], - PrintError => 0, - AutoCommit => 1, + PrintError => 1, + AutoCommit => 0, on_disconnect_do => [qw/d e f/], user => 'bar', dsn => 'foo', @@ -138,8 +139,9 @@ my $invocations = { 'bar', undef, { - PrintError => 0, - AutoCommit => 1, + %{$storage->_default_dbi_connect_attributes || {} }, + PrintError => 1, + AutoCommit => 0, }, ], }, diff --git a/t/93nobindvars.t b/t/93nobindvars.t index ea77526..e6ee0eb 100644 --- a/t/93nobindvars.t +++ b/t/93nobindvars.t @@ -65,5 +65,6 @@ 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; }