SimpleOps/DBI/SQLite.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran 50.0% 2 / 4 Conditioncond 36.3% 4 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 69.3% 43 / 62 CC 7 SCAR 13.4
CC
7
Cov
77%
new
6.4
Open
3.2
BEGIN
1.0
CRAP 3.8
« SimpleOps/DBI/PG.pm ↑ Summary SimpleOps/DBI/MyPlugin.pm »
1 # ABSTRACT SQL Simple Operations Commands
2 #
3 ## LICENSE AND COPYRIGHT
4 #
5 ## Copyright (C) Carlos Celso
6 #
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 3 of the License, or
10 ## (at your option) any later version.
11 #
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
16 #
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program. If not, see L<http://www.gnu.org/licenses/>.
19 #
20 package SQL::SimpleOps::DBI::SQLite;
21  
22 2 ▶ use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶ use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 2 our @ISA = qw ( Exporter );
28  
29 2 our @EXPORT = qw(new Open $VERSION);
30  
31 2 our $VERSION = "2026.129.1";
32  
33 2 our @EXPORT_OK = @EXPORT;
34  
35 2 our %EXPORT_TAGS = ( all => [@EXPORT_OK] );
36 2 1;
37  
38 ###############################################################################
39 ## plugin initialization
40  
41 sub new()
42 3 ▶{
Subroutine new: called CC=5 SCAR=18.5
Pod undocumented
43 3 ▶ my $class = shift; $class = ref($class) || $class || 'SQL::SimpleOps::DBI::SQLite';
Condition40%2/5
ref $class || $class || 'SQL::SimpleOps::DBI::SQLite'
l!l
30
ref $class or $class
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $class || $class || 'SQL::SimpleOps::DBI::SQLite'
ref $class $class
Truth table33%1/3
A or B
A= ref $classB= $class
ABresult
1X1
011
000
44 3 my $self = {@_};
45  
46 3 ▶ if ($self->{sql_simple}->{argv}{db} eq "" && $self->{sql_simple}->{argv}{dbfile} eq "")
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"sql_simple"}{"argv"}{"db"} eq "" and $self->{"sql_simple"}{"argv"}{"dbfile"} eq "") 0 3 3
Condition33%1/3
$self->{"sql_simple"}{"argv"}{"db"} eq "" and $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
!ll&&!rl&&r
300
MC/DC0%0/2
$self->{"sql_simple"}{"argv"}{"db"} eq "" and $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
$self->{"sql_simple"}{"argv"}{"db"} eq "" $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
Truth table33%1/3
A and B
A= $self->{"sql_simple"}{"argv"}{"db"} eq ""B= $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
ABresult
0X0
100
111
47 {
48 0 $self->{sql_simple}->setMessage($self,"new",-1,"001");
49 0 return undef;
50 }
51 3 $self->{sql_simple}->{init}{plugin_id} = "SQLite";
52 3 $self->{sql_simple}->{init}{schema} = 0;
53 3 $self->{sql_simple}->{init}{test_server} = 0;
54 3 $self->{sql_simple}->{init}{alias_with_as} = 0;
55  
56 3 bless($self,$class);
57 }
58  
59 ###############################################################################
60 ## initialize here the dsname by:
61 #
62 ## All methods can be executed using the format:
63 # $self_sql_simple->[method_name]();
64 #
65 ## return codes:
66 ## rc=0 ok, continue
67 ## rc<1 syntax, abort
68 ## rc=1 error, abort
69 ## rc=2 ok, ignore caller
70  
71 sub Open()
72 2 ▶{
Subroutine Open: called CC=3 SCAR=11.8
Pod undocumented
73 2 my $self = shift;
74 2 my $argv = shift;
75  
76 ## sets the dsnam here
77 2 ▶ $self->{sql_simple}->{argv}{dbfile} = $self->{sql_simple}->{argv}{db}.".db" if (!defined($self->{sql_simple}->{argv}{dbfile}) || $self->{sql_simple}->{argv}{dbfile} eq "");
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->{"sql_simple"}{"argv"}{"dbfile"} or $self->{"sql_simple"}{"argv"}{"dbfile"} eq "" 0 2 2
Condition33%1/3
not defined $self->{"sql_simple"}{"argv"}{"dbfile"} or $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
l!l&&r!l&&!r
002
MC/DC0%0/2
not defined $self->{"sql_simple"}{"argv"}{"dbfile"} or $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
not defined $self->{"sql_simple"}{"argv"}{"dbfile"} $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
Truth table33%1/3
not(A) or B
A= not defined $self->{"sql_simple"}{"argv"}{"dbfile"}B= $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
ABresult
1X1
011
000
78  
79 ## sets the connector here
80 2 $self->{sql_simple}->{argv}{dsname} = "DBI:SQLite:dbname=".$self->{sql_simple}->{argv}{dbfile};
81 2 return 0;
82 }
83  
84 __END__
« SimpleOps/DBI/PG.pm ↑ Summary SimpleOps/DBI/MyPlugin.pm »