X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fdbi.pl;fp=src%2Fdbi.pl;h=3e4bf82b174456e578e3a088d6912cbbc5480fcc;hb=8a2d9954c905a13e201bacd979f16cabbdcc301a;hp=09a79189476c5fa8f64e4df050fdc31fc54d1fc6;hpb=5abe91c89b3419d9ee76791b04ac091fe1e7da81;p=infobot.git diff --git a/src/dbi.pl b/src/dbi.pl index 09a7918..3e4bf82 100644 --- a/src/dbi.pl +++ b/src/dbi.pl @@ -74,6 +74,7 @@ eval { sub sqlOpenDB { my ( $db, $type, $user, $pass, $no_fail ) = @_; + my $attr = {}; # this is a mess. someone fix it, please. if ( $type =~ /^SQLite(2)?$/i ) { $db = "dbname=$db.sqlite"; @@ -82,6 +83,9 @@ sub sqlOpenDB { $db = "dbname=$db"; $type = 'Pg'; } + elsif ($type =~ /mysql/) { + $attr->{mysql_enable_utf8mb4} = 1; + } my $dsn = "DBI:$type:$db"; my $hoststr = ''; @@ -100,7 +104,7 @@ sub sqlOpenDB { } # SQLite ignores $user and $pass - $dbh = Bloot::DBI->new( DBI->connect( $dsn, $user, $pass ) ); + $dbh = Bloot::DBI->new( DBI->connect( $dsn, $user, $pass, $attr ) ); if ( $dbh && !$dbh->err ) { &status("Opened $type connection$hoststr");