diff options
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 2f23e8345..b3b1cba10 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -65,6 +65,18 @@ sub new { bless ($self, $class); + # Bug 321645 - disable MySQL strict mode, if set + my $sql_mode = $self->selectrow_array('SELECT @@sql_mode'); + if ($sql_mode) { + my $new_sql_mode = + join(",", grep {$_ !~ /^STRICT_(?:TRANS|ALL)_TABLES|TRADITIONAL$/} + split(/,/, $sql_mode)); + + if ($sql_mode ne $new_sql_mode) { + $self->do("SET SESSION sql_mode = ?", undef, $new_sql_mode); + } + } + return $self; } |