my $position_column = $self->position_column;
+ my $rsrc = $self->result_source;
+
my $is_txn;
- if ($is_txn = $self->result_source->schema->storage->transaction_depth) {
+ if ($is_txn = $rsrc->schema->storage->transaction_depth) {
# Reload position state from storage
# The thinking here is that if we are in a transaction, it is
# *more likely* the object went out of sync due to resultset
$self->store_column(
$position_column,
- ( $self->result_source
- ->resultset
+ ( $rsrc->resultset
->search($self->_storage_ident_condition, { rows => 1, columns => $position_column })
->cursor
->next
return 0;
}
- my $guard = $is_txn ? undef : $self->result_source->schema->txn_scope_guard;
+ my $guard = $is_txn ? undef : $rsrc->schema->txn_scope_guard;
my ($direction, @between);
if ( $from_position < $to_position ) {
my $new_pos_val = $self->_position_value ($to_position); # record this before the shift
# we need to null-position the moved row if the position column is part of a constraint
- if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $self->result_source->unique_constraints }} ) ) ) {
+ if (grep { $_ eq $position_column } ( map { @$_ } (values %{{ $rsrc->unique_constraints }} ) ) ) {
$self->_ordered_internal_update({ $position_column => $self->null_position_value });
}
return $self->{_relationship_data}{%1$s};
}
else {
- my $relcond = $self->result_source->_resolve_relationship_condition(
+ my $rsrc = $self->result_source;
+
+ my $relcond = $rsrc->_resolve_relationship_condition(
rel_name => %1$s,
foreign_alias => %1$s,
self_alias => 'me',
and
scalar grep { not defined $_ } values %%{ $relcond->{join_free_condition} || {} }
and
- $self->result_source->relationship_info(%1$s)->{attrs}{undef_on_null_fk}
+ $rsrc->relationship_info(%1$s)->{attrs}{undef_on_null_fk}
);
my $val = $self->search_related( %1$s )->single;
if (defined $constraint_name) {
$final_cond = $self->_qualify_cond_columns (
- $self->result_source->_minimal_valueset_satisfying_constraint(
+ $rsrc->_minimal_valueset_satisfying_constraint(
constraint_name => $constraint_name,
values => ($self->_merge_with_rscond($call_cond))[0],
carp_on_nulls => 1,
dbic_internal_try {
push @unique_queries, $self->_qualify_cond_columns(
- $self->result_source->_minimal_valueset_satisfying_constraint(
+ $rsrc->_minimal_valueset_satisfying_constraint(
constraint_name => $c_name,
values => ($self->_merge_with_rscond($call_cond))[0],
- columns_info => ($ci ||= $self->result_source->columns_info),
+ columns_info => ($ci ||= $rsrc->columns_info),
),
$alias
);
# FIXME - no cref handling
# At this point assume either hashes or arrays
+ my $rsrc = $self->result_source;
+
if(defined wantarray) {
my (@results, $guard);
# column names only, nothing to do
return if @$data == 1;
- $guard = $self->result_source->schema->storage->txn_scope_guard
+ $guard = $rsrc->schema->storage->txn_scope_guard
if @$data > 2;
@results = map
}
else {
- $guard = $self->result_source->schema->storage->txn_scope_guard
+ $guard = $rsrc->schema->storage->txn_scope_guard
if @$data > 1;
@results = map { $self->new_result($_)->insert } @$data;
# this means we have to walk the data structure twice
# whether we want this or not
# jnap, I hate you ;)
- my $rsrc = $self->result_source;
my $rel_info = { map { $_ => $rsrc->relationship_info($_) } $rsrc->relationships };
my ($colinfo, $colnames, $slices_with_rels);
my $existing;
# if there are no keys - nothing to search for
- if (keys %$them and $existing = $self->result_source
- ->related_source($rel_name)
+ if (keys %$them and $existing = $rsrc->related_source($rel_name)
->resultset
->find($them)
) {
sub _is_column_numeric {
my ($self, $column) = @_;
- return undef unless $self->result_source->has_column($column);
+ my $rsrc;
- my $colinfo = $self->result_source->column_info ($column);
+ return undef
+ unless ( $rsrc = $self->result_source )->has_column($column);
+
+ my $colinfo = $rsrc->column_info ($column);
# cache for speed (the object may *not* have a resultsource instance)
if (
! defined $colinfo->{is_numeric}
and
- my $storage = dbic_internal_try { $self->result_source->schema->storage }
+ my $storage = dbic_internal_try { $rsrc->schema->storage }
) {
$colinfo->{is_numeric} =
$storage->is_datatype_numeric ($colinfo->{data_type})