-
Notifications
You must be signed in to change notification settings - Fork 0
/
SendGridTable.pm
45 lines (35 loc) · 860 Bytes
/
SendGridTable.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package SendGridTable;
use strict;
use warnings;
use DBI;
$SendGridTable::_dbh = undef;
sub dbh {
my ($class) = @_;
unless (
ref($SendGridTable::_dbh) eq 'DBI'
&& $SendGridTable::_dbh->ping()
) {
$SendGridTable::_dbh =
# update for FACT!
DBI->connect(
'DBI:mysql:...;'
. 'mysql_init_command=SET time_zone="America/Chicago"',
'...',
'...',
{
AutoCommit => 1,
RaiseError => 1,
PrintError => 0,
},
);
}
return $SendGridTable::_dbh;
}
sub disconnect {
my ($class) = @_;
if (ref($SendGridTable::_dbh) eq 'DBI') {
$SendGridTable::_dbh->disconnect();
$SendGridTable::_dbh = undef;
}
}
1;