Branch Coverage

blib/lib/EV/ClickHouse.pm
Criterion Covered Total %
branch 0 418 0.0


line true false branch
39 0 0 unless defined $qs and length $qs
42 0 0 unless defined $k and length $k
43 0 0 defined $v ? :
52 0 0 if (my $uri = delete $args{'uri'})
53 0 0 if ($uri =~ m(^clickhouse(?:\+(\w+))?://(?:([^:\@]*?)(?::([^\@]*))?\@)?(\[[^\]]+\]|[^/:?]+)(?::(\d+))?(?:/([^?]*))?(?:\?(.*))?$)) { }
56 0 0 if $proto
57 0 0 if defined $u and $u ne ""
58 0 0 if defined $pw
60 0 0 if defined $p
61 0 0 if defined $db and $db ne ""
76 0 0 if (my $h = delete $args{'hosts'})
77 0 0 unless ref $h eq "ARRAY" and @$h
80 0 0 unless (defined $args{'host'})
91 0 0 exists $args{'on_error'} ? :
93 0 0 if (my $cb = delete $args{'on_failover'})
95 0 0 if exists $args{$h}
105 0 0 unless $protocol eq "http" or $protocol eq "native"
108 0 0 $protocol eq 'native' ? :
110 0 0 $protocol eq 'native' ? :
122 0 0 unless exists $args{$opt}
128 0 0 unless defined(my $val = delete $args{$opt})
138 0 0 if (defined $qlc and length $qlc)
141 0 0 !ref($qlc) && "$qlc" ne '1' ? :
151 0 0 delete $args{'decode_datetime'} ? :
0 0 delete $args{'decode_decimal'} ? :
0 0 delete $args{'decode_enum'} ? :
0 0 delete $args{'named_rows'} ? :
152 0 0 if $decode_flags
154 0 0 if (my $settings = delete $args{'settings'})
156 0 0 if %args
159 0 0 if ($hosts_list)
169 0 0 if (not $host =~ /^[\d.]+$|^\[?[0-9a-fA-F:]+\]?$/ and eval { do { require EV::cares; 1 } }) { }
192 0 0 unless $weak2 and $weak2->_take_dns_pending
193 0 0 if ($status != 0 or not @addrs)
199 0 0 unless eval { do { $weak2->on_error->("DNS resolution failed for '${host}'"); 1 } }
215 0 0 if ($entry =~ /^\[([^\]]+)\](?::(\d+))?$/)
218 0 0 if ($entry =~ /^([^:]+):(\d+)$/)
242 0 0 $settings ? :
247 0 0 if $err
273 0 0 unless defined $table and ref $producer eq "CODE" and ref $cb eq "CODE"
281 0 0 if (my $err = $s->sticky_error)
291 0 0 if $hi and $s->buffered_count >= $hi
293 0 0 if (defined $row) { }
317 0 0 unless defined $table and defined $data and ref $cb eq "CODE"
319 0 0 exists $opts{'wait_for_flush'} ? :
321 0 0 $wait ? :
337 0 0 if ref $cb ne "CODE"
338 0 0 if ref $rows ne "ARRAY" or not @$rows
341 0 0 if ref $key_cols ne "ARRAY"
344 0 0 unless @agg
345 0 0 unless $table =~ /$RE_TABLE/
348 0 0 unless $c =~ /$RE_IDENT/
356 0 0 unless $func =~ /$RE_IDENT/
359 0 0 unless $t =~ /\A[A-Za-z0-9_(),\s]+\z/
367 0 0 if @$r != $expected_cols
398 0 0 unless defined $v
399 0 0 if ref $v
401 0 0 if $v =~ /\A-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?\z/
410 0 0 unless defined $query_id and ref $cb eq "CODE"
412 0 0 unless $query_id =~ /\A[A-Za-z0-9_\-]+\z/
414 0 0 $opts{'async'} ? :
430 0 0 if ${^GLOBAL_PHASE} eq "DESTRUCT"
439 0 0 if ($size == 0)
440 0 0 if (my $st = delete $DUR_STATE{$key})
446 0 0 if (not $st) { }
459 0 0 if ($ring)
461 0 0 if (defined $dur and $dur >= 0)
462 0 0 if (@{$ring->{'buf'};} < $ring->{'size'}) { }
470 0 0 if $prev
478 0 0 if (@$buf >= $st->{'size'})
496 0 0 unless my $st = $DUR_STATE{builtin::refaddr($self)}
498 0 0 unless @s
499 0 0 if $p < 0
500 0 0 if $p > 1
505 0 0 unless my $st = $DUR_STATE{builtin::refaddr($_[0])}
516 0 0 unless defined $query_id and length $query_id
518 0 0 unless defined $cur and $cur eq $query_id
539 0 0 if ref $cb ne "CODE"
548 0 0 if (not $err or $attempt > $tries or not "EV::ClickHouse"->is_retryable_error($self->last_error_code))
554 0 0 if $jitter > 0
561 0 0 if ($settings) { }
565 0 0 if (not $ok)
579 0 0 unless defined $table and ref $cb eq "CODE"
580 0 0 unless $table =~ /$RE_TABLE/
585 0 0 unless $self->server_revision
588 0 0 if $err
594 0 0 ref $_ eq 'HASH' ? :
605 0 0 unless defined $table and defined $column and ref $cb eq "CODE"
607 0 0 unless $table =~ /$RE_TABLE/
609 0 0 unless $column =~ /$RE_IDENT/
618 0 0 unless $self->server_revision
621 0 0 if $err
627 0 0 ref $_ eq 'HASH' ? :
638 0 0 unless ref $cb eq "CODE"
642 0 0 if $done
647 0 0 if $done
661 0 0 unless ref $cb eq "CODE"
665 0 0 if $err
677 0 0 unless defined $threshold and ref $cb eq "CODE"
683 0 0 if defined $dur and $dur >= $threshold
684 0 0 if $prev
694 0 0 unless defined $name and ref $cb eq "CODE"
696 0 0 unless $name =~ /$RE_IDENT/
703 0 0 if $err
704 0 0 $rows && @$rows ? :
715 0 0 if ref $where eq "CODE"
716 0 0 unless defined $table and ref $cb eq "CODE"
718 0 0 unless $table =~ /$RE_TABLE/
721 0 0 if defined $where and length $where
724 0 0 if $err
725 0 0 $rows && @$rows ? :
733 0 0 unless defined $table and ref $cb eq "CODE"
735 0 0 unless $table =~ /$RE_TABLE/
736 0 0 $table =~ /\./ ? :
738 0 0 defined $db ? :
749 0 0 if $err
750 0 0 $rows && @$rows ? :
756 0 0 defined $db ? :
762 0 0 unless defined $name and ref $cb eq "CODE"
764 0 0 unless $name =~ /$RE_TABLE/
772 0 0 unless defined $name and ref $cb eq "CODE"
774 0 0 unless $name =~ /$RE_TABLE/
788 0 0 unless defined $table and ref $cb eq "CODE"
790 0 0 unless $table =~ /$RE_TABLE/
794 0 0 $table =~ /\./ ? :
798 0 0 defined $db ? :
0 0 defined $mid ? :
805 0 0 if defined $db
806 0 0 if defined $mid
818 0 0 if ($err)
819 0 0 $rows && @$rows ? :
824 0 0 if (defined $fail and length $fail) { }
825 0 0 if (++$fail_streak >= 2)
832 0 0 unless ($pending)
836 0 0 if (defined $timeout and &EV::time() - $started >= $timeout)
845 0 0 if (not $ok)
860 0 0 unless defined $uri
861 0 0 unless $uri =~ m( ^clickhouse(?:\+(\w+))?:// (?:([^:\@]*?)(?::([^\@]*))?\@)? (\[[^\]]+\]|[^/:?]+) (?::(\d+))? (?:/([^?]*))? (?:\?(.*))?$ )x
873 0 0 if defined $proto
874 0 0 if defined $user and $user ne ""
875 0 0 if defined $pass
876 0 0 if defined $port
877 0 0 if defined $db and $db ne ""
908 0 0 unless defined $code
909 0 0 $RETRYABLE{$code + 0} ? :
919 0 0 unless defined $name and length $name
923 0 0 if grep {not length $_;} @parts
925 0 0 unless $p =~ /$RE_IDENT/
946 0 0 unless ref $self
947 0 0 unless defined $feature
949 0 0 unless defined $required
950 0 0 unless my $have = $self->server_revision
963 0 0 if defined $columns and ref $columns ne 'ARRAY' || !@$columns
980 0 0 defined $opts{'low_water'} ? :
995 0 0 if $self->{'in_flight'} or not @{$self->{'buffer'};}
1002 0 0 if ($err)
1011 0 0 if $self->{'high_water_active'} and @{$self->{'buffer'};} < $self->{'high_water'}
1017 0 0 if (not $self->{'in_flight'} and @{$self->{'drain_waiters'};} and @{$self->{'buffer'};} <= ($low || 0))
1025 0 0 if ($self->{'pending_finish'} and not $self->{'in_flight'} and not @{$self->{'buffer'};})
1032 0 0 $self->{'settings'} ? :
1038 0 0 unless ref $cb eq "CODE"
1040 0 0 if (not $self->{'in_flight'} || @{$self->{'buffer'};}) { }
1060 0 0 unless ref $cb eq "CODE"
1065 0 0 if not $self->{'in_flight'} and @{$self->{'buffer'};} <= $low
1084 0 0 unless delete $self->{'drain_waiters'}
1086 0 0 if $pf
1098 0 0 unless ref $cb eq "CODE"
1101 0 0 if $err
1124 0 0 if $size < 1
1154 0 0 if builtin::refaddr($self->{'conns'}[$i]) == $r
1166 0 0 unless $self->{'cb_thresh'} and ref $user_cb eq "CODE"
1167 0 0 ref $ch ? :
1168 0 0 unless $slot
1175 0 0 if $observe_failures or not $_[1]
1187 0 0 if ref $rest[-1] eq "CODE"
1204 0 0 if $idx < 0 or $idx >= @{$self->{'conns'};}
1206 0 0 if ref $rest[-1] eq "CODE"
1217 0 0 if $idx < 0 or $idx >= @{$self->{'conns'};}
1234 0 0 unless ref $cb eq "CODE"
1235 0 0 if %opts
1238 0 0 unless @c
1247 0 0 if $all_dead
1248 0 0 if $hedge_n > @alive
1249 0 0 if $hedge_n < 1
1262 0 0 if $fired
1263 0 0 unless ($err)
1271 0 0 if (not $pending)
1279 0 0 if ($settings) { }
1307 0 0 unless ref $cb eq "CODE"
1325 0 0 unless ref $cb eq "CODE"
1327 0 0 unless @c
1330 0 0 unless --$left
1335 0 0 if ($self->{'cb_thresh'} and $self->{'cb_state'}[$i]{'dead_until'} > $now)
1349 0 0 if ($settings) { }
1352 0 0 unless (eval { do { if ($settings) { $ch->query($sql, $settings, $obs); } else { $ch->query($sql, $obs); } ; 1 } })
1367 0 0 unless ref $cb eq "CODE"
1373 0 0 if $released++
1374 0 0 if (--$self->{'_pinned'}{$r} <= 0)
1376 0 0 unless (eval { do { &$cb($ch, $release); 1 } })
1391 0 0 if $_[0]
1392 0 0 unless --$left
1414 0 0 if ref $grace eq "CODE"
1416 0 0 unless ref $cb eq "CODE"
1422 0 0 if $fired++
1429 0 0 if $_[0]
1430 0 0 if --$left == 0
1433 0 0 if ($grace and $grace > 0)
1455 0 0 if $_[0]{'done'}
1519 0 0 unless defined $err and length $err