X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fabstractsqlstorage.cpp;h=6886c0fa89c8ba9375839d4fdfde94d22ec144cf;hb=e497bef2a6bd36874192ebef7fd1899ce28f7c9c;hp=618c929b604ecd9512faf6255f18167e75dfb0bc;hpb=5e5714fb2abf8feaf9cc4a27a26e86f2f9c45b30;p=quassel.git diff --git a/src/core/abstractsqlstorage.cpp b/src/core/abstractsqlstorage.cpp index 618c929b..6886c0fa 100644 --- a/src/core/abstractsqlstorage.cpp +++ b/src/core/abstractsqlstorage.cpp @@ -26,10 +26,10 @@ #include #include +int AbstractSqlStorage::_nextConnectionId = 0; AbstractSqlStorage::AbstractSqlStorage(QObject *parent) : Storage(parent), - _schemaVersion(0), - _nextConnectionId(0) + _schemaVersion(0) { } @@ -37,6 +37,7 @@ AbstractSqlStorage::~AbstractSqlStorage() { // disconnect the connections, so their deletion is no longer interessting for us QHash::iterator conIter; for(conIter = _connectionPool.begin(); conIter != _connectionPool.end(); conIter++) { + QSqlDatabase::removeDatabase(conIter.value()->name()); disconnect(conIter.value(), 0, this, 0); } } @@ -350,11 +351,11 @@ AbstractSqlMigrationReader::AbstractSqlMigrationReader() bool AbstractSqlMigrationReader::migrateTo(AbstractSqlMigrationWriter *writer) { if(!transaction()) { - qWarning() << "AbstractSqlMigrationReader::migrateTo(): unable to start reader stransaction!"; + qWarning() << "AbstractSqlMigrationReader::migrateTo(): unable to start reader's transaction!"; return false; } if(!writer->transaction()) { - qWarning() << "AbstractSqlMigrationReader::migrateTo(): unable to start writer stransaction!"; + qWarning() << "AbstractSqlMigrationReader::migrateTo(): unable to start writer's transaction!"; rollback(); // close the reader transaction; return false; } @@ -366,10 +367,6 @@ bool AbstractSqlMigrationReader::migrateTo(AbstractSqlMigrationWriter *writer) { if(!transferMo(QuasselUser, quasselUserMo)) return false; - SenderMO senderMo; - if(!transferMo(Sender, senderMo)) - return false; - IdentityMO identityMo; if(!transferMo(Identity, identityMo)) return false; @@ -386,6 +383,10 @@ bool AbstractSqlMigrationReader::migrateTo(AbstractSqlMigrationWriter *writer) { if(!transferMo(Buffer, bufferMo)) return false; + SenderMO senderMo; + if(!transferMo(Sender, senderMo)) + return false; + BacklogMO backlogMo; if(!transferMo(Backlog, backlogMo)) return false; @@ -455,6 +456,7 @@ bool AbstractSqlMigrationReader::transferMo(MigrationObject moType, T &mo) { int i = 0; QFile file; file.open(stdout, QIODevice::WriteOnly); + while(readMo(mo)) { if(!_writer->writeMo(mo)) { abortMigration(QString("AbstractSqlMigrationReader::transferMo(): unable to transfer Migratable Object of type %1!").arg(AbstractSqlMigrator::migrationObject(moType))); @@ -470,6 +472,7 @@ bool AbstractSqlMigrationReader::transferMo(MigrationObject moType, T &mo) { file.write("\n"); file.flush(); } + qDebug() << "Done."; return true; }