general/dbms/mysql.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 49 CC 4 SCAR 22.2
CC
4
Cov
0%
errconn
20.0
errdata
2.0
BEGIN
2.0
CRAP 9.2
1 package NKTI::general::dbms::mysql;
2
3 use strict;
4 use warnings;
5 use DBI;
6 use JSON;
7 use Data::Dumper;
8
9 # Subroutine for Error Handling MySQL Connection :
10 # ------------------------------------------------------------------------
11 =head1 SUBROUTINE errconn()
12
13 Deskripsi subroutine errcon() :
14 ----------------------------------------
15 Subroutine yang berfungsi untuk Handel Error Connection MySQL.
16
17 Parameter subroutine errcon() :
18 ----------------------------------------
19 No Parameter Subroutine.
20
21 =cut
22 sub errconn {
23
24 # Define parameter subroutine :
25 # ----------------------------------------------------------------
26 my $self = shift;
27
28 # Define array for place error DBMS Connection :
29 # ----------------------------------------------------------------
30 my @data = ();
31
32 # Check IF defined $DBI::err;
33 # ----------------------------------------------------------------
34 if (defined $DBI::err) {
35 $data[0] = $DBI::err;
36 } else {
37 $data[0] = 00000;
38 }
39
40 # Check IF defined $DBI::state :
41 # ----------------------------------------------------------------
42 if (defined $DBI::state) {
43 $data[1] = $DBI::state;
44 } else {
45 $data[1] = 0;
46 }
47
48 # Check IF defined $DBI::errstr :
49 # ----------------------------------------------------------------
50 if (defined $DBI::errstr) {
51 $data[2] = $DBI::errstr;
52 } else {
53 $data[2] = 'none';
54 }
55
56 # Return Result :
57 # ----------------------------------------------------------------
58 return \@data;
59 }
60 # End of Subroutine for Error Handling MySQL Connection.
61 # ===========================================================================================================
62
63 # Subroutine for Error Handling data MySQL Connection :
64 # ------------------------------------------------------------------------
65 =head1 SUBROUTINE errdata()
66
67 Deskripsi subroutine errdata() :
68 ----------------------------------------
69 Subroutine yang berfungsi untuk menampilkan error saat proses koneksi Data MySQL.
70
71 Parameter subroutine errdata() :
72 ----------------------------------------
73 $sth => Berisi scalar $sth.
74
75 =cut
76 sub errdata {
77
78 # Define parameter Subroutine :
79 # ----------------------------------------------------------------
80 my ($self, $sth) = @_;
81
82 # Define array for place result :
83 # ----------------------------------------------------------------
84 my @data = ();
85
86 # Place result :
87 # ----------------------------------------------------------------
88 $data[0] = $sth->err;
89 $data[1] = $sth->state;
90 $data[2] = $sth->errstr;
91
92 # Return Result :
93 # ----------------------------------------------------------------
94 return \@data;
95 }
96 # End of Subroutine for Error Handling data MySQL Connection.
97 # ===========================================================================================================
98
99 1;
100 __END__