Branch Coverage

blib/lib/DBR/Config/SpecLoader.pm
Criterion Covered Total %
branch 48 102 47.0


line true false branch
36 0 17 unless $$self{'session'}
37 0 17 unless $$self{'conf_instance'}
46 0 17 unless my $dbrh = $$self{'conf_instance'}->connect
55 0 177 if ($$spec{'table'} =~ s/^(.*?)\.//)
59 0 708 unless $$spec{$_}
62 17 160 unless ($SCANS{$$spec{'schema'}}++)
64 0 17 unless my $scan_instance = $$self{'dbr'}->get_instance($$spec{'schema'})
73 0 17 unless $scanner->scan
76 0 177 unless my $schema = 'DBR::Config::Schema'->new('session', $$self{'session'}, 'handle', $$spec{'schema'})
77 0 177 unless my $table = $schema->get_table($$spec{'table'})
78 0 177 unless my $field = $table->get_field($$spec{'field'})
81 37 140 if (&Switch::case('TRANSLATOR'))
82 24 116 if (&Switch::case('RELATION'))
83 9 107 if (&Switch::case('REGEX'))
84 107 0 if (&Switch::case('ENUMOPT'))
85 0 0 if (&Switch::case('DEFAULT')) { }
94 0 17 unless 'DBR::Config::Schema'->load('session', $$self{'session'}, 'schema_id', $schema_id, 'instance', $$self{'conf_instance'})
109 0 37 unless my $transname = uc $$spec{'translator'}
110 0 37 unless my $new_trans = $trans_lookup{uc $transname}
112 0 37 unless $field->update_translator($transname)
121 0 9 unless $$spec{'regex'}
122 0 9 unless $field->update_regex($$spec{'regex'})
130 0 0 unless defined $$spec{'value'}
131 0 0 unless $field->update_default($$spec{'value'})
140 0 120 unless $$spec{$_}
146 0 24 if ($$spec{'reltable'} =~ s/^(.*?)\.//)
148 0 0 unless $toschema = 'DBR::Config::Schema'->new('session', $$self{'session'}, 'handle', $toschema_name)
152 0 24 unless my $totable = $toschema->get_table($$spec{'reltable'})
153 0 24 unless my $tofield = $totable->get_field($$spec{'relfield'})
155 0 24 unless my $type = $relationtype_lookup{uc $$spec{'type'}}
158 0 24 unless my $dbrh = $$self{'conf_instance'}->connect
169 0 24 unless defined $relationship
171 0 24 if ($relationship) { }
172 0 0 unless $dbrh->update(-'table', 'dbr_relationships', -'fields', {'from_field_id', ['d', $field->field_id], 'from_name', $$spec{'reverse_name'}, 'to_table_id', ['d', $totable->table_id], 'to_field_id', ['d', $tofield->field_id], 'type', ['d', $type_id]}, -'where', {'relationship_id', ['d', $$relationship{'relationship_id'}]})
186 0 24 unless $dbrh->insert(-'table', 'dbr_relationships', -'fields', {'from_table_id', ['d', $table->table_id], 'from_field_id', ['d', $field->field_id], 'from_name', $$spec{'reverse_name'}, 'to_field_id', ['d', $tofield->field_id], 'to_table_id', ['d', $totable->table_id], 'to_name', $$spec{'relname'}, 'type', ['d', $type_id]})
210 0 214 unless length $$spec{$_}
214 24 83 if (not length $$spec{'override_id'} or uc $$spec{'override_id'} eq 'NULL') { }
225 0 107 unless my $dbrh = $$self{'conf_instance'}->connect
233 0 107 unless defined $enum
237 0 107 if ($enum) { }
239 0 0 unless $dbrh->update(-'table', 'enum', -'fields', {'name', $$spec{'name'}}, -'where', {'enum_id', ['d', $$enum{'enum_id'}]}, -'single', 1)
255 0 0 unless defined $map
257 0 107 unless $enum_id = $dbrh->insert(-'table', 'enum', -'fields', {'handle', $$spec{'handle'}, 'override_id', $override, 'name', $$spec{'name'}})
269 0 107 if ($map) { }
270 0 0 unless $dbrh->update(-'table', 'enum_map', -'fields', {'sortval', ['d', $sortval]}, -'where', {'row_id', ['d', $$map{'row_id'}]})
276 0 107 unless $dbrh->insert(-'table', 'enum_map', -'fields', {'enum_id', ['d', $enum_id], 'field_id', ['d', $field->field_id], 'sortval', ['d', $sortval]})
293 0 17 unless open my $fh, "<$filename"
308 0 177 if $line =~ /^\s*\#/
311 0 177 unless @parts
317 1221 0 if (length $field)
321 177 0 if (%params)