Database/Driver/mysql.pm

filter: Statementstmt 27.2% 12 / 44 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 4 / 12 Podpod 100% 6 / 6 totaltotal 33.3% 22 / 66 CC 3 SCAR 10.5
CC
3
Cov
25%
drop_database
6.0
drop_database
6.0
_version
2.0
CRAP 2.9
« Database/Driver/Pg.pm ↑ Summary Database/Handle.pm »
1 package Test::Database::Driver::mysql;
2 $Test::Database::Driver::mysql::VERSION = '1.113';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Test::Database::Driver;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 our @ISA = qw( Test::Database::Driver );
10  
11 0 ▶sub _version {
Subroutine _version: not called CC=1 SCAR=6.9
12 0 ▶ return DBI->connect( $_[0]->connection_info() )
Subroutine _version: not called CC=1 SCAR=6.9
13 ->selectcol_arrayref('SELECT VERSION()')->[0];
14 }
15  
16 0 ▶sub create_database {
Subroutine create_database: not called CC=1 SCAR=6.9
Pod documented
17 0 ▶ my ( $self ) = @_;
Subroutine create_database: not called CC=1 SCAR=6.9
Pod documented
18 0 my $dbname = $self->available_dbname();
19  
20 0 DBI->connect_cached( $self->connection_info() )
21 ->do("CREATE DATABASE $dbname");
22  
23 # return the handle
24 0 return Test::Database::Handle->new(
25 dsn => $self->dsn($dbname),
26 name => $dbname,
27 username => $self->username(),
28 password => $self->password(),
29 driver => $self,
30 );
31 }
32  
33 0 ▶sub drop_database {
Subroutine drop_database: not called CC=2 SCAR=17.9
Pod documented
34 0 ▶ my ( $self, $dbname ) = @_;
Subroutine drop_database: not called CC=2 SCAR=17.9
Pod documented
35  
36 DBI->connect_cached( $self->connection_info() )
37 ->do("DROP DATABASE $dbname")
38 0 ▶ if grep { $_ eq $dbname } $self->databases();
Branch: 2 branches
BranchTrueFalseTotal
if grep {$_ eq $dbname;} $self->databases 0 0 0
if grep {$_ eq $dbname;} $self->databases 0 0 0
39 }
40  
41 0 ▶sub databases {
Subroutine databases: not called CC=1 SCAR=6.9
Pod documented
42 0 ▶ my ($self) = @_;
Subroutine databases: not called CC=1 SCAR=6.9
Pod documented
43 0 my $basename = qr/^@{[$self->_basename()]}/;
44 0 my $databases = eval {
45 0 DBI->connect_cached( $self->connection_info(), { PrintError => 0 } )
46 ->selectall_arrayref('SHOW DATABASES');
47 };
48 0 return grep {/$basename/} map {@$_} @$databases;
49 }
50  
51 'mysql';
52  
53 __END__
« Database/Driver/Pg.pm ↑ Summary Database/Handle.pm »