Database/Driver/SQLite.pm

filter: Statementstmt 60.0% 24 / 40 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 100% 1 / 1 totaltotal 53.3% 32 / 60 CC 4 SCAR 14.8
CC
4
Cov
51%
new
12.0
__ANON__
6.0
__ANON__
2.0
CRAP 4.4
« Database/Driver.pm ↑ Summary Database/Driver/Mock.pm »
1 package Prancer::Session::Store::Database::Driver::SQLite;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 our $VERSION = '1.01';
8  
9 1 ▶use Prancer::Session::Store::Database::Driver;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use parent qw(Prancer::Session::Store::Database::Driver);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # even though this *should* work automatically, it was not
16 1 our @CARP_NOT = qw(Prancer Try::Tiny);
17  
18 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
19 0 my $class = shift;
20 0 my $self = bless($class->SUPER::new(@_), $class);
21  
22 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 require DBD::SQLite;
24 0 ▶ } catch {
Subroutine __ANON__: not called CC=2 SCAR=17.9
25 0 ▶ my $error = (defined($_) ? $_ : "unknown");
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
26 0 croak "could not initialize session handler: could not load DBD::SQLite: ${error}";
27 0 };
28  
29 0 my $database = $self->{'_database'};
30 0 my $charset = $self->{'_charset'};
31 0 my $table = $self->{'_table'};
32  
33 0 my $dsn = "dbi:SQLite:dbname=${database}";
34  
35 0 my $params = {
36 'AutoCommit' => 0,
37 'RaiseError' => 1,
38 'PrintError' => 0,
39 };
40 0 ▶ if ($charset && $charset =~ /^utf8$/xi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($charset and $charset =~ /^utf8$/xi) 0 0 0
Condition0%0/3
$charset and $charset =~ /^utf8$/xi
!ll&&!rl&&r
000
MC/DC0%0/2
$charset and $charset =~ /^utf8$/xi
$charset $charset =~ /^utf8$/xi
Truth table0%0/3
A and B
A= $charsetB= $charset =~ /^utf8$/xi
ABresult
0X0
100
111
41 0 $params->{'sqlite_unicode'} = 1;
42 }
43  
44 # merge in any additional dsn_params
45 0 $params = $self->_merge($params, $self->{'_dsn_extra'});
46  
47 0 $self->{'_dsn'} = [ $dsn, undef, undef, $params ];
48 0 return $self;
49 }
50  
51 1 1;
« Database/Driver.pm ↑ Summary Database/Driver/Mock.pm »