Branch Coverage

blib/lib/DBIx/NinjaORM.pm
Criterion Covered Total %
branch 190 382 49.7


line true false branch
278 1 1 if (defined $self->id) { }
312 2 55 if not defined $field_name or $field_name eq ''
316 1 54 if substr($field_name, 0, 1) eq '_'
325 0 54 if $populated_by_retrieve_list and not exists $self->{$field_name}
428 1 59 unless Data::Validate::Type::is_hashref($_[1])
435 1 58 unless ref $self
443 0 56 unless defined $clean_data
449 0 56 unless defined $table_name
454 0 56 if not defined $primary_key_name and defined $args{'generated_primary_key_value'}
457 53 3 if ($self->get_info('has_created_field'))
460 2 51 defined $args{'overwrite_created'} && $args{'overwrite_created'} ne '' ? :
463 53 3 if $self->get_info('has_modified_field')
466 1 55 if defined $args{'generated_primary_key_value'}
469 0 56 defined $args{'ignore'} && $args{'ignore'} ? :
479 106 66 if ($key =~ /^(?:created|modified)$/x) { }
492 0 56 $ignore ? :
524 55 0 if (defined $primary_key_name)
527 1 54 defined $args{'generated_primary_key_value'} ? :
533 0 55 if defined $primary_key_name and not defined $clean_data->{$primary_key_name}
630 0 79 if defined $filters and not Data::Validate::Type::is_hashref($filters)
640 73 9 unless exists $filters->{$field}
645 0 9 unless defined $filters->{$field}
649 0 9 if defined $unique_field
657 9 70 if (defined $unique_field) { }
664 0 9 $args{'lock'} ? :
668 0 9 if ($objects_count == 0) { }
9 0 elsif ($objects_count == 1) { }
717 1 4 unless defined $table_name
721 1 3 unless defined $primary_key_name
724 1 2 unless defined $self->id
788 36 0 if defined $DBIx::NinjaORM::RETRIEVE_LIST_VALID_ARGUMENTS->{$arg}
805 26 0 if (defined $filtering_criteria)
807 0 26 unless $filtering_criteria->[0]
808 0 26 unless $filtering_criteria->[1]
815 4 22 if not $args{'allow_all'} || $filtering_field_keys_passed and scalar @$where_clauses == 0
819 16 1 $class->get_info('has_created_field') ? :
5 17 defined $args{'order_by'} && $args{'order_by'} ne '' ? :
831 20 2 scalar @$where_clauses != 0 ? :
836 0 22 defined $args{'limit'} && $args{'limit'} =~ /^\d+$/ ? :
841 0 22 if (defined $args{'exclude_fields'} or defined $args{'select_fields'}) { }
844 0 0 unless defined $table_schema
847 0 0 unless defined $column_names
851 0 0 if (defined $args{'exclude_fields'} and not defined $args{'select_fields'}) { }
0 0 elsif (not defined $args{'exclude_fields'} and defined $args{'select_fields'}) { }
857 0 0 $excluded_fields{$field} ? :
860 0 0 if scalar keys %excluded_fields != 0
867 0 0 if defined $primary_key_name and not $selected_fields{$primary_key_name}
871 0 0 unless $selected_fields{$field}
876 0 0 if scalar keys %selected_fields != 0
884 0 0 if scalar @filtered_fields == 0
898 2 20 if defined $args{'query_extensions'}{'joined_fields'}
906 1 21 if ($args{'lock'})
909 1 0 if ($database_type eq 'SQLite') { }
924 5 17 if (defined $args{'pagination'})
928 1 4 if not Data::Validate::Type::is_hashref($args{'pagination'}) and $args{'pagination'} eq '1'
932 3 2 ($args{'pagination'}{'per_page'} || '') =~ /^\d+$/ ? :
951 5 0 defined $count_data && scalar @$count_data != 0 ? :
962 0 3 $pagination_info->{'page_max'} < $args{'pagination'}{'page'} ? :
3 2 ($args{'pagination'}{'page'} || '') =~ /^\d+$/ && $args{'pagination'}{'page'} > 0 ? :
973 0 22 if ($lock ne '' and $joins ne '')
997 0 0 if $args{'show_queries'}
1022 0 0 if (not defined $locked_ids or scalar @$locked_ids == 0)
1057 0 22 if $args{'show_queries'}
1099 0 84 if defined $args{'exclude_fields'}
1104 0 84 if defined $args{'select_fields'}
1109 5 17 if (wantarray and defined $args{'pagination'}) { }
1153 1 66 unless Data::Validate::Type::is_hashref($_[1])
1160 5 61 unless $args{'force'}
1286 1 8 unless Data::Validate::Type::is_hashref($_[1])
1296 0 6 unless defined $clean_data
1301 5 1 if not $args{'skip_modified_update'} and $self->get_info('has_modified_field')
1304 0 6 if (scalar keys %$clean_data == 0)
1306 0 0 if $self->is_verbose
1315 0 6 unless defined $table_name
1320 0 6 if not defined $primary_key_name and defined $args{'generated_primary_key_value'}
1322 0 6 unless defined $self->id
1336 5 6 if ($key eq 'modified') { }
1350 0 6 if (defined $args{'set'})
1396 0 5 if $rows_updated_count < 0
1404 0 5 if (defined $object_cache_time)
1406 0 0 if $self->is_verbose
1449 3 3 unless exists $data->{$field}
1457 136 0 unless exists $data->{$field}
1468 1 7 if (defined $primary_key_name and defined $self->{$primary_key_name} and exists $data->{$primary_key_name})
1478 1 76 if substr($field, 0, 1) eq '_'
1529 1 5 if (scalar grep({$_ eq $field;} @protected_fields) != 0) { }
1 4 elsif (substr($field, 0, 1) eq '_') { }
2 2 elsif ($field eq 'id') { }
1539 1 1 if (defined $self->get_info('primary_key_name')) { }
1571 0 1 unless Data::Validate::Type::is_hashref($self)
1576 0 1 if not defined $class or $class eq ''
1579 0 1 unless $class->can('new')
1583 0 1 unless defined $self->get_info('primary_key_name')
1585 0 1 unless defined $self->id
1595 0 1 unless defined $fresh_object
1897 25 1 unless ($allow_subclassing)
1900 25 0 if (defined $subroutine)
1903 1 24 if $subroutine eq 'retrieve_list'
1911 4 21 defined $any_cache_time && !$args{'skip_cache'} && !$args{'lock'} ? :
1937 2 1 defined $cache_key_field ? :
2228 38 0 defined $primary_key_name ? :
2278 0 0 if (defined $specific_area) { }
2283 0 0 unless exists $cached_static_class_info->{$info_key}
2336 1 0 unless (defined $TABLE_SCHEMAS_CACHE->{$class})
2350 0 1 unless defined $TABLE_SCHEMAS_CACHE->{$class}
2370 0 0 if scalar keys %args != 0
2374 0 0 unless defined $key and $key =~ /\w/
2379 0 0 unless defined $memcache
2397 0 0 if scalar keys %args != 0
2401 0 0 unless defined $key and $key =~ /\w/
2406 0 0 unless defined $memcache
2433 0 0 unless defined $cache_key_field
2437 0 0 if (defined $unique_field) { }
2439 0 0 unless (defined $value)
2451 0 0 if $unique_field eq 'id'
2458 0 0 if (Data::Validate::Type::is_hashref($self)) { }
2463 0 0 unless (defined $value)
2488 0 0 if ($unique_field ne $cache_key_field) { }
2507 0 0 defined $cache_key_value && scalar @$cache_key_value != 0 ? :
2511 0 0 unless (defined $cache_key_value)
2513 0 0 if $self->is_verbose
2546 0 0 if (defined $primary_key_name)
2552 0 0 if defined $cache_key
2561 0 0 unless defined $self->{$field}
2567 0 0 if defined $cache_key
2602 0 0 unless defined $has_impact
2604 0 0 unless $has_impact
2620 0 0 unless exists $filters->{$field}
2634 0 0 unless (defined $search_field)
2639 0 0 if (defined $cache)
2648 0 0 if ($original_list_cache_key eq $list_cache_key)
2660 0 0 if (not $args{'lock'} and defined $list_of_search_values) { }
2662 0 0 if $class->is_verbose('cache_operations')
2670 0 0 $search_field eq 'id' ? :
2677 0 0 defined $object_cache_key ? :
2681 0 0 if (defined $object) { }
2683 0 0 if $class->is_verbose('cache_operations')
2690 0 0 $search_field eq 'id' ? :
2700 0 0 if $class->is_verbose('cache_operations')
2711 0 0 if (scalar keys %$objects_to_retrieve_from_database != 0)
2713 0 0 if $class->is_verbose('cache_operations')
2737 0 0 if ($list_cache_used)
2757 0 0 if $class->is_verbose('cache_operations')
2788 0 0 $cache_field eq 'id' ? :
2801 0 0 if exists $object->{'_excluded_fields'} or exists $object->{'_selected_fields'}
2803 0 0 $cache_field eq 'id' ? :
2810 0 0 unless defined $object_cache_key
2814 0 0 if $class->is_verbose('cache_operations')
2828 0 0 if (defined $list_of_search_values) { }
2835 0 0 if (exists $$cached_objects{lc $search_value}) { }
0 0 elsif (exists $$database_objects{lc $search_value}) { }
2861 0 0 if (wantarray and defined $args{'pagination'}) { }
2890 0 0 if scalar keys %args != 0
2894 0 0 unless defined $key and $key =~ /\w/
2896 0 0 unless defined $value
2901 0 0 unless defined $memcache
2903 0 0 unless $memcache->set($key, $value, $expire_time)
2939 3 155 if (defined $specific_dbh) { }
2950 2 156 if Data::Validate::Type::is_coderef($dbh)
2953 5 153 unless Data::Validate::Type::is_instance($dbh, 'class', 'DBI::db')
2986 0 48 if not defined $field or $field eq ''
2990 2 46 if ($operator eq 'between') { }
2 44 elsif ($operator eq 'null') { }
2 42 elsif ($operator eq 'not_null') { }
35 7 elsif (Data::Validate::Type::is_arrayref($values)) { }
2992 1 1 unless (defined $values and Data::Validate::Type::is_arrayref($values) and scalar @$values == 2)
3015 25 10 if ($operator eq '=') { }
2 8 elsif ($operator eq 'not') { }
2 6 elsif ($operator eq '>' or $operator eq '>=') { }
2 4 elsif ($operator eq '<' or $operator eq '<=') { }
2 2 elsif ($operator eq 'like') { }
2 0 elsif ($operator eq 'not_like') { }
3031 2 0 if (defined $max) { }
3046 2 0 if (defined $min) { }
3078 1 6 if $operator eq 'not'
3112 2 33 unless (Data::Validate::Type::is_hashref($filters))
3123 0 33 unless $class->get_filtering_fields
3127 33 0 if (defined $primary_key_name)
3138 29 1 if defined $filtering_fields->{$filter}
3151 0 32 unless defined $table_name
3169 1 28 unless defined $filters->{$field}
3171 1 27 if Data::Validate::Type::is_arrayref($filters->{$field}) and scalar @{$filters->{$field};} == 0
3178 0 19 $field =~ /\./ ? :
8 19 defined $primary_key_name && $field eq 'id' ? :
3187 7 20 Data::Validate::Type::is_arrayref($filters->{$field}) ? :
3192 3 83 if (Data::Validate::Type::is_hashref($block)) { }
3194 0 3 if (not defined $block->{'operator'}) { }
1 2 elsif (not $block->{'operator'} =~ /^(?:=|not|<=|>=|<|>|between|null|not_null|like|not_like)$/x) { }
0 2 elsif (not exists $block->{'value'} || $block->{'operator'} =~ /^(?:null|not_null)$/) { }
3221 24 2 if (scalar @scalar_values != 0)
3257 498 4 unless $field =~ /^(_[^_]+)_(.*)$/