| 1 | # Copyright (C) 2021-2022 Horimoto Yasuhiro <horimoto@clear-code.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | package Groonga::Commands::Select; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | my $groonga_http_client = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | my $command_args = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | my $n_hits = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | my @records; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | my $use_drilldown = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | my $n_drilldown_keys = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | my @select_arguments = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 'table', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 'output_columns', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 'query', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 'filter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 'columns', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 'sort_keys', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 'limit', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'synonym', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 'drilldown', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'drilldown_filter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'drilldown_output_columns', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 'drilldown_sort_keys', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 'dynamic_columns', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 'match_columns', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 'query_expander', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 'post_filter' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $self = {%args}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | $groonga_http_client = $self->{client}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $command_args = _parse_arguments($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub _is_valid_arguments { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_valid_arguments: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | while (my ($key, $value) = each %{$args}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | if ($key eq 'client') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if (!(grep {$_ eq $key} @select_arguments)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | croak "Invalid arguments: ${key}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub _parse_arguments { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_arguments: not called CC=24 SCAR=64.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my %parsed_arguments = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | _is_valid_arguments($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if (exists($args->{'table'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $parsed_arguments{'table'} = $args->{'table'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if (exists($args->{'output_columns'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $parsed_output_columns = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $output_columns = $args->{'output_columns'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | foreach my $output_column (@$output_columns) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $parsed_output_columns .= $output_column . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | chop($parsed_output_columns); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $parsed_arguments{'output_columns'} = $parsed_output_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if (exists($args->{'query'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $parsed_arguments{'query'} = $args->{'query'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if (exists($args->{'filter'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $parsed_arguments{'filter'} = $args->{'filter'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if (exists($args->{'columns'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $parsed_arguments{'match_columns'} = $args->{'columns'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if (exists($args->{'sort_keys'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $parsed_arguments{'sort_keys'} = $args->{'sort_keys'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | if (exists($args->{'limit'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $parsed_arguments{'limit'} = $args->{'limit'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if (exists($args->{'synonym'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $parsed_arguments{'query_expander'} = $args->{'synonym'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if (exists($args->{'drilldown'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $use_drilldown = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $n_drilldown_keys = split(/,/, $args->{'drilldown'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $parsed_arguments{'drilldown'} = $args->{'drilldown'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if (exists($args->{'drilldown_filter'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $use_drilldown = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $parsed_arguments{'drilldown_filter'} = $args->{'drilldown_filter'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if (exists($args->{'drilldown_output_columns'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $use_drilldown = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $parsed_arguments{'drilldown_output_columns'} = $args->{'drilldown_output_columns'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if (exists($args->{'drilldown_sort_keys'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | $use_drilldown = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $parsed_arguments{'drilldown_sort_keys'} = $args->{'drilldown_sort_keys'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if (exists($args->{'dynamic_columns'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $dynamic_columns = $args->{'dynamic_columns'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | for (my $i = 0; $i < scalar(@$dynamic_columns); $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if (exists($dynamic_columns->[$i]->{'name'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
exists $dynamic_columns->[$i]{"name"} and exists $dynamic_columns->[$i]{"stage"} and exists $dynamic_columns->[$i]{"type"} and exists $dynamic_columns->[$i]{"value"}
exists $dynamic_columns->[$i]{"name"} and exists $dynamic_columns->[$i]{"stage"} and exists $dynamic_columns->[$i]{"type"}
exists $dynamic_columns->[$i]{"name"} and exists $dynamic_columns->[$i]{"stage"}
MC/DC0%0/4
exists $dynamic_columns->[$i]{"name"} and exists $dynamic_columns->[$i]{"stage"} and exists $dynamic_columns->[$i]{"type"} and exists $dynamic_columns->[$i]{"value"}
exists $dynamic_columns->[$i]{"name"}
exists $dynamic_columns->[$i]{"stage"}
exists $dynamic_columns->[$i]{"type"}
exists $dynamic_columns->[$i]{"value"}
Truth table0%0/5
A and B and C and D
A= exists $dynamic_columns->[$i]{"name"}B= exists $dynamic_columns->[$i]{"stage"}C= exists $dynamic_columns->[$i]{"type"}D= exists $dynamic_columns->[$i]{"value"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | && exists($dynamic_columns->[$i]->{'stage'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | && exists($dynamic_columns->[$i]->{'type'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | && exists($dynamic_columns->[$i]->{'value'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | croak "Missing required argument"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $name = $dynamic_columns->[$i]->{'name'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | $parsed_arguments{'columns[' . $name . '].stage'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $dynamic_columns->[$i]->{'stage'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | $parsed_arguments{'columns[' . $name . '].type'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $dynamic_columns->[$i]->{'type'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | $parsed_arguments{'columns[' . $name . '].value'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $dynamic_columns->[$i]->{'value'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if (exists($dynamic_columns->[$i]->{'flags'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $parsed_arguments{'columns[' . $name . '].flags'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $dynamic_columns->[$i]->{'flags'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if (exists($args->{'match_columns'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $parsed_arguments{'match_columns'} = $args->{'match_columns'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if (exists($args->{'query_expander'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $parsed_arguments{'query_expander'} = $args->{'query_expander'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if (exists($args->{'post_filter'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $parsed_arguments{'post_filter'} = $args->{'post_filter'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return \%parsed_arguments; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub _parse_result { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_result: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $result = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my %result_set = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my @records = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my @drilldown_result_records = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($use_drilldown) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ($n_drilldown_keys > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my @n_hits_drilldown = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | for (my $n_keys = 0; $n_keys < $n_drilldown_keys; $n_keys++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | push(@n_hits_drilldown, $result->[$n_keys+1][0][0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my @column_names_drilldown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | for (my $i = 0; $result->[$n_keys+1][1][$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | push(@column_names_drilldown, $result->[$n_keys+1][1][$i][0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my @temporary = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | for (my $i = 0, my $j = 2; $i < $n_hits_drilldown[$n_keys]; $i++, $j++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my %record = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | for (my $k=0; $k < @column_names_drilldown; $k++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $record{"drilldown_" . $column_names_drilldown[$k]} = "$result->[$n_keys+1][$j][$k]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | push(@temporary, \%record); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $drilldown_result_records[$n_keys] = \@temporary; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $result_set{'n_hits_drilldown'} = \@n_hits_drilldown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $result_set{'n_hits_drilldown'} = ($result->[1][0][0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my @column_names_drilldown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | for (my $i = 0; $result->[1][1][$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | push(@column_names_drilldown, $result->[1][1][$i][0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | for (my $i = 0, my $j = 2; $i < $result_set{'n_hits_drilldown'}; $i++, $j++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my %record = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | for (my $k=0; $k < @column_names_drilldown; $k++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $record{"drilldown_" . $column_names_drilldown[$k]} = "$result->[1][$j][$k]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | push(@drilldown_result_records, \%record); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $use_drilldown = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $result_set{'n_hits'} = $result->[0][0][0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my @column_names; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | for (my $i = 0; $result->[0][1][$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | push(@column_names, $result->[0][1][$i][0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | for (my $i = 0, my $j = 2; $i < $result_set{'n_hits'}; $i++, $j++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my %record = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | for (my $k=0; $k < @column_names; $k++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $record{"$column_names[$k]"} = $result->[0][$j][$k]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | push(@records, \%record); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $result_set{'records'} = \@records; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $result_set{'drilldown_result_records'} = \@drilldown_result_records; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return \%result_set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | if (defined $groonga_http_client) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | return _parse_result($groonga_http_client->send('select', $command_args)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||