This commit is contained in:
Martin Rotter 2014-09-13 15:16:59 +02:00
parent c20bf626f4
commit b465901118
3 changed files with 29 additions and 2 deletions

View File

@ -1,4 +1,19 @@
<body>
<center><h2>2.0.0.2</h2></center>
Fixed:
<ul>
</ul>
Added:
<ul>
<li>MySQL backend now alows to defragment/optimize RSS Guard database.</li>
</ul>
Changed:
</ul>
<hr/>
<center><h2>2.0.0.1</h2></center>
Fixed:

View File

@ -428,8 +428,8 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
query_db.exec(statement);
if (query_db.lastError().isValid()) {
qFatal("MySQL database initialization failed. Initialization script '%s' is not correct.",
APP_DB_MYSQL_INIT);
qFatal("MySQL database initialization failed. Initialization script '%s' is not correct. Error : '%s'.",
APP_DB_MYSQL_INIT, qPrintable(query_db.lastError().databaseText()));
}
}
@ -453,6 +453,13 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
return database;
}
bool DatabaseFactory::mysqlVacuumDatabase() {
QSqlDatabase database = mysqlConnection(objectName());
QSqlQuery query_vacuum(database);
return query_vacuum.exec("OPTIMIZE TABLE rssguard.feeds;") && query_vacuum.exec("OPTIMIZE TABLE rssguard.messages;");
}
QSqlDatabase DatabaseFactory::sqliteConnection(const QString &connection_name,
DatabaseFactory::DesiredType desired_type) {
if (desired_type == DatabaseFactory::StrictlyInMemory ||
@ -548,6 +555,8 @@ bool DatabaseFactory::vacuumDatabase() {
return sqliteVacuumDatabase();
case MYSQL:
return mysqlVacuumDatabase();
default:
return false;
}

View File

@ -107,6 +107,9 @@ class DatabaseFactory : public QObject {
// Initializes MySQL database.
QSqlDatabase mysqlInitializeDatabase(const QString &connection_name);
// Runs "VACUUM" on the database.
bool mysqlVacuumDatabase();
// True if MySQL database is fully initialized for use,
// otherwise false.
bool m_mysqlDatabaseInitialized;