File Coverage

blib/lib/SQL/SimpleOps/DBI/SQLite.pm
Criterion Covered Total %
statement 21 21 100.0
branch 1 2 50.0
condition 2 5 40.0
subroutine 6 6 100.0
pod 0 2 0.0
total 30 36 83.3


line stmt bran cond sub pod time code
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.
19             #
20             package SQL::SimpleOps::DBI::SQLite;
21              
22 2     2   45 use 5.006001;
  2         8  
23 2     2   11 use strict;
  2         8  
  2         52  
24 2     2   11 use warnings;
  2         4  
  2         47  
25 2     2   11 use Exporter;
  2         4  
  2         624  
26              
27             our @ISA = qw ( Exporter );
28              
29             our @EXPORT = qw(new Open $VERSION);
30              
31             our $VERSION = "2023.106.1";
32              
33             our @EXPORT_OK = @EXPORT;
34              
35             our %EXPORT_TAGS = ( all => [@EXPORT_OK] );
36             1;
37              
38             ###############################################################################
39             ## plugin initialization
40              
41             sub new()
42             {
43 2   50 2 0 5 my $class = shift; $class = ref($class) || $class || 'SQL::SimpleOps::DBI::SQLite';
  2         17  
44 2         5 my $self = {};
45              
46 2         7 $self->{argv} = {@_};
47              
48 2         9 bless($self,$class);
49             }
50              
51             ###############################################################################
52             ## initialize here the dsname by:
53             #
54             ## All methods can be executed using the format:
55             # $self_sql_simple->[method_name]();
56             #
57             ## return codes:
58             ## rc=0 ok, continue
59             ## rc<1 syntax, abort
60             ## rc=1 error, abort
61             ## rc=2 ok, ignore caller
62              
63             sub Open()
64             {
65 1     1 0 40 my $self = shift;
66 1         4 my $argv = shift;
67              
68             ## sets the dsnam here
69 1 50 33     10 $self->{argv}{sql_simple}->{argv}{dbfile} = $self->{argv}{sql_simple}->{argv}{db}.".db" if (!defined($self->{argv}{sql_simple}->{argv}{dbfile}) || $self->{argv}{sql_simple}->{argv}{dbfile} eq "");
70 1         4 $self->{argv}{sql_simple}->{argv}{dsname} = "DBI:SQLite:dbname=$self->{argv}{sql_simple}->{argv}{dbfile}";
71              
72 1         6 return 0;
73             }
74              
75             __END__