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   2829 use warnings;
  3         9  
  3         147  
5 3     3   24 use strict;
  3         7  
  3         95  
6              
7 3     3   17 use parent 'DBIx::DataModel::Schema::ResultAs';
  3         7  
  3         19  
8              
9 3     3   210 use namespace::clean;
  3         7  
  3         46  
10              
11             sub get_result {
12 6     6 1 24 my ($self, $statement) = @_;
13              
14 6         27 $statement->execute;
15 6         34 $statement->make_fast;
16 6         14 my @vals;
17 6         27 my @headers = $statement->headers;
18 6         157 while (my $row = $statement->next) {
19 13         24 push @vals, @{$row}{@headers};
  13         66  
20             }
21 6         35 $statement->finish;
22              
23 6         246 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__