corregidos bugs en la importaci?n y expotaci?n de informaci?n de c?mics

This commit is contained in:
Luis Ángel San Martín 2012-08-01 20:29:53 +02:00
parent 5f117a5252
commit 359505d817
2 changed files with 111 additions and 108 deletions

View File

@ -248,111 +248,7 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
{
QSqlQuery pragma("PRAGMA synchronous=OFF",destDB);
QSqlQuery update(destDB);
update.prepare("UPDATE comic_info SET "
"title = :title,"
"coverPage = :coverPage,"
"numPages = :numPages,"
"number = :number,"
"isBis = :isBis,"
"count = :count,"
"volume = :volume,"
"storyArc = :storyArc,"
"arcNumber = :arcNumber,"
"arcCount = :arcCount,"
"genere = :genere,"
"writer = :writer,"
"penciller = :penciller,"
"inker = :inker,"
"colorist = :colorist,"
"letterer = :letterer,"
"coverArtist = :coverArtist,"
"date = :date,"
"publisher = :publisher,"
"format = :format,"
"color = :color,"
"ageRating = :ageRating,"
"synopsis = :synopsis,"
"characters = :characters,"
"notes = :notes,"
"edited = :edited"
" WHERE hash = :hash ");
QSqlQuery insert(destDB);
insert.prepare("INSERT INTO comic_info "
"(title,"
"coverPage,"
"numPages,"
"number,"
"isBis,"
"count,"
"volume,"
"storyArc,"
"arcNumber,"
"arcCount,"
"genere,"
"writer,"
"penciller,"
"inker,"
"colorist,"
"letterer,"
"coverArtist,"
"date,"
"publisher,"
"format,"
"color,"
"ageRating,"
"synopsis,"
"characters,"
"notes,"
"read,"
"edited,"
"hash)"
"VALUES (:title,"
":coverPage,"
":numPages,"
":number,"
":isBis,"
":count,"
":volume,"
":storyArc,"
":arcNumber,"
":arcCount,"
":genere,"
":writer,"
":penciller,"
":inker,"
":colorist,"
":letterer,"
":coverArtist,"
":date,"
":publisher,"
":format,"
":color,"
":ageRating,"
":synopsis,"
":characters,"
":notes,"
":read,"
":edited,"
":hash )");
QSqlQuery newInfo(sourceDB);
newInfo.prepare("SELECT * FROM comic_info");
newInfo.exec();
@ -360,6 +256,112 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
int cp;
while (newInfo.next()) //cada tupla deberá ser insertada o actualizada
{
QSqlQuery update(destDB);
update.prepare("UPDATE comic_info SET "
"title = :title,"
"coverPage = :coverPage,"
"numPages = :numPages,"
"number = :number,"
"isBis = :isBis,"
"count = :count,"
"volume = :volume,"
"storyArc = :storyArc,"
"arcNumber = :arcNumber,"
"arcCount = :arcCount,"
"genere = :genere,"
"writer = :writer,"
"penciller = :penciller,"
"inker = :inker,"
"colorist = :colorist,"
"letterer = :letterer,"
"coverArtist = :coverArtist,"
"date = :date,"
"publisher = :publisher,"
"format = :format,"
"color = :color,"
"ageRating = :ageRating,"
"synopsis = :synopsis,"
"characters = :characters,"
"notes = :notes,"
"edited = :edited"
" WHERE hash = :hash ");
QSqlQuery insert(destDB);
insert.prepare("INSERT INTO comic_info "
"(title,"
"coverPage,"
"numPages,"
"number,"
"isBis,"
"count,"
"volume,"
"storyArc,"
"arcNumber,"
"arcCount,"
"genere,"
"writer,"
"penciller,"
"inker,"
"colorist,"
"letterer,"
"coverArtist,"
"date,"
"publisher,"
"format,"
"color,"
"ageRating,"
"synopsis,"
"characters,"
"notes,"
"read,"
"edited,"
"hash)"
"VALUES (:title,"
":coverPage,"
":numPages,"
":number,"
":isBis,"
":count,"
":volume,"
":storyArc,"
":arcNumber,"
":arcCount,"
":genere,"
":writer,"
":penciller,"
":inker,"
":colorist,"
":letterer,"
":coverArtist,"
":date,"
":publisher,"
":format,"
":color,"
":ageRating,"
":synopsis,"
":characters,"
":notes,"
":read,"
":edited,"
":hash )");
QSqlRecord record = newInfo.record();
cp = record.value("coverPage").toInt();
if(cp>1)
@ -396,11 +398,11 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
QString error1 = insert.lastError().databaseText();
QString error2 = insert.lastError().driverText();
QMessageBox::critical(NULL,"db",error1);
QMessageBox::critical(NULL,"driver",error2);
//QMessageBox::critical(NULL,"db",error1);
//QMessageBox::critical(NULL,"driver",error2);
}
update.finish();
insert.finish();
//update.finish();
//insert.finish();
}
}

View File

@ -1207,6 +1207,7 @@ void LibraryWindow::asignNumbers()
{
Comic c = comics[i];
c.info.setNumber(startingNumber+i);
c.info.edited = true;
c.info.update(db);
/*QString hash = comics[i].info.hash;
comics[i].info.setNumber(i+1);