use strict; | use strict; | ||||
use JSON; | use JSON; | ||||
use DBI; | use DBI; | ||||
use utf8; | |||||
use GD::Simple; | use GD::Simple; | ||||
use Data::Dumper; | use Data::Dumper; | ||||
use Data::UUID; | use Data::UUID; | ||||
my($sql) = @_; | my($sql) = @_; | ||||
my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}"; | my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}"; | ||||
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}) || \\ | |||||
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}, { mysql_enable_utf8 => 1 }) || \ | |||||
die "Failed to connect to database"; | die "Failed to connect to database"; | ||||
return $dbh; | return $dbh; |
use FCGI; | use FCGI; | ||||
use JSON; | use JSON; | ||||
use DBI; | use DBI; | ||||
use utf8; | |||||
use GD::Simple; | use GD::Simple; | ||||
use Data::Dumper; | use Data::Dumper; | ||||
use Data::UUID; | use Data::UUID; | ||||
my($sql) = @_; | my($sql) = @_; | ||||
my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}"; | my $dsn = "DBI:mysql:database=$sql->{base};host=$sql->{host}"; | ||||
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}) || \\ | |||||
my $dbh = DBI->connect($dsn, $sql->{user}, $sql->{pass}, { mysql_enable_utf8 => 1 }) || \ | |||||
fatal_api_error(500,"Failed to connect to database"); | fatal_api_error(500,"Failed to connect to database"); | ||||
return $dbh; | return $dbh; |