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