From: Peter Rabbitson Date: Tue, 19 Apr 2011 11:05:37 +0000 (+0200) Subject: Minor cleanups after rebase X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6805def7cbf7b73bbf5f54c174b6623eebe5426;p=dbsrgits%2FDBIx-Class.git Minor cleanups after rebase --- diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index bf17e90..bfc31af 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -177,10 +177,14 @@ sub _check_dbh_gen { } sub DESTROY { - # None of the reasons this would die matter if we're in DESTROY anyways if (my $sth = $_[0]->sth) { - local $SIG{__WARN__} = sub {}; - try { $sth->finish } if $sth->FETCH('Active'); + # cleanup only core DBI handles, for anything more esoteric we + # assume they know how to clean up ater themselves + if ($sth->isa('DBI::st')) { + local $SIG{__WARN__} = sub {}; + # None of the reasons this would die matter if we're in DESTROY anyways + try { $sth->finish } if $sth->FETCH('Active'); + } } } diff --git a/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm b/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm index 40522d8..a77685c 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg/Sth.pm @@ -112,7 +112,7 @@ sub _prepare_cursor_sth { return if $self->cursor_sth; - $self->cursor_sth($self->storage->sth($self->cursor_sql)); + $self->cursor_sth($self->storage->_sth($self->cursor_sql)); } sub _cleanup_sth { @@ -191,7 +191,7 @@ sub _run_fetch_sth { } $self->fetch_sth->finish if $self->fetch_sth; - $self->fetch_sth($self->storage->sth($self->fetch_sql)); + $self->fetch_sth($self->storage->_sth($self->fetch_sql)); $self->fetch_sth->execute; } diff --git a/t/72pg_cursors.t b/t/72pg_cursors.t index 4141999..cafefc6 100644 --- a/t/72pg_cursors.t +++ b/t/72pg_cursors.t @@ -47,11 +47,14 @@ $schema->storage->set_use_dbms_capability('server_cursors',1); drop_test_schema($schema);create_test_schema($schema); my ($called,$page_size)=(0,0); -my $old_sth_new=\&DBIx::Class::Storage::DBI::Pg::Sth::new; -*DBIx::Class::Storage::DBI::Pg::Sth::new=sub { - ++$called;$page_size=$_[4]; - goto &$old_sth_new; -}; +{ + no warnings 'redefine'; + my $old_sth_new=\&DBIx::Class::Storage::DBI::Pg::Sth::new; + *DBIx::Class::Storage::DBI::Pg::Sth::new=sub { + ++$called;$page_size=$_[4]; + goto &$old_sth_new; + }; +} END { return unless $schema;