| Alzabo documentation | Contained in the Alzabo distribution. |
Alzabo::Runtime::Cursor - Base class for Alzabo cursors
use Alzabo::Runtime::Cursor;
This is the base class for cursors.
Virtual method.
Virtual method.
Resets the cursor so that the next next call will return the first
row of the set.
Returns the number of rows returned by the cursor so far.
Returns the next row or rows in a hash, where the hash key is the table name and the hash value is the row object.
Dave Rolsky, <autarch@urth.org>
| Alzabo documentation | Contained in the Alzabo distribution. |
package Alzabo::Runtime::Cursor; use strict; use vars qw($VERSION); use Alzabo::Runtime; $VERSION = 2.0; 1; sub new { shift->_virtual; } sub next { shift->_virtual; } sub all_rows { shift->_virtual; } sub _virtual { my $self = shift; my $sub = (caller(1))[3]; Alzabo::Exception::VirtualMethod->throw ( error => "$sub is a virtual method and must be subclassed in " . ref $self ); } sub reset { my $self = shift; $self->{statement}->execute( $self->{statement}->bind ); $self->{count} = 0; } sub count { my $self = shift; return $self->{count}; } sub next_as_hash { my $self = shift; my @next = $self->next or return; return map { defined $_ ? ( $_->table->name => $_ ) : () } @next; } __END__