DBIO
view release on metacpan or search on metacpan
lib/DBIO/ResultSet.pm view on Meta::CPAN
package DBIO::ResultSet;
# ABSTRACT: Lazy query object for fetching and manipulating DBIO rows
use strict;
use warnings;
use base qw/DBIO::Base/;
use DBIO::Carp;
use DBIO::ResultSetColumn;
use Scalar::Util qw/blessed weaken reftype/;
use DBIO::Util qw(
fail_on_internal_wantarray fail_on_internal_call UNRESOLVABLE_CONDITION
assert_no_internal_wantarray assert_no_internal_indirect_calls
help_url stresstest_utf8_upgrade_generated_collapser_source
);
use Try::Tiny;
BEGIN {
# De-duplication in _merge_attr() is disabled, but left in for reference
# (the merger is used for other things that ought not to be de-duped)
*__HM_DEDUP = sub () { 0 };
}
# FIXME - get rid of this
use Hash::Merge ();
use namespace::clean;
use overload
'0+' => "count",
'bool' => "_bool",
fallback => 1;
sub _bool () { 1 }
__PACKAGE__->mk_group_accessors('simple' => qw/_result_class result_source/);
sub new {
my $class = shift;
if (ref $class) {
assert_no_internal_indirect_calls and fail_on_internal_call;
return $class->new_result(@_);
}
my ($source, $attrs) = @_;
$source = $source->resolve
if $source->isa('DBIO::ResultSourceHandle');
$attrs = { %{$attrs||{}} };
delete @{$attrs}{qw(_last_sqlmaker_alias_map _simple_passthrough_construction)};
if ($attrs->{page}) {
$attrs->{rows} ||= 10;
}
$attrs->{alias} ||= 'me';
my $self = bless {
result_source => $source,
cond => $attrs->{where},
pager => undef,
attrs => $attrs,
}, $class;
# if there is a dark selector, this means we are already in a
# chain and the cleanup/sanification was taken care of by
# _search_rs already
$self->_normalize_selection($attrs)
( run in 1.128 second using v1.01-cache-2.11-cpan-995e09ba956 )