DBIx::Class::Cursor - Abstract object representing a query cursor on a


DBIx-Class documentation Contained in the DBIx-Class distribution.

Index


Code Index:

NAME

Top

DBIx::Class::Cursor - Abstract object representing a query cursor on a resultset.

SYNOPSIS

Top

  my $cursor = $schema->resultset('CD')->cursor();
  my $first_cd = $cursor->next;

DESCRIPTION

Top

A Cursor represents a query cursor on a DBIx::Class::ResultSet object. It allows for traversing the result set with next, retrieving all results with all and resetting the cursor with reset.

Usually, you would use the cursor methods built into DBIx::Class::ResultSet to traverse it. See next in DBIx::Class::ResultSet, reset in DBIx::Class::ResultSet and all in DBIx::Class::ResultSet for more information.

METHODS

Top

new

Virtual method. Returns a new DBIx::Class::Cursor object.

next

Virtual method. Advances the cursor to the next row. Returns an array of column values (the result of fetchrow_array in DBI method).

reset

Virtual method. Resets the cursor to the beginning.

all

Virtual method. Returns all rows in the DBIx::Class::ResultSet.


DBIx-Class documentation Contained in the DBIx-Class distribution.
package DBIx::Class::Cursor;

use strict;
use warnings;

use base qw/DBIx::Class/;

sub new {
  die "Virtual method!";
}

sub next {
  die "Virtual method!";
}

sub reset {
  die "Virtual method!";
}

sub all {
  my ($self) = @_;
  $self->reset;
  my @all;
  while (my @row = $self->next) {
    push(@all, \@row);
  }
  $self->reset;
  return @all;
}

1;