Branch Coverage

blib/lib/App/SpamcupNG/Summary/Recorder.pm
Criterion Covered Total %
branch 21 36 58.3


line true false branch
48 0 2 unless $self->{'dbh'} = "DBI"->connect("dbi:SQLite:dbname=" . $file, "", "")
69 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS email_content_type (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL UNIQUE\n)\n ")
78 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS spam_age_unit (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL UNIQUE\n)\n ")
87 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS email_charset (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL UNIQUE\n)\n ")
96 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS receiver (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n email TEXT NOT NULL UNIQUE\n)\n ")
105 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS mailer (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL UNIQUE\n)\n ")
120 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS summary (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n tracking_id TEXT NOT NULL UNIQUE,\n created INTEGER NOT NULL,\n charset_id INTEGER REFERENCES email_charset ON DELETE SET NULL,\n content_type_id INTEGER REFERENCES email_content_type ON DELETE SET NULL,\n age INTEGER NOT NULL,\n age_unit_id INTEGER REFERENCES spam_age_unit ON DELETE SET NULL,\n mailer_id INTEGER REFERENCES mailer ON DELETE SET NULL\n)\n ")
131 0 2 unless $self->{'dbh'}->do("\nCREATE TABLE IF NOT EXISTS summary_receiver (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n summary_id INTEGER REFERENCES summary ON DELETE CASCADE,\n receiver_id INTEGER REFERENCES receiver ON DELETE CASCADE,\n report_id TEXT UNIQUE\n)\n ")
147 0 2 unless $ref eq $summary_class
181 0 4 unless $self->{'dbh'}->do("\nINSERT INTO summary_receiver (summary_id, receiver_id, report_id)\nVALUES(?, ?, ?)\n ", undef, @values)
186 1 1 $self->{'now'} ? :
199 0 2 unless $self->{'dbh'}->do($insert, undef, @values)
213 1 11 unless defined $value
215 0 11 unless exists $attrib_to_table{$attrib}
219 4 7 if ($attrib eq 'receiver') { }
230 0 11 if defined $row_ref->[0]
253 2 0 if ($self->{'dbh'})
254 0 2 unless $self->{'dbh'}->disconnect