| 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'
ref $class or $class
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
| |||||||||||||||||||||||||||||
| 44 | 3 | my $self = {@_}; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 3 | ▶ | if ($self->{sql_simple}->{argv}{db} eq "" && $self->{sql_simple}->{argv}{dbfile} eq "") | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"sql_simple"}{"argv"}{"db"} eq "" and $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
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 ""
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
not defined $self->{"sql_simple"}{"argv"}{"dbfile"} or $self->{"sql_simple"}{"argv"}{"dbfile"} eq ""
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 ""
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||