From: Peter Rabbitson Date: Thu, 8 Aug 2013 06:58:58 +0000 (+0200) Subject: Rename internal rsrc method to be more descriptive, stop proxying it X-Git-Tag: v0.08260~158 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56ad42bb48befbeb50953d197e7cb86bbc62686c;p=dbsrgits%2FDBIx-Class.git Rename internal rsrc method to be more descriptive, stop proxying it --- diff --git a/lib/DBIx/Class/PK.pm b/lib/DBIx/Class/PK.pm index e128e57..cb204b7 100644 --- a/lib/DBIx/Class/PK.pm +++ b/lib/DBIx/Class/PK.pm @@ -40,7 +40,7 @@ sub _ident_values { my (@ids, @missing); - for ($self->_pri_cols) { + for ($self->result_source->_pri_cols_or_die) { push @ids, ($use_storage_state and exists $self->{_column_data_in_storage}{$_}) ? $self->{_column_data_in_storage}{$_} : $self->get_column($_) @@ -113,7 +113,7 @@ sub _storage_ident_condition { sub _mk_ident_cond { my ($self, $alias, $use_storage_state) = @_; - my @pks = $self->_pri_cols; + my @pks = $self->result_source->_pri_cols_or_die; my @vals = $self->_ident_values($use_storage_state); my (%cond, @undef); diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index 4d889cc..c48e80f 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -64,7 +64,7 @@ sub add_relationship_accessor { # fixup the code a bit to make things saner, but ideally 'filter' needs to # be deprecated ASAP and removed shortly after # Not doing so before 0.08250 however, too many things in motion already - my ($pk_col, @rest) = $val->_pri_cols; + my ($pk_col, @rest) = $val->result_source->_pri_cols_or_die; $self->throw_exception( "Relationship '$rel' of type 'filter' can not work with a multicolumn primary key on source '$f_class'" ) if @rest; diff --git a/lib/DBIx/Class/Relationship/BelongsTo.pm b/lib/DBIx/Class/Relationship/BelongsTo.pm index 2d4793e..fbc78c1 100644 --- a/lib/DBIx/Class/Relationship/BelongsTo.pm +++ b/lib/DBIx/Class/Relationship/BelongsTo.pm @@ -26,7 +26,7 @@ sub belongs_to { # no join condition or just a column name if (!ref $cond) { $class->ensure_class_loaded($f_class); - my %f_primaries = map { $_ => 1 } try { $f_class->_pri_cols } + my %f_primaries = map { $_ => 1 } try { $f_class->result_source_instance->_pri_cols_or_die } catch { $class->throw_exception( "Can't infer join condition for '$rel' on ${class}: $_"); }; diff --git a/lib/DBIx/Class/Relationship/HasMany.pm b/lib/DBIx/Class/Relationship/HasMany.pm index c9d1777..bcf598c 100644 --- a/lib/DBIx/Class/Relationship/HasMany.pm +++ b/lib/DBIx/Class/Relationship/HasMany.pm @@ -16,7 +16,7 @@ sub has_many { unless (ref $cond) { $class->ensure_class_loaded($f_class); - my ($pri, $too_many) = try { $class->_pri_cols } + my ($pri, $too_many) = try { $class->result_source_instance->_pri_cols_or_die } catch { $class->throw_exception("Can't infer join condition for '$rel' on ${class}: $_"); }; diff --git a/lib/DBIx/Class/Relationship/HasOne.pm b/lib/DBIx/Class/Relationship/HasOne.pm index 09ea77c..1281905 100644 --- a/lib/DBIx/Class/Relationship/HasOne.pm +++ b/lib/DBIx/Class/Relationship/HasOne.pm @@ -66,7 +66,7 @@ sub _has_one { sub _get_primary_key { my ( $class, $target_class ) = @_; $target_class ||= $class; - my ($pri, $too_many) = try { $target_class->_pri_cols } + my ($pri, $too_many) = try { $target_class->result_source_instance->_pri_cols_or_die } catch { $class->throw_exception("Can't infer join condition on ${target_class}: $_"); }; diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 0a5e94b..6e8adcc 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -627,7 +627,7 @@ sub primary_columns { # a helper method that will automatically die with a descriptive message if # no pk is defined on the source in question. For internal use to save # on if @pks... boilerplate -sub _pri_cols { +sub _pri_cols_or_die { my $self = shift; my @pcols = $self->primary_columns or $self->throw_exception (sprintf( diff --git a/lib/DBIx/Class/ResultSourceProxy.pm b/lib/DBIx/Class/ResultSourceProxy.pm index 1f74eea..c3bef15 100644 --- a/lib/DBIx/Class/ResultSourceProxy.pm +++ b/lib/DBIx/Class/ResultSourceProxy.pm @@ -67,7 +67,6 @@ for my $method_to_proxy (qw/ set_primary_key primary_columns - _pri_cols sequence add_unique_constraint diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm index 3915eb2..d2ad389 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm @@ -748,7 +748,7 @@ sub _update_blobs { my ($self, $source, $blob_cols, $where) = @_; my @primary_cols = try - { $source->_pri_cols } + { $source->_pri_cols_or_die } catch { $self->throw_exception("Cannot update TEXT/IMAGE column(s): $_") }; @@ -783,7 +783,7 @@ sub _insert_blobs { my %row = %$row; my @primary_cols = try - { $source->_pri_cols } + { $source->_pri_cols_or_die } catch { $self->throw_exception("Cannot update TEXT/IMAGE column(s): $_") };