DBIx/Class/Cursor.pm

filter: Statementstmt 85.0% 17 / 20 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 4 / 4 totaltotal 81.8% 27 / 33 CC 2 SCAR 4.9
CC
2
Cov
86%
new
2.0
next
2.0
reset
2.0
CRAP 1.6
« DBIx/Class/Storage/DBI/Replicated.pm ↑ Summary DBIx/Class.pm »
1 package DBIx::Class::Cursor;
2  
3 139 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 139 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 139 ▶use base qw/DBIx::Class/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 DBIx::Class::Cursor - Abstract object representing a query cursor on a
11 resultset.
12  
13 =head1 SYNOPSIS
14  
15 my $cursor = $schema->resultset('CD')->cursor();
16  
17 # raw values off the database handle in resultset columns/select order
18 my @next_cd_column_values = $cursor->next;
19  
20 # list of all raw values as arrayrefs
21 my @all_cds_column_values = $cursor->all;
22  
23 =head1 DESCRIPTION
24  
25 A Cursor represents a query cursor on a L<DBIx::Class::ResultSet> object. It
26 allows for traversing the result set with L</next>, retrieving all results with
27 L</all> and resetting the cursor with L</reset>.
28  
29 Usually, you would use the cursor methods built into L<DBIx::Class::ResultSet>
30 to traverse it. See L<DBIx::Class::ResultSet/next>,
31 L<DBIx::Class::ResultSet/reset> and L<DBIx::Class::ResultSet/all> for more
32 information.
33  
34 =head1 METHODS
35  
36 =head2 new
37  
38 Virtual method. Returns a new L<DBIx::Class::Cursor> object.
39  
40 =cut
41  
42 sub new {
43 0 ▶ die "Virtual method!";
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
44 }
45  
46 =head2 next
47  
48 Virtual method. Advances the cursor to the next row. Returns an array of
49 column values (the result of L<DBI/fetchrow_array> method).
50  
51 =cut
52  
53 sub next {
54 0 ▶ die "Virtual method!";
Subroutine next: not called CC=1 SCAR=6.9
Pod documented
55 }
56  
57 =head2 reset
58  
59 Virtual method. Resets the cursor to the beginning.
60  
61 =cut
62  
63 sub reset {
64 0 ▶ die "Virtual method!";
Subroutine reset: not called CC=1 SCAR=6.9
Pod documented
65 }
66  
67 =head2 all
68  
69 Virtual method. Returns all rows in the L<DBIx::Class::ResultSet>.
70  
71 =cut
72  
73 sub all {
74 1 ▶ my ($self) = @_;
Subroutine all: called CC=2 SCAR=6.9
Pod documented
75 1 $self->reset;
76 1 my @all;
77 1 ▶ while (my @row = $self->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@row) = $self->next) 2 1 3
78 2 push(@all, \@row);
79 }
80 1 $self->reset;
81 1 return @all;
82 }
83  
84 139 1;
« DBIx/Class/Storage/DBI/Replicated.pm ↑ Summary DBIx/Class.pm »