do not store DB file in extra redundat "local" subfolder
This commit is contained in:
parent
bf5776eb13
commit
97f6c2c1ba
@ -28,6 +28,7 @@ class DatabaseDriver : public QObject {
|
||||
explicit DatabaseDriver(QObject* parent = nullptr);
|
||||
|
||||
// API.
|
||||
virtual QString location() const = 0;
|
||||
virtual QString humanDriverType() const = 0;
|
||||
virtual QString qtDriverCode() const = 0;
|
||||
virtual DriverType driverType() const = 0;
|
||||
|
@ -62,6 +62,11 @@ MariaDbDriver::MariaDbError MariaDbDriver::testConnection(const QString& hostnam
|
||||
}
|
||||
}
|
||||
|
||||
QString MariaDbDriver::location() const {
|
||||
return QSL("%1/%2").arg(qApp->settings()->value(GROUP(Database), SETTING(Database::MySQLHostname)).toString(),
|
||||
qApp->settings()->value(GROUP(Database), SETTING(Database::MySQLDatabase)).toString());
|
||||
}
|
||||
|
||||
QString MariaDbDriver::interpretErrorCode(MariaDbDriver::MariaDbError error_code) const {
|
||||
switch (error_code) {
|
||||
case MariaDbError::Ok:
|
||||
|
@ -24,6 +24,7 @@ class MariaDbDriver : public DatabaseDriver {
|
||||
MariaDbError testConnection(const QString& hostname, int port, const QString& w_database,
|
||||
const QString& username, const QString& password);
|
||||
|
||||
virtual QString location() const;
|
||||
virtual QString humanDriverType() const;
|
||||
virtual QString qtDriverCode() const;
|
||||
virtual DriverType driverType() const;
|
||||
|
@ -16,6 +16,10 @@ SqliteDriver::SqliteDriver(bool in_memory, QObject* parent)
|
||||
m_fileBasedDatabaseInitialized(false),
|
||||
m_inMemoryDatabaseInitialized(false) {}
|
||||
|
||||
QString SqliteDriver::location() const {
|
||||
return m_databaseFilePath;
|
||||
}
|
||||
|
||||
DatabaseDriver::DriverType SqliteDriver::driverType() const {
|
||||
return DriverType::SQLite;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class SqliteDriver : public DatabaseDriver {
|
||||
public:
|
||||
explicit SqliteDriver(bool in_memory, QObject* parent = nullptr);
|
||||
|
||||
virtual QString location() const;
|
||||
virtual DriverType driverType() const;
|
||||
virtual bool vacuumDatabase();
|
||||
virtual bool saveDatabase();
|
||||
|
@ -160,7 +160,7 @@
|
||||
|
||||
#define APP_DB_SQLITE_DRIVER "QSQLITE"
|
||||
#define APP_DB_SQLITE_INIT "db_init_sqlite.sql"
|
||||
#define APP_DB_SQLITE_PATH "database/local"
|
||||
#define APP_DB_SQLITE_PATH "database"
|
||||
#define APP_DB_SQLITE_FILE "database.db"
|
||||
|
||||
// Keep this in sync with schema versions declared in SQL initialization code.
|
||||
|
@ -2,9 +2,12 @@
|
||||
|
||||
#include "gui/dialogs/formabout.h"
|
||||
|
||||
#include "database/databasedriver.h"
|
||||
#include "database/databasefactory.h"
|
||||
#include "definitions/definitions.h"
|
||||
#include "exceptions/applicationexception.h"
|
||||
#include "gui/guiutilities.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
#include "miscellaneous/settingsproperties.h"
|
||||
#include "miscellaneous/textfactory.h"
|
||||
@ -33,9 +36,7 @@ void FormAbout::loadSettingsAndPaths() {
|
||||
m_ui.m_txtPathsSettingsType->setText(tr("NOT portable"));
|
||||
}
|
||||
|
||||
m_ui.m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->userDataFolder() +
|
||||
QDir::separator() +
|
||||
QString(APP_DB_SQLITE_PATH)));
|
||||
m_ui.m_txtPathsDatabaseRoot->setText(qApp->database()->driver()->location());
|
||||
m_ui.m_txtPathsSettingsFile->setText(QDir::toNativeSeparators(qApp->settings()->fileName()));
|
||||
m_ui.m_txtPathsSkinsRoot->setText(QDir::toNativeSeparators(qApp->skins()->customSkinBaseFolder()));
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>83</width>
|
||||
<width>98</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -305,7 +305,7 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>83</width>
|
||||
<width>98</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -472,7 +472,7 @@ p, li { white-space: pre-wrap; }
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Database root path</string>
|
||||
<string>Database location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user