mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-31 01:24:49 +01:00
Fixed #55.
This commit is contained in:
parent
c20bf626f4
commit
b465901118
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user