« Tapper/Schema/TestrunDB/ResultSet/TestrunScheduling.pm
↑ Summary
Tapper/Schema/TestrunDB/ResultSet/Testrun.pm »
| 1 | package Tapper::Schema::TestrunDB::Result::ReportFile; | ||||||||||||||||||||||||||||
| 2 | 10 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||||||||||||||||||||
| 3 | 10 | $Tapper::Schema::TestrunDB::Result::ReportFile::VERSION = '5.0.12'; | |||||||||||||||||||||||||||
| 4 | # ABSTRACT: Tapper - Containg files attached to reports | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use parent 'DBIx::Class'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use Compress::Bzip2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 10 | __PACKAGE__->load_components(qw/FilterColumn InflateColumn::DateTime TimeStamp Core/); | |||||||||||||||||||||||||||
| 13 | 10 | __PACKAGE__->table("reportfile"); | |||||||||||||||||||||||||||
| 14 | 10 | __PACKAGE__->add_columns | |||||||||||||||||||||||||||
| 15 | ( | ||||||||||||||||||||||||||||
| 16 | "id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_auto_increment => 1, }, | ||||||||||||||||||||||||||||
| 17 | "report_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, }, | ||||||||||||||||||||||||||||
| 18 | "filename", { data_type => "VARCHAR", default_value => "", is_nullable => 1, size => 255, }, | ||||||||||||||||||||||||||||
| 19 | "contenttype", { data_type => "VARCHAR", default_value => "", is_nullable => 1, size => 255, }, | ||||||||||||||||||||||||||||
| 20 | "filecontent", { data_type => "LONGBLOB", default_value => "", is_nullable => 0, }, | ||||||||||||||||||||||||||||
| 21 | "is_compressed", { data_type => "INT", default_value => 0, is_nullable => 0, }, | ||||||||||||||||||||||||||||
| 22 | "created_at", { data_type => "DATETIME", default_value => undef, is_nullable => 0, set_on_create => 1, }, | ||||||||||||||||||||||||||||
| 23 | "updated_at", { data_type => "DATETIME", default_value => undef, is_nullable => 0, set_on_create => 1, set_on_update => 1, }, | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 10 | __PACKAGE__->set_primary_key("id"); | |||||||||||||||||||||||||||
| 27 | __PACKAGE__->filter_column('filecontent', { | ||||||||||||||||||||||||||||
| 28 | 1 | ▶ | filter_from_storage => sub { my ($row, $element) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.5
| |||||||||||||||||||||||||||||
| 29 | 1 | my $uncompressed; | |||||||||||||||||||||||||||
| 30 | 1 | ▶ | if ($row->is_compressed) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 1 | eval { $uncompressed = memBunzip( $element ) }; | |||||||||||||||||||||||||||
| 32 | 1 | ▶ | return $uncompressed if !$@ && $uncompressed; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $@ and $uncompressed
MC/DC0%0/2
not $@ and $uncompressed
not $@
$uncompressed
Truth table33%1/3
not(A) and B
A= not $@B= $uncompressed
| |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 0 | return $element; | |||||||||||||||||||||||||||
| 35 | }, | ||||||||||||||||||||||||||||
| 36 | 2 | ▶ | filter_to_storage => sub { my ($row, $element) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||
| 37 | 2 | ▶ | if ($element) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 1 | my $compressed; | |||||||||||||||||||||||||||
| 39 | 1 | eval { | |||||||||||||||||||||||||||
| 40 | 1 | $compressed = memBzip( $element ); | |||||||||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||||||||||
| 42 | 1 | ▶ | if (!$@ and $compressed) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $@ and $compressed
MC/DC0%0/2
not $@ and $compressed
not $@
$compressed
Truth table33%1/3
not(A) and B
A= not $@B= $compressed
| |||||||||||||||||||||||||||||
| 43 | 1 | $row->is_compressed( 1 ); | |||||||||||||||||||||||||||
| 44 | 1 | return $compressed; | |||||||||||||||||||||||||||
| 45 | } else { | ||||||||||||||||||||||||||||
| 46 | 0 | $row->is_compressed( 0 ); | |||||||||||||||||||||||||||
| 47 | 0 | return $element; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | } else { | ||||||||||||||||||||||||||||
| 50 | 1 | $row->is_compressed( 0 ); | |||||||||||||||||||||||||||
| 51 | 1 | return $element; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | }, | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | 10 | ); | |||||||||||||||||||||||||||
| 56 | 10 | __PACKAGE__->belongs_to ( report => 'Tapper::Schema::TestrunDB::Result::Report', { 'foreign.id' => 'self.report_id' }); | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 10 | 1; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | __END__ | ||||||||||||||||||||||||||||