From: Matt S Trout Date: Sat, 4 Aug 2007 16:44:46 +0000 (+0000) Subject: cleanup cursor class handling X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e4eb8ee1d77be917d2d721695e203c941e0219a2;p=dbsrgits%2FDBIx-Class-Historic.git cleanup cursor class handling --- diff --git a/Changes b/Changes index d767232..9fac8d0 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for DBIx::Class + - fixup cursor_class to be an 'inherited' attr for per-package defaults - add default_resultset_attributes entry to Schema - optimisation in DBI::Cursor to check software_limit before falling back to base Cursor->all diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 735ac65..f590b36 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -10,6 +10,11 @@ use Carp::Clan qw/^DBIx::Class/; use IO::File; __PACKAGE__->mk_group_accessors('simple' => qw/debug debugobj schema/); +__PACKAGE__->mk_group_accessors('inherited' => 'cursor_class'); + +__PACKAGE__->cursor_class('DBIx::Class::Cursor'); + +sub cursor { shift->cursor_class(@_); } package # Hide from PAUSE DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION; @@ -324,14 +329,12 @@ sub debugcb { } } -=head2 cursor +=head2 cursor_class The cursor class for this Storage object. =cut -sub cursor { die "Virtual method!" } - =head2 deploy Deploy the tables to storage (CREATE TABLE and friends in a SQL-based diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index f676ec1..5be636f 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -13,10 +13,12 @@ use Scalar::Util qw/blessed weaken/; __PACKAGE__->mk_group_accessors('simple' => qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts - _conn_pid _conn_tid disable_sth_caching cursor on_connect_do + _conn_pid _conn_tid disable_sth_caching on_connect_do transaction_depth unsafe _dbh_autocommit/ ); +__PACKAGE__->cursor_class('DBIx::Class::Storage::DBI::Cursor'); + BEGIN { package DBIC::SQL::Abstract; # Would merge upstream, but nate doesn't reply :( @@ -311,7 +313,6 @@ documents DBI-specific methods and behaviors. sub new { my $new = shift->next::method(@_); - $new->cursor("DBIx::Class::Storage::DBI::Cursor"); $new->transaction_depth(0); $new->_sql_maker_opts({}); $new->{_in_dbh_do} = 0; @@ -1061,7 +1062,7 @@ Handle a SQL select statement. sub select { my $self = shift; my ($ident, $select, $condition, $attrs) = @_; - return $self->cursor->new($self, \@_, $attrs); + return $self->cursor_class->new($self, \@_, $attrs); } sub select_single {