1 package # hide from PAUSE
2 DBIx::Class::Storage::DBI::Cursor;
4 use base qw/DBIx::Class::Cursor/;
10 my ($class, $storage, $args, $attrs) = @_;
11 #use Data::Dumper; warn Dumper(@_);
12 $class = ref $class if ref $class;
21 $new->{tid} = threads->tid if $INC{'threads.pm'};
23 return bless ($new, $class);
29 $self->_check_forks_threads;
30 if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) {
31 $self->{sth}->finish if $self->{sth}->{Active};
35 return if $self->{done};
36 unless ($self->{sth}) {
37 $self->{sth} = ($self->{storage}->_select(@{$self->{args}}))[1];
38 if ($self->{attrs}{software_limit}) {
39 if (my $offset = $self->{attrs}{offset}) {
40 $self->{sth}->fetch for 1 .. $offset;
44 my @row = $self->{sth}->fetchrow_array;
57 $self->_check_forks_threads;
58 return $self->SUPER::all if $self->{attrs}{rows};
59 $self->{sth}->finish if $self->{sth}->{Active};
61 my ($rv, $sth) = $self->{storage}->_select(@{$self->{args}});
62 return @{$sth->fetchall_arrayref};
68 $self->_check_forks_threads;
69 $self->{sth}->finish if $self->{sth}->{Active};
82 sub _check_forks_threads {
85 if($INC{'threads.pm'} && $self->{tid} != threads->tid) {
87 $self->{tid} = threads->tid;
90 if($self->{pid} != $$) {
99 $self->_check_forks_threads;
100 $self->{sth}->finish if $self->{sth}->{Active};