1 package DBIx::Class::ResultSet;
10 my ($it_class, $db_class, $cursor, $args, $cols, $attrs) = @_;
11 #use Data::Dumper; warn Dumper(@_);
12 $it_class = ref $it_class if ref $it_class;
13 $attrs = { %{ $attrs || {} } };
15 $attrs->{bind} = $args;
16 $cursor = $db_class->storage->select($db_class->_table_name,$cols,
17 $attrs->{where},$attrs);
24 cond => $attrs->{where},
26 return bless ($new, $it_class);
30 my ($self, $min, $max) = @_;
31 my $attrs = { %{ $self->{attrs} || {} } };
32 $self->{class}->throw("Can't slice without where") unless $attrs->{where};
33 $attrs->{offset} = $min;
34 $attrs->{rows} = ($max ? ($max - $min + 1) : 1);
35 my $slice = $self->new($self->{class}, undef, $self->{args},
36 $self->{cols}, $attrs);
37 return (wantarray ? $slice->all : $slice);
42 my @row = $self->{cursor}->next;
44 return $self->{class}->_row_to_object($self->{cols}, \@row);
49 return $self->{attrs}{rows} if $self->{attrs}{rows};
50 return $self->{class}->count($self->{cond}, { bind => $self->{args} });
57 while (my $obj = $self->next) {
66 $self->{cursor}->reset;
71 return $_[0]->reset->next;
76 $_->delete for $self->all;