Commit 41839707 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

MySQL: With MySQL 5.6, 5.7.6 and later sql_mode system variable contains...

MySQL: With MySQL 5.6, 5.7.6 and later sql_mode system variable contains STRICT_TRANS_TABLES by which some obsoleted columns such as date_admin causes "(42000) Invalid default value" error.  Fixed by resetting sql_mode to be empty, the default on 5.5.x or earlier.
parent 9d31cceb
......@@ -62,12 +62,17 @@ sub connect {
# when the processes are running under mod_perl or CGI environment
# so that "SET NAMES utf8" will be skipped.
# - Set client-side character set to "utf8" or "utf8mb4".
# - Reset SQL mode that is given various default by versions of MySQL.
$self->__dbh->{'mysql_auto_reconnect'} = 0;
unless (defined $self->__dbh->do("SET NAMES 'utf8mb4'")
or defined $self->__dbh->do("SET NAMES 'utf8'")) {
$log->syslog('err', 'Cannot set client-side character set: %s',
$self->error);
}
unless (defined $self->__dbh->do("SET SESSION sql_mode=''")) {
$log->syslog('err', 'Cannot reset SQL mode: %s', $self->error);
return undef;
}
return 1;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment