From: Matt S Trout Date: Tue, 15 Nov 2005 03:55:24 +0000 (+0000) Subject: Bugfixes, optimisations X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=484c9dda865880cd4e1cda8e0117f1d073a6aa7e;p=dbsrgits%2FDBIx-Class-Historic.git Bugfixes, optimisations --- diff --git a/Changes b/Changes index 32d7482..600beaf 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for DBIx::Class + - Moved get_simple and set_simple into AccessorGroup + - Made 'new' die if given invalid columns + 0.03004 - Added an || '' to the CDBICompat stringify to avoid null warnings - Updated name section for manual pods diff --git a/lib/DBIx/Class/AccessorGroup.pm b/lib/DBIx/Class/AccessorGroup.pm index 1fcd2e0..0625f01 100644 --- a/lib/DBIx/Class/AccessorGroup.pm +++ b/lib/DBIx/Class/AccessorGroup.pm @@ -136,6 +136,16 @@ sub make_group_wo_accessor { }; } +sub get_simple { + my ($self, $get) = @_; + return $self->{$get}; +} + +sub set_simple { + my ($self, $set, $val) = @_; + return $self->{$set} = $val; +} + 1; =back diff --git a/lib/DBIx/Class/InflateColumn.pm b/lib/DBIx/Class/InflateColumn.pm index 5c7f914..7a8a613 100644 --- a/lib/DBIx/Class/InflateColumn.pm +++ b/lib/DBIx/Class/InflateColumn.pm @@ -67,23 +67,12 @@ sub store_inflated_column { sub new { my ($class, $attrs, @rest) = @_; $attrs ||= {}; - my %deflated; foreach my $key (keys %$attrs) { - if (exists $class->_columns->{$key}{_inflate_info}) { - $deflated{$key} = $class->_deflated_column($key, - delete $attrs->{$key}); + if (ref $attrs->{$key} && exists $class->_columns->{$key}{_inflate_info}) { + $attrs->{$key} = $class->_deflated_column($key, $attrs->{$key}); } } - return $class->NEXT::ACTUAL::new({ %$attrs, %deflated }, @rest); + return $class->NEXT::ACTUAL::new($attrs, @rest); } -# **** B0RKEN. DOESN'T GET CALLED! -#sub _cond_value { -# my ($self, $attrs, $key, $value) = @_; -# if (exists $self->_columns->{$key}) { -# $value = $self->_deflated_column($key, $value); -# } -# return $self->NEXT::ACTUAL::_cond_value($attrs, $key, $value); -#} - 1; diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index cb4203f..9f01ded 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -33,7 +33,8 @@ sub new { if ($attrs) { $new->throw("attrs must be a hashref" ) unless ref($attrs) eq 'HASH'; while (my ($k, $v) = each %{$attrs}) { - $new->store_column($k => $v) if exists $class->_columns->{$k}; + die "No such column $k on $class" unless exists $class->_columns->{$k}; + $new->store_column($k => $v); } } return $new; @@ -251,7 +252,7 @@ sub _row_to_object { my ($class, $cols, $row) = @_; my %vals; $vals{$cols->[$_]} = $row->[$_] for 0 .. $#$cols; - my $new = $class->new(\%vals); + my $new = bless({ _column_data => \%vals }, ref $class || $class); $new->in_storage(1); return $new; } diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index e08fa7d..aabb975 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -93,16 +93,6 @@ sub new { return $new; } -sub get_simple { - my ($self, $get) = @_; - return $self->{$get}; -} - -sub set_simple { - my ($self, $set, $val) = @_; - return $self->{$set} = $val; -} - =head1 NAME DBIx::Class::Storage::DBI - DBI storage handler