Skip to content

Commit

Permalink
Prepare for Qt6 version 6.6. (QSqlDatabase)
Browse files Browse the repository at this point in the history
The QSqlDatabase::exec function was deprecated in Qt 6.6.  The
documentation states that QSqlQuery::exec() should be used instead.
Since the replacement function exists in Qt5, go ahead and perform the
conversion.
  • Loading branch information
linuxdude42 committed Feb 15, 2024
1 parent c17b851 commit 0532d29
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mythtv/libs/libmythbase/mythdbcon.cpp
Expand Up @@ -232,7 +232,7 @@ bool MSqlDatabase::OpenDatabase(bool skipdb)
// We can't use MSqlQuery to determine if we have a schema,
// since it will open a new connection, which will try to check
// if we have a schema
QSqlQuery query = m_db.exec(sql); // don't convert to MSqlQuery
QSqlQuery query(sql, m_db); // don't convert to MSqlQuery
if (query.next())
have_schema = query.value(0).toInt() > 1;
GetMythDB()->SetHaveSchema(have_schema);
Expand Down Expand Up @@ -278,10 +278,12 @@ bool MSqlDatabase::Reconnect()

void MSqlDatabase::InitSessionVars()
{
QSqlQuery query(m_db);

// Make sure NOW() returns time in UTC...
m_db.exec("SET @@session.time_zone='+00:00'");
query.exec("SET @@session.time_zone='+00:00'");
// Disable strict mode
m_db.exec("SET @@session.sql_mode=''");
query.exec("SET @@session.sql_mode=''");
}

// -----------------------------------------------------------------------
Expand Down

0 comments on commit 0532d29

Please sign in to comment.