| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use DBI (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | # Locate the SQLite database | ||||||||||||||||||||||||||||
| 5 | 1 | my $file = <STDIN>; | |||||||||||||||||||||||||||
| 6 | 1 | chomp($file); | |||||||||||||||||||||||||||
| 7 | 1 | ▶ | unless ( -f $file and -w $file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-f $file and -w $file
MC/DC0%0/2
-f $file and -w $file
-f $file
-w $file
Truth table33%1/3
A and B
A= -f $fileB= -w $file
| |||||||||||||||||||||||||||||
| 8 | 0 | die "SQLite file $file does not exist"; | |||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # Connect to the SQLite database | ||||||||||||||||||||||||||||
| 12 | 1 | my $dbh = DBI->connect("dbi:SQLite(RaiseError=>1):$file"); | |||||||||||||||||||||||||||
| 13 | 1 | ▶ | unless ( $dbh ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | 0 | die "Failed to connect to $file"; | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | ##################################################################### | ||||||||||||||||||||||||||||
| 22 | # Migration | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | foreach ( split /;\s+/, <<'END_SQL' ) { $dbh->do( $_ ) } | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | create table foo ( | ||||||||||||||||||||||||||||
| 27 | id integer not null primary key, | ||||||||||||||||||||||||||||
| 28 | name varchar(32) not null | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | insert into foo values ( 1, 'foo' ) | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | END_SQL | ||||||||||||||||||||||||||||