MythTV master
mythdbparams.cpp
Go to the documentation of this file.
1#include "mythdbparams.h"
2#include "mythlogging.h"
3
4bool 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 &&
44 m_wolEnabled == other.m_wolEnabled &&
46 (!m_wolEnabled ||
48 m_wolRetry == other.m_wolRetry &&
49 m_wolCommand == other.m_wolCommand));
50}
Structure containing the basic Database parameters.
Definition: mythdbparams.h:11
QString m_dbName
database name
Definition: mythdbparams.h:26
QString m_dbPassword
DB password.
Definition: mythdbparams.h:25
std::chrono::seconds m_wolReconnect
seconds to wait for reconnect
Definition: mythdbparams.h:34
QString m_localHostName
name used for loading/saving settings
Definition: mythdbparams.h:30
bool m_localEnabled
true if localHostName is not default
Definition: mythdbparams.h:29
bool IsValid(const QString &source=QString("Unknown")) const
Definition: mythdbparams.cpp:4
bool m_dbHostPing
No longer used.
Definition: mythdbparams.h:22
QString m_dbUserName
DB user name.
Definition: mythdbparams.h:24
QString m_dbType
database type (MySQL, Postgres, etc.)
Definition: mythdbparams.h:27
QString m_wolCommand
command to use for wake-on-lan
Definition: mythdbparams.h:36
bool m_wolEnabled
true if wake-on-lan params are used
Definition: mythdbparams.h:33
int m_dbPort
database port
Definition: mythdbparams.h:23
int m_wolRetry
times to retry to reconnect
Definition: mythdbparams.h:35
QString m_dbHostName
database server
Definition: mythdbparams.h:21
bool operator==(const DatabaseParams &other) const
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39