if $source->isa('DBIx::Class::ResultSourceHandle');
$attrs = { %{$attrs||{}} };
- delete @{$attrs}{qw(_related_results_construction)};
+ delete @{$attrs}{qw(_sqlmaker_select_args _related_results_construction)};
if ($attrs->{page}) {
$attrs->{rows} ||= 10;
my $self = shift;
return $self->{cursor} ||= do {
- my $attrs = { %{$self->_resolved_attrs } };
+ my $attrs = $self->_resolved_attrs;
$self->result_source->storage->select(
$attrs->{from}, $attrs->{select}, $attrs->{where}, $attrs
);
$attrs->{from}, $attrs->{select},
$attrs->{where}, $attrs
)];
+ $self->{_attrs}{_sqlmaker_select_args} = $attrs->{_sqlmaker_select_args};
return undef unless @$data;
$self->{_stashed_rows} = [ $data ];
$self->_construct_results->[0];
my $infmap = $attrs->{as};
-
$self->{_result_inflator}{is_core_row} = ( (
$inflator_cref
==
my $attrs = { %{ $self->_resolved_attrs } };
- $self->result_source->storage->_select_args_to_query (
+ my $aq = $self->result_source->storage->_select_args_to_query (
$attrs->{from}, $attrs->{select}, $attrs->{where}, $attrs
);
+
+ $self->{_attrs}{_sqlmaker_select_args} = $attrs->{_sqlmaker_select_args};
+
+ $aq;
}
=head2 find_or_new
}
sub _select_args {
- my ($self, $ident, $select, $where, $attrs) = @_;
+ my ($self, $ident, $select, $where, $orig_attrs) = @_;
+
+ return (
+ 'select', @{$orig_attrs->{_sqlmaker_select_args}}
+ ) if $orig_attrs->{_sqlmaker_select_args};
my $sql_maker = $self->sql_maker;
my $alias2source = $self->_resolve_ident_sources ($ident);
- $attrs = {
- %$attrs,
+ my $attrs = {
+ %$orig_attrs,
select => $select,
from => $ident,
where => $where,
# limit dialects use this stuff
# yes, some CDBICompat crap does not supply an {alias} >.<
- ( $attrs->{alias} and $alias2source->{$attrs->{alias}} )
- ? ( _rsroot_rsrc => $alias2source->{$attrs->{alias}} )
+ ( $orig_attrs->{alias} and $alias2source->{$orig_attrs->{alias}} )
+ ? ( _rsroot_rsrc => $alias2source->{$orig_attrs->{alias}} )
: ()
,
};
and
@$ident != 1
) {
- ($ident) = $self->_prune_unused_joins ($ident, $select, $where, $attrs);
+ ($ident, $attrs->{_aliastypes}) = $self->_prune_unused_joins ($ident, $select, $where, $attrs);
}
###
# invoked, and that's just bad...
###
- return ('select', $ident, $select, $where, $attrs, @limit_args);
+ return ( 'select', @{ $orig_attrs->{_sqlmaker_select_args} = [
+ $ident, $select, $where, $attrs, @limit_args
+ ]} );
}
# Returns a counting SELECT for a simple count