Skip to content

Commit

Permalink
Disable strict mode in MySQL connections.
Browse files Browse the repository at this point in the history
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
sphery committed Jun 14, 2012
1 parent 329f1c3 commit 65cf894
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mythtv/libs/libmythbase/mythdbcon.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit 65cf894

Please sign in to comment.