MythTV  master
mythdbparams.cpp
Go to the documentation of this file.
1 #include "mythdbparams.h"
2 #include "mythlogging.h"
3 
4 bool DatabaseParams::IsValid(const QString &source) const
5 {
6  // Print some warnings if things look fishy..
7  QString msg = QString(" is not set in %1").arg(source);
8 
9  if (m_dbHostName.isEmpty())
10  {
11  LOG(VB_GENERAL, LOG_ERR, "DBHostName" + msg);
12  return false;
13  }
14  if (m_dbUserName.isEmpty())
15  {
16  LOG(VB_GENERAL, LOG_ERR, "DBUserName" + msg);
17  return false;
18  }
19  if (m_dbPassword.isEmpty())
20  {
21  LOG(VB_GENERAL, LOG_ERR, "DBPassword" + msg);
22  return false;
23  }
24  if (m_dbName.isEmpty())
25  {
26  LOG(VB_GENERAL, LOG_ERR, "DBName" + msg);
27  return false;
28  }
29 
30  return true;
31 }
32 
34 {
35  return
36  m_dbHostName == other.m_dbHostName &&
37  m_dbHostPing == other.m_dbHostPing &&
38  m_dbPort == other.m_dbPort &&
39  m_dbUserName == other.m_dbUserName &&
40  m_dbPassword == other.m_dbPassword &&
41  m_dbName == other.m_dbName &&
42  m_dbType == other.m_dbType &&
43  m_localEnabled == other.m_localEnabled &&
44  m_wolEnabled == other.m_wolEnabled &&
46  (!m_wolEnabled ||
47  (m_wolReconnect == other.m_wolReconnect &&
48  m_wolRetry == other.m_wolRetry &&
49  m_wolCommand == other.m_wolCommand));
50 }
DatabaseParams::m_dbHostName
QString m_dbHostName
database server
Definition: mythdbparams.h:21
DatabaseParams
Structure containing the basic Database parameters.
Definition: mythdbparams.h:10
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
DatabaseParams::m_dbType
QString m_dbType
database type (MySQL, Postgres, etc.)
Definition: mythdbparams.h:27
DatabaseParams::m_wolReconnect
std::chrono::seconds m_wolReconnect
seconds to wait for reconnect
Definition: mythdbparams.h:34
DatabaseParams::m_dbPort
int m_dbPort
database port
Definition: mythdbparams.h:23
mythlogging.h
DatabaseParams::m_dbHostPing
bool m_dbHostPing
No longer used.
Definition: mythdbparams.h:22
DatabaseParams::m_dbPassword
QString m_dbPassword
DB password.
Definition: mythdbparams.h:25
DatabaseParams::m_wolRetry
int m_wolRetry
times to retry to reconnect
Definition: mythdbparams.h:35
DatabaseParams::m_dbName
QString m_dbName
database name
Definition: mythdbparams.h:26
DatabaseParams::m_wolCommand
QString m_wolCommand
command to use for wake-on-lan
Definition: mythdbparams.h:36
DatabaseParams::m_dbUserName
QString m_dbUserName
DB user name.
Definition: mythdbparams.h:24
DatabaseParams::operator==
bool operator==(const DatabaseParams &other) const
Definition: mythdbparams.cpp:33
DatabaseParams::m_localEnabled
bool m_localEnabled
true if localHostName is not default
Definition: mythdbparams.h:29
DatabaseParams::m_wolEnabled
bool m_wolEnabled
true if wake-on-lan params are used
Definition: mythdbparams.h:33
DatabaseParams::m_localHostName
QString m_localHostName
name used for loading/saving settings
Definition: mythdbparams.h:30
DatabaseParams::IsValid
bool IsValid(const QString &source=QString("Unknown")) const
Definition: mythdbparams.cpp:4
mythdbparams.h