updated VERSION to 7.0.0

fixed updateToCurrentVersion
This commit is contained in:
Luis Ángel San Martín 2013-11-21 14:33:11 +01:00
parent f8dff1390f
commit f029224d1c
2 changed files with 11 additions and 6 deletions

View File

@ -169,7 +169,7 @@ bool DataBaseManagement::createTables(QSqlDatabase & database)
"hash TEXT UNIQUE NOT NULL," "hash TEXT UNIQUE NOT NULL,"
"edited BOOLEAN DEFAULT 0," "edited BOOLEAN DEFAULT 0,"
"read BOOLEAN DEFAULT 0," "read BOOLEAN DEFAULT 0,"
//now 7.0 fields //new 7.0 fields
"hasBeenOpened BOOLEAN DEFAULT 0," "hasBeenOpened BOOLEAN DEFAULT 0,"
"rating INTEGER DEFAULT 0," "rating INTEGER DEFAULT 0,"
@ -551,9 +551,13 @@ int DataBaseManagement::compareVersions(const QString & v1, const QString v2)
bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath) bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath)
{ {
bool pre7 = false;
if(compareVersions(DataBaseManagement::checkValidDB(fullPath),"7.0.0")<0)
pre7 = true;
QSqlDatabase db = loadDatabaseFromFile(fullPath); QSqlDatabase db = loadDatabaseFromFile(fullPath);
bool returnValue = false; bool returnValue = false;
if(db.isValid() && db.isOpen()) if(db.isValid() && db.isOpen())
{ {
QSqlQuery updateVersion(db); QSqlQuery updateVersion(db);
updateVersion.prepare("UPDATE db_info SET " updateVersion.prepare("UPDATE db_info SET "
@ -562,8 +566,9 @@ bool DataBaseManagement::updateToCurrentVersion(const QString & fullPath)
updateVersion.exec(); updateVersion.exec();
if(updateVersion.numRowsAffected() > 0) if(updateVersion.numRowsAffected() > 0)
returnValue = true; returnValue = true;
if(returnValue) //TODO: execute only if previous version was < 7.0
if(pre7) //TODO: execute only if previous version was < 7.0
{ {
//new 7.0 fields //new 7.0 fields
QStringList columnDefs; QStringList columnDefs;
@ -629,4 +634,4 @@ void ComicsInfoImporter::importComicsInfo(QSqlDatabase & source, QSqlDatabase &
void ComicsInfoImporter::run() void ComicsInfoImporter::run()
{ {
} }

View File

@ -8,7 +8,7 @@
#endif #endif
#define VERSION "6.5.3" #define VERSION "7.0.0"
#define PATH "PATH" #define PATH "PATH"
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE" #define MAG_GLASS_SIZE "MAG_GLASS_SIZE"