SimpleOps/DBI/MySQL.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 72 CC 4 SCAR 23.0
CC
4
Cov
0%
Open
20.0
new
2.0
BEGIN
2.0
CRAP 10.0
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  
21 package SQL::SimpleOps::DBI::MySQL;
22  
23 use 5.006001;
24 use strict;
25 use warnings;
26 use Exporter;
27  
28 our @ISA = qw ( Exporter );
29  
30 our @EXPORT = qw(new Open $VERSION);
31  
32 our $VERSION = "2026.129.1";
33  
34 our @EXPORT_OK = @EXPORT;
35  
36 our %EXPORT_TAGS = ( all => [@EXPORT_OK] );
37 1;
38  
39 ###############################################################################
40 ## plugin initialization
41  
42 sub new()
43 {
44 my $class = shift; $class = ref($class) || $class || 'SQL::SimpleOps::DBI::MySQL';
45 my $self = {@_};
46  
47 $self->{sql_simple}->{init}{plugin_id} = "MySQL";
48 $self->{sql_simple}->{init}{schema} = 0;
49 $self->{sql_simple}->{init}{test_server} = 1;
50 $self->{sql_simple}->{init}{alias_with_as} = 0;
51  
52 bless($self,$class);
53 }
54  
55 ###############################################################################
56 ## initialize here the dsname by:
57 #
58 ## All methods can be executed using the format:
59 # $self_sql_simple->[method_name]();
60 #
61 ## return codes:
62 ## rc=0 ok, continue
63 ## rc<1 syntax, abort
64 ## rc=1 error, abort
65 ## rc=2 ok, ignore caller
66  
67 sub Open()
68 {
69 my $self = shift;
70 my $argv = shift;
71  
72 ## sets the dsnam here
73 my @options;
74 push(@options,"database=".$self->{sql_simple}->{argv}{db}) if (defined($self->{sql_simple}->{argv}{db}) && $self->{sql_simple}->{argv}{db} ne "");
75 push(@options,"host=".$self->{sql_simple}->{argv}{server}) if (defined($self->{sql_simple}->{argv}{server}) && $self->{sql_simple}->{argv}{server} ne "");
76 push(@options,$self->{sql_simple}->{argv}{port}) if (defined($self->{sql_simple}->{argv}{port}) && $self->{sql_simple}->{argv}{port} ne "");
77  
78 ## sets the dsnam here
79 $self->{sql_simple}->{argv}{dsname} = "DBI:mysql:".join(';',@options);
80 return 0;
81 }
82  
83 __END__