Skip to content
Snippets Groups Projects
Commit 25cc0fd2 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

pridana funkce connectDB

parent 3e3eb039
Branches
Tags
No related merge requests found
......@@ -106,4 +106,18 @@ sub loadConf
} # End of loadConf
#-------------------------------------------------------------------------------
# connectDB - connect to database and create DB handler
#-------------------------------------------------------------------------------
sub connectDB
{
my $db_name = shift;
my $db_host = shift;
my $db_user = shift;
my $db_pass = shift;
my $dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host",$db_user, $db_pass, {RaiseError => 1, mysql_auto_reconnect => 1}) || die "Could not connect to database '$db_name': $DBI::errstr";
return $dbh;
} # End of connectDB
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment