1 #ifndef KLOG_DATABASE_H 2 #define KLOG_DATABASE_H 32 #include <QSqlDatabase> 33 #include <QMessageBox> 38 #include <QInputDialog> 39 #include <QProgressDialog> 40 #include "queryexecutor.h" 41 #include "../utilities.h" 42 #include "../frequency.h" 43 #include "../global.h" 44 #include "../klogdefinitions.h" 46 class QSqlRelationalTableModel;
47 const float DBVersionf = 0.028f;
55 DataBase(
const QString &_parentClass,
const QString &_DBName);
56 DataBase(
const QString &_parentClass,
const QString &_softVersion,
const QString &_DBName);
60 bool beginTransaction();
61 bool commitTransaction();
62 bool rollbackTransaction();
64 QString getSoftVersion();
68 bool createConnection(
const QString &
function,
bool newDB=
false);
71 bool reConnect(
const QString &_DBName);
73 QStringList getColumnNamesFromTable(
const QString &_tableName);
98 bool updateIfNeeded();
99 void backupB4Update();
103 QMultiMap<QString, int> fillCountryCodes();
104 bool updateTheEntityTableISONames();
105 bool updateTableLogs();
108 int getNumberOfQsos(
int _logNumber = -1);
109 int getLastInsertedQSO();
110 void setLogLevel (
const DebugLogLevel _b);
111 bool populateTablePrimarySubdivisions();
112 bool isTheDBCreated();
117 bool execQuery(
const QString &
function,
const QString &stringQuery);
118 bool updateEntity (
const QString &_codeString,
const int _code);
119 bool doesEntityTablehaveData();
120 bool createDataBase();
123 bool isTheTableExisting(
const QString &_tableName);
124 bool hasTheTableData(
const QString &_tableName);
125 bool requiresManualUpgrade();
126 bool updateToLatest();
154 bool updateTableLog(
const int _version);
155 bool updateDBVersion(QString _softV, QString _dbV);
157 bool createTheModeQuickReference();
160 bool recreateTableLog();
161 bool createTableLog(
bool temp =
false);
162 bool createTableLogs(
const bool real=
true);
163 bool createTableEntity(
const bool NoTmp);
164 bool recreateTableEntity();
169 bool createTableMode(
const bool NoTmp);
170 bool populateTableMode(
const bool NoTmp);
173 bool populateTableWithModes(
const QStringList& submodes,
const QString& mode,
const QString &cabrillo,
bool NoTmp);
174 bool updateTheModeTableAndSyncLog();
176 bool createTableBand(
const bool NoTmp);
177 bool populateTableBand(
const bool NoTmp);
178 bool recreateTableBand();
179 bool syncLogQSOsOnBandTableChange();
186 bool createTablePrimarySubdivisions(
const bool NoTmp);
188 bool recreateTablePrimarySubdivisions();
190 bool recreateSatelliteData();
191 bool createTableSatellites(
const bool NoTmp);
192 bool populateTableSatellites(
const bool NoTmp);
194 bool recreatePropModes();
195 bool createTablePropModes();
196 bool populatePropagationModes();
198 bool recreateContestData();
199 bool recreateSupportedContest();
200 bool createTableContest();
201 bool createTableSupportedContest();
202 bool populateContestData();
204 bool populateTableSupportedContest();
206 bool createAndPopulateContinents();
207 bool createAndPopulateAnt_path_enumeration();
210 bool createAndPopulateAwardEnumeration();
211 bool createAndPopulateARRLSectEnumeration();
213 bool createTableQSL_Via_enumeration();
214 bool populateTableQSL_Via_enumeration();
216 bool howManyQSOsInLog(
const int i);
220 bool updateModeIdFromSubModeId();
221 bool updateBandIdTableLogToNewOnes();
222 bool confirmCancellation(QWidget *parent =
nullptr);
224 void queryErrorManagement(
const QString &_functionFailed,
const QString &errorCodeS,
const QString &_nativeError,
const QString &_failedQuery);
225 void logEvent(
const QString &_func,
const QString &_msg, DebugLogLevel _level);
227 DebugLogLevel logLevel;
230 QString dbConnectionName;
248 QString dbDir, dbName;
250 QStringList insertPreparedQueries, insertQueryFields;
251 QSqlQuery preparedQuery;
257 void debugLog (QString _func, QString _msg, DebugLogLevel _level);
Definition: database.h:49
Definition: utilities.h:54
Definition: queryexecutor.h:38
Definition: tst_database.cpp:46