mirror of
https://github.com/martinrotter/rssguard.git
synced 2024-12-31 18:37:30 +01:00
Automatic switching to SQLite once MySQL is not available.
This commit is contained in:
parent
1f49d2af5b
commit
b5dbf6b067
@ -9,6 +9,7 @@ http://goo.gl/forms/GcvPYgS2a8
|
||||
|
||||
Added:
|
||||
|
||||
▪ RSS Guard now automatically switches to SQLite backend if MySQL is not available on program startup.
|
||||
▪ Opened web browser tabs now can be saved. (issue #126)
|
||||
▪ Added experimental support for tweakable statusbar. (issue #158)
|
||||
▪ Opening of download manager when new file download starts is now optional. (issue #165)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "miscellaneous/iofactory.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/textfactory.h"
|
||||
#include "gui/messagebox.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QSqlQuery>
|
||||
@ -638,8 +639,17 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
|
||||
database.setPassword(TextFactory::decrypt(qApp->settings()->value(GROUP(Database), SETTING(Database::MySQLPassword)).toString()));
|
||||
|
||||
if (!database.open()) {
|
||||
qFatal("MySQL database was NOT opened. Delivered error message: '%s'",
|
||||
qPrintable(database.lastError().text()));
|
||||
qCritical("MySQL database was NOT opened. Delivered error message: '%s'", qPrintable(database.lastError().text()));
|
||||
|
||||
// Now, we will display error warning and return SQLite connection.
|
||||
// Also, we set the SQLite driver as active one.
|
||||
qApp->settings()->setValue(GROUP(Database), Database::ActiveDriver, APP_DB_SQLITE_DRIVER);
|
||||
determineDriver();
|
||||
MessageBox::show(NULL, QMessageBox::Critical, tr("MySQL database not available"),
|
||||
tr("%1 cannot use MySQL storage, it is not available. %1 is now switching to SQLite database. Start your MySQL server "
|
||||
"and make adjustments in application settings.").arg(APP_NAME), QString(), QString());
|
||||
|
||||
return connection(objectName(), FromSettings);
|
||||
}
|
||||
else {
|
||||
QSqlQuery query_db(database);
|
||||
|
Loading…
Reference in New Issue
Block a user