Skip to content
Browse files

Disable strict mode in MySQL connections.

We have a lot of code that fails in MySQL strict mode, so ensure that
we're using compatible mode for MythTV DB connections.  This will likely
fix issues such as that fixed in 96cf1cf , which I couldn't reproduce
without enabling strict mode.

Also changes line setting time_zone to use session, instead of its
synonym, local, to make it easier to find in MySQL docs.
  • Loading branch information...
1 parent 329f1c3 commit 65cf894914da82ed84e31830051de9e565be869f @sphery sphery committed Jun 14, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 mythtv/libs/libmythbase/mythdbcon.cpp
View
4 mythtv/libs/libmythbase/mythdbcon.cpp
@@ -180,7 +180,9 @@ bool MSqlDatabase::OpenDatabase(bool skipdb)
.arg(m_db.databaseName()).arg(m_db.hostName()));
// Make sure NOW() returns time in UTC...
- m_db.exec("SET @@local.time_zone='+00:00'");
+ m_db.exec("SET @@session.time_zone='+00:00'");
+ // Disable strict mode
+ m_db.exec("SET @@session.sql_mode=''");
// WriteDelayed depends on SetHaveDBConnection() and SetHaveSchema()
// both being called with true, so order is important here.

0 comments on commit 65cf894

Please sign in to comment.
Something went wrong with that request. Please try again.