=cut
sub count_related {
- my $self = shift;
- return $self->search_related(@_)->count;
+ shift->search_related(@_)->count;
}
=head2 new_related
=cut
sub find_related {
- my $self = shift;
- my $rel = shift;
- return $self->search_related($rel)->find(@_);
+ #my ($self, $rel, @args) = @_;
+ return shift->search_related(shift)->find(@_);
}
=head2 find_or_new_related
=cut
sub update_or_create_related {
- my $self = shift;
- my $rel = shift;
- return $self->related_resultset($rel)->update_or_create(@_);
+ #my ($self, $rel, @args) = @_;
+ shift->related_resultset(shift)->update_or_create(@_);
}
=head2 set_from_related
=cut
sub cursor {
- my ($self) = @_;
-
- my $attrs = $self->_resolved_attrs_copy;
+ my $self = shift;
- return $self->{cursor}
- ||= $self->result_source->storage->select($attrs->{from}, $attrs->{select},
- $attrs->{where},$attrs);
+ return $self->{cursor} ||= do {
+ my $attrs = { %{$self->_resolved_attrs } };
+ $self->result_source->storage->select(
+ $attrs->{from}, $attrs->{select}, $attrs->{where}, $attrs
+ );
+ };
}
=head2 single
$self->throw_exception('single() only takes search conditions, no attributes. You want ->search( $cond, $attrs )->single()');
}
- my $attrs = $self->_resolved_attrs_copy;
+ my $attrs = { %{$self->_resolved_attrs} };
if (keys %{$attrs->{collapse}}) {
$self->throw_exception(
return $self->search(@_)->count if @_ and defined $_[0];
return scalar @{ $self->get_cache } if $self->get_cache;
- my $attrs = $self->_resolved_attrs_copy;
+ my $attrs = { %{ $self->_resolved_attrs } };
# this is a little optimization - it is faster to do the limit
# adjustments in software, instead of a subquery
return unless @$data;
if(defined wantarray) {
- my @created;
- foreach my $item (@$data) {
- push(@created, $self->create($item));
- }
+ my @created = map { $self->create($_) } @$data;
return wantarray ? @created : \@created;
}
else {
sub as_query {
my $self = shift;
- my $attrs = $self->_resolved_attrs_copy;
+ my $attrs = { %{ $self->_resolved_attrs } };
# For future use:
#
=cut
sub current_source_alias {
- my ($self) = @_;
-
- return ($self->{attrs} || {})->{alias} || 'me';
+ return (shift->{attrs} || {})->{alias} || 'me';
}
=head2 as_subselect_rs
return {%$attrs, from => $from, seen_join => $seen};
}
-# too many times we have to do $attrs = { %{$self->_resolved_attrs} }
-sub _resolved_attrs_copy {
- my $self = shift;
- return { %{$self->_resolved_attrs (@_)} };
-}
-
sub _resolved_attrs {
my $self = shift;
return $self->{_attrs} if $self->{_attrs};
=cut
sub relationship_info {
- my ($self, $rel) = @_;
- return $self->_relationships->{$rel};
+ #my ($self, $rel) = @_;
+ return shift->_relationships->{+shift};
}
=head2 has_relationship
=cut
sub has_relationship {
- my ($self, $rel) = @_;
- return exists $self->_relationships->{$rel};
+ #my ($self, $rel) = @_;
+ return exists shift->_relationships->{+shift};
}
=head2 reverse_relationship_info
=cut
sub class {
- my ($self, $source_name) = @_;
- return $self->source($source_name)->result_class;
+ return shift->source(shift)->result_class;
}
=head2 txn_do
sub populate {
my ($self, $name, $data) = @_;
- if(my $rs = $self->resultset($name)) {
- if(defined wantarray) {
- return $rs->populate($data);
- } else {
- $rs->populate($data);
- }
- } else {
- $self->throw_exception("$name is not a resultset");
- }
+ my $rs = $self->resultset($name)
+ or $self->throw_exception("'$name' is not a resultset");
+
+ return $rs->populate($data);
}
=head2 connection
sub _execute {
my $self = shift;
- my ($op) = @_;
my ($rv, $sth, @rest) = $self->next::method(@_);
$self->__last_insert_id($sth->{ix_sqlerrd}[1])
sub _execute {
my $self = shift;
- my ($op) = @_;
# always list ctx - we need the $sth
my ($rv, $sth, @bind) = $self->next::method(@_);
}
sub _dbh_execute {
- my ($self, $dbh, $sql, $bind) = @_;
+ #my ($self, $dbh, $sql, $bind, $ident) = @_;
+ my ($self, $bind) = @_[0,3];
- # Turn off sth caching for multi-part LOBs. See _prep_for_execute above.
+ # Turn off sth caching for multi-part LOBs. See _prep_for_execute below
local $self->{disable_sth_caching} = 1 if first {
($_->[0]{_ora_lob_autosplit_part}||0)
>
sub _prep_for_execute {
my $self = shift;
- my ($op, $ident) = @_;
+ my $ident = $_[1];
#
### This is commented out because all tests pass. However I am leaving it
### BTW it doesn't currently work exactly - need better sensitivity to
# currently set value
#
+ #my ($op, $ident) = @_;
+ #
# inherit these from the parent for the duration of _prep_for_execute
# Don't know how to make a localizing loop with if's, otherwise I would
#local $self->{_autoinc_supplied_for_op}
sub _execute {
my $self = shift;
- my ($op) = @_;
-
my ($rv, $sth, @bind) = $self->next::method(@_);
$self->_identity( ($sth->fetchall_arrayref)->[0][0] )