line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package DBIx::DataModel::Schema::ResultAs::File_tabular; |
3
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
4
|
1
|
|
|
1
|
|
488
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp::Clan qw[^(DBIx::DataModel::|SQL::Abstract)]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
7
|
1
|
|
|
1
|
|
100
|
use File::Tabular; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use parent 'DBIx::DataModel::Schema::ResultAs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
78
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
1
|
|
|
1
|
0
|
2
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
3
|
my $self = {ft_args => \@_}; |
17
|
1
|
|
|
|
|
3
|
return bless $self, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub get_result { |
23
|
1
|
|
|
1
|
1
|
2
|
my ($self, $statement) = @_; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
4
|
$statement->execute; |
26
|
1
|
|
|
|
|
5
|
$statement->make_fast; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
3
|
my @headers = $statement->headers; |
29
|
1
|
|
|
|
|
20
|
my @ft_args = @{$self->{ft_args}}; |
|
1
|
|
|
|
|
15
|
|
30
|
1
|
50
|
33
|
|
|
9
|
push @ft_args, {} unless @ft_args && ref $ft_args[1]; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
4
|
$ft_args[-1]{headers} = [$statement->headers]; |
33
|
1
|
|
|
|
|
24
|
$ft_args[-1]{printHeaders} = 1; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
5
|
my $ft = File::Tabular->new(@ft_args); |
36
|
1
|
|
|
|
|
337
|
my $n_rows = 0; |
37
|
1
|
|
|
|
|
15
|
while (my $row = $statement->next) { |
38
|
3
|
|
|
|
|
12
|
$ft->append($row); |
39
|
3
|
|
|
|
|
229
|
$n_rows += 1; |
40
|
|
|
|
|
|
|
} |
41
|
1
|
|
|
|
|
7
|
$statement->finish; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
44
|
return $n_rows; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |