| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Teng::Plugin::SearchJoined::Iterator; |
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
21
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
|
6
|
1
|
|
|
|
|
10
|
new => 1, |
|
7
|
|
|
|
|
|
|
ro => [qw/teng sql table_names fields/], |
|
8
|
|
|
|
|
|
|
rw => [qw/sth suppress_object_creation/], |
|
9
|
1
|
|
|
1
|
|
904
|
); |
|
|
1
|
|
|
|
|
1199
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub next { |
|
12
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my $wantarray = wantarray; |
|
15
|
0
|
0
|
0
|
|
|
|
if (defined $wantarray && $wantarray == 0) { |
|
16
|
0
|
|
|
|
|
|
Carp::carp('calling `next` method in scalar context is deprecated and forbidden in future'); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $row; |
|
20
|
0
|
0
|
|
|
|
|
if ($self->{sth}) { |
|
21
|
0
|
|
|
|
|
|
$row = $self->{sth}->fetchrow_arrayref; |
|
22
|
0
|
0
|
|
|
|
|
unless ( $row ) { |
|
23
|
0
|
|
|
|
|
|
$self->{sth}->finish; |
|
24
|
0
|
|
|
|
|
|
$self->{sth} = undef; |
|
25
|
0
|
|
|
|
|
|
return; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
} else { |
|
28
|
0
|
|
|
|
|
|
return; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $data = $self->_seperate_rows($row); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ($self->{suppress_object_creation}) { |
|
34
|
0
|
|
|
|
|
|
return @$data{ @{$self->{table_names}} }; |
|
|
0
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} else { |
|
36
|
0
|
|
|
|
|
|
return map { $self->{teng}->new_row_from_hash($_, $data->{$_}, $self->{sql}) } @{$self->{table_names}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _seperate_rows { |
|
41
|
0
|
|
|
0
|
|
|
my ($self, $row) = @_; |
|
42
|
0
|
|
|
|
|
|
my %data; |
|
43
|
0
|
|
|
|
|
|
my $name_sep = quotemeta $self->{teng}{sql_builder}{name_sep}; |
|
44
|
0
|
|
|
|
|
|
my $i = 0; |
|
45
|
0
|
|
|
|
|
|
for my $field (@{ $self->{fields} }) { |
|
|
0
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $value = $row->[$i++]; |
|
47
|
0
|
|
|
|
|
|
my ($table, $column) = split /$name_sep/, $field; |
|
48
|
0
|
|
|
|
|
|
$data{$table}{$column} = $value; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
0
|
|
|
|
|
|
\%data; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
__END__ |