HDB/MOD.pm

filter: Statementstmt 27.2% 15 / 55 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 18.1% 4 / 22 Podpod 16.6% 3 / 18 totaltotal 19.1% 22 / 115 CC 11 SCAR 21.5
CC
11
Cov
20%
disconnect
30.0
connected
12.0
UNLINK
12.0
CRAP 8.6
« HDB/MOD/oracle.pm ↑ Summary HDB/MOD/sqlite.pm »
1 #############################################################################
2 ## Name: MOD.pm
3 ## Purpose: HDB::MOD - Common things for HDB modules.
4 ## Author: Graciliano M. P.
5 ## Modified by:
6 ## Created: 15/01/2003
7 ## RCS-ID:
8 ## Copyright: (c) 2002 Graciliano M. P.
9 ## Licence: This program is free software; you can redistribute it and/or
10 ## modify it under the same terms as Perl itself
11 #############################################################################
12  
13 package HDB::MOD ;
14  
15 1 ▶use DBI ;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use strict qw(vars) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶no warnings ;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 our $VERSION = '1.0' ;
21 1 our @ISA = qw(HDB::CMDS HDB) ;
22  
23 ###############
24 # VAR ALIASES #
25 ###############
26  
27 0 ▶sub dbi { $_[0]->{dbh} ;}
Subroutine dbi: not called CC=1 SCAR=6.9
Pod undocumented
28 0 ▶sub dbh { $_[0]->{dbh} ;}
Subroutine dbh: not called CC=1 SCAR=6.9
Pod documented
29 0 ▶sub sth { $_[0]->{sth} ;}
Subroutine sth: not called CC=1 SCAR=6.9
Pod undocumented
30 0 ▶sub sql { $_[0]->{sql} ;}
Subroutine sql: not called CC=1 SCAR=6.9
Pod undocumented
31  
32 #############
33 # CONNECTED #
34 #############
35  
36 0 ▶sub connected {
Subroutine connected: not called CC=3 SCAR=24.8
Pod undocumented
37 0 ▶ if ( !$_[0]->dbh ) { return undef ;}
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[0]->dbh) 0 0 0
38 0 ▶ if ( $_[0]->dbh->{Active} ) { return 1 ;}
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->dbh->{"Active"}) 0 0 0
39 0 return undef ;
40 }
41  
42 ##############
43 # DISCONNECT #
44 ##############
45  
46 0 ▶sub disconnect {
Subroutine disconnect: not called CC=5 SCAR=34.0
Pod documented
47 0 my $this = shift ;
48  
49 0 ▶ $this->{sth}->finish if $this->{sth} ;
Branch: 1 branch
BranchTrueFalseTotal
if $this->{"sth"} 0 0 0
50 0 $this->{sth} = undef ;
51
52 0 $this->flush_cache ;
53
54 0 ▶ if ( $this->{dbh} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($this->{"dbh"}) 0 0 0
55 0 ▶ $this->{dbh}->commit if !$this->{dbh}->{AutoCommit} ;
Branch: 1 branch
BranchTrueFalseTotal
unless $this->{"dbh"}{"AutoCommit"} 0 0 0
56 0 ▶ $this->MOD_disconnect if !$this->{dbh}->{Kids} ;
Branch: 1 branch
BranchTrueFalseTotal
unless $this->{"dbh"}{"Kids"} 0 0 0
57 }
58  
59 0 $this->{dbh} = undef ;
60  
61 0 return ;
62 }
63  
64 ##################
65 # MOD_DISCONNECT #
66 ##################
67  
68 0 ▶sub MOD_disconnect {
Subroutine MOD_disconnect: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my $this = shift ;
70 0 $this->{dbh}->disconnect ;
71 }
72  
73 ########
74 # LINK #
75 ########
76  
77 0 ▶sub LINK {
Subroutine LINK: not called CC=2 SCAR=17.9
Pod undocumented
78 0 ▶ if ( $_[0]->{HPL}{UNLINK_DISCONNECT} ) { $_[0]->connect ;}
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"HPL"}{"UNLINK_DISCONNECT"}) 0 0 0
79 }
80  
81 ##########
82 # UNLINK #
83 ##########
84  
85 0 ▶sub UNLINK {
Subroutine UNLINK: not called CC=3 SCAR=24.8
Pod undocumented
86 0 $_[0]->flush_cache ;
87 0 ▶ if ( $_[0]->{sth} ) { $_[0]->{sth}->finish ; $_[0]->{sth} = undef ;}
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"sth"}) 0 0 0
88 0 ▶ if ( $_[0]->{HPL}{UNLINK_DISCONNECT} ) { $_[0]->disconnect ;}
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]{"HPL"}{"UNLINK_DISCONNECT"}) 0 0 0
89 }
90  
91 ######
92 # DO #
93 ######
94  
95 0 ▶sub do { $_[0]->{dbh}->do(@_[1..$#_]) ;}
Subroutine do: not called CC=1 SCAR=6.9
Pod undocumented
96  
97 ###########
98 # PREPARE #
99 ###########
100  
101 0 ▶sub prepare { $_[0]->{dbh}->prepare(@_[1..$#_]) ;}
Subroutine prepare: not called CC=1 SCAR=6.9
Pod undocumented
102  
103 ###########
104 # EXECUTE #
105 ###########
106  
107 0 ▶sub execute { $_[0]->{sth}->execute(@_[1..$#_]) ;}
Subroutine execute: not called CC=1 SCAR=6.9
Pod undocumented
108  
109 #############
110 # TYPE_TEXT #
111 #############
112  
113 0 ▶sub Type_TEXT { return 'TEXT' ;}
Subroutine Type_TEXT: not called CC=1 SCAR=6.9
Pod undocumented
114  
115 ################
116 # TYPE_INTEGER #
117 ################
118  
119 0 ▶sub Type_INTEGER { return 'INTEGER' ;}
Subroutine Type_INTEGER: not called CC=1 SCAR=6.9
Pod undocumented
120  
121 ##############
122 # TYPE_FLOAT #
123 ##############
124  
125 0 ▶sub Type_FLOAT { return 'FLOAT' ;}
Subroutine Type_FLOAT: not called CC=1 SCAR=6.9
Pod undocumented
126  
127 ##############
128 # PRIMARYKEY #
129 ##############
130  
131 0 ▶sub PRIMARYKEY { return "PRIMARY KEY" ;}
Subroutine PRIMARYKEY: not called CC=1 SCAR=6.9
Pod undocumented
132  
133 #################
134 # AUTOINCREMENT #
135 #################
136  
137 0 ▶sub AUTOINCREMENT { return "INTEGER NOT NULL AUTO_INCREMENT" ;}
Subroutine AUTOINCREMENT: not called CC=1 SCAR=6.9
Pod undocumented
138  
139 #########
140 # LIMIT #
141 #########
142  
143 0 ▶sub LIMIT {
Subroutine LIMIT: not called CC=2 SCAR=17.9
Pod documented
144 0 my $this = shift ;
145 0 my ( $sz , $offset ) = @_ ;
146 0 ▶ my $limit = $offset > 0 ? "$sz,$offset" : $sz ;
Branch: 1 branch
BranchTrueFalseTotal
$offset > 0 ? : 0 0 0
147 0 return( "LIMIT $limit" ) ;
148 }
149  
150 #######
151 # DBD #
152 #######
153  
154 package DBI ;
155 package DBD ;
156 1 ▶use vars qw(%HDB) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 #######
159 # END #
160 #######
161  
162 1 1;
163  
« HDB/MOD/oracle.pm ↑ Summary HDB/MOD/sqlite.pm »