db.pm: output call stack on error

This commit is contained in:
Milan
2024-02-17 20:44:02 +01:00
parent 5bda92f0ab
commit 3f5e4a84fb

View File

@@ -52,6 +52,10 @@ sub connect($;$) {
my $dbh = DBI->connect( $dsn, $username, $password, { mysql_enable_utf8 => 1 } )
|| die "could not connect to database: $DBI::errstr";
$dbh->{RaiseError} = 1;
$dbh->{HandleError} = sub{
print STDERR join(",",(caller($_))[0..3])."\n" for (1..2);
return 0;
};
$dbh->{'mysql_enable_utf8'} = 1;
put( $dbh, "set character set utf8", undef );
put( $dbh, "set names utf8", undef );