File Coverage

blib/lib/DBIx/DataModel/Schema/ResultAs/Flat_arrayref.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 28 28 100.0


line stmt bran cond sub pod time code
1             #----------------------------------------------------------------------
2             package DBIx::DataModel::Schema::ResultAs::Flat_arrayref;
3             #----------------------------------------------------------------------
4 3     3   4143 use warnings;
  3         10  
  3         310  
5 3     3   21 use strict;
  3         7  
  3         118  
6              
7 3     3   18 use parent 'DBIx::DataModel::Schema::ResultAs';
  3         8  
  3         25  
8              
9 3     3   283 use namespace::clean;
  3         7  
  3         33  
10              
11             sub get_result {
12 6     6 1 21 my ($self, $statement) = @_;
13              
14 6         34 $statement->execute;
15 6         28 $statement->make_fast;
16 6         13 my @vals;
17 6         22 my @headers = $statement->headers;
18 6         163 while (my $row = $statement->next) {
19 13         24 push @vals, @{$row}{@headers};
  13         49  
20             }
21 6         28 $statement->finish;
22              
23 6         286 return \@vals;
24             }
25              
26             # THINK : should we take a list of columns as arguments,
27             # i.e. -result_as => [flat_arrayref => ($col1, ...)], instead of taking
28             # ->headers ? Easy to implement, but it wouldn't really make sense,
29             # because the choice of columns is done in the -columns arg to
30             # select().
31              
32              
33              
34             1;
35              
36             __END__