| openPilotLog

adatabasesetup.h
1 /*
2 *openPilotLog - A FOSS Pilot Logbook Application
3 *Copyright (C) 2020-2021 Felix Turowsky
4 *
5 *This program is free software: you can redistribute it and/or modify
6 *it under the terms of the GNU General Public License as published by
7 *the Free Software Foundation, either version 3 of the License, or
8 *(at your option) any later version.
9 *
10 *This program is distributed in the hope that it will be useful,
11 *but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *GNU General Public License for more details.
14 *
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef DBSETUP_H
19 #define DBSETUP_H
20
21 #include <QCoreApplication>
22 #include <QStringBuilder>
23 #include <QEventLoop>
24
25 #define DATABASE_REVISION 17
26
27 const auto TEMPLATE_URL = QStringLiteral("https://raw.githubusercontent.com/fiffty-50/openpilotlog/develop/assets/database/templates/");
28
29
36 class ADataBaseSetup
37 {
38 public:
39 static void debug();
40
41 static bool createDatabase();
42
43 static bool downloadTemplates();
44
45 static bool backupOldData();
46
47 static bool fillTemplates();
48
49 static bool importDefaultData(bool use_local_data);
50
51 static bool resetToDefault();
52
53 static bool commitData(QVector<QStringList> from_csv, const QString &table_name);
54
60 static bool commitDataJson(const QJsonArray &json_arr, const QString &table_name);
61
62 private:
63
64 static bool createSchemata(const QStringList &statements);
65
66
67 };
68
69 #endif // DBSETUP_H
ADataBaseSetup::resetToDefault
static bool resetToDefault()
DbSetup::resetToDefault Empties all user-generated content in the database.
Definition: adatabasesetup.cpp:384
ADataBaseSetup::commitData
static bool commitData(QVector< QStringList > from_csv, const QString &table_name)
DbSetup::commitData inserts the data parsed from a csv file into the database. The first line of the ...
Definition: adatabasesetup.cpp:460
ADataBaseSetup::debug
static void debug()
dbSetup::debug prints Database Layout
Definition: adatabasesetup.cpp:402
ADataBaseSetup::commitDataJson
static bool commitDataJson(const QJsonArray &json_arr, const QString &table_name)
commitDataJson Commits data read from a JSON array to the database.
Definition: adatabasesetup.cpp:515
ADataBaseSetup
The ADataBaseSetup class is responsible for the inital setup of the database when the application is ...
Definition: adatabasesetup.h:36