projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes #609 - bufferview not correctly sorted
[quassel.git]
/
src
/
core
/
postgresqlstorage.cpp
diff --git
a/src/core/postgresqlstorage.cpp
b/src/core/postgresqlstorage.cpp
index
0421224
..
143adbb
100644
(file)
--- a/
src/core/postgresqlstorage.cpp
+++ b/
src/core/postgresqlstorage.cpp
@@
-61,10
+61,18
@@
QString PostgreSqlStorage::description() const {
return tr("PostgreSQL Turbo Bomber HD!");
}
return tr("PostgreSQL Turbo Bomber HD!");
}
-QVariantMap PostgreSqlStorage::setupKeys() const {
+QStringList PostgreSqlStorage::setupKeys() const {
+ QStringList keys;
+ keys << "Username"
+ << "Password"
+ << "Hostname"
+ << "Port"
+ << "Database";
+ return keys;
+}
+QVariantMap PostgreSqlStorage::setupDefaults() const {
QVariantMap map;
map["Username"] = QVariant(QString("quassel"));
QVariantMap map;
map["Username"] = QVariant(QString("quassel"));
- map["Password"] = QVariant(QString());
map["Hostname"] = QVariant(QString("localhost"));
map["Port"] = QVariant(5432);
map["Database"] = QVariant(QString("quassel"));
map["Hostname"] = QVariant(QString("localhost"));
map["Port"] = QVariant(5432);
map["Database"] = QVariant(QString("quassel"));
@@
-529,7
+537,7
@@
NetworkId PostgreSqlStorage::createNetwork(UserId user, const NetworkInfo &info)
}
if(!db.commit()) {
}
if(!db.commit()) {
- qWarning() << "PostgreSqlStorage::
upd
ateNetwork(): commiting data failed!";
+ qWarning() << "PostgreSqlStorage::
cre
ateNetwork(): commiting data failed!";
qWarning() << " -" << qPrintable(db.lastError().text());
return NetworkId();
}
qWarning() << " -" << qPrintable(db.lastError().text());
return NetworkId();
}
@@
-991,7
+999,7
@@
bool PostgreSqlStorage::removeBuffer(const UserId &user, const BufferId &bufferI
return false;
case 1:
db.commit();
return false;
case 1:
db.commit();
- return
fals
e;
+ return
tru
e;
default:
// there was more then one buffer deleted...
qWarning() << "PostgreSqlStorage::removeBuffer(): Userid" << user << "BufferId" << "caused deletion of" << numRows << "Buffers! Rolling back transaction...";
default:
// there was more then one buffer deleted...
qWarning() << "PostgreSqlStorage::removeBuffer(): Userid" << user << "BufferId" << "caused deletion of" << numRows << "Buffers! Rolling back transaction...";
@@
-1027,7
+1035,7
@@
bool PostgreSqlStorage::renameBuffer(const UserId &user, const BufferId &bufferI
return false;
case 1:
db.commit();
return false;
case 1:
db.commit();
- return
fals
e;
+ return
tru
e;
default:
// there was more then one buffer deleted...
qWarning() << "PostgreSqlStorage::renameBuffer(): Userid" << user << "BufferId" << "affected" << numRows << "Buffers! Rolling back transaction...";
default:
// there was more then one buffer deleted...
qWarning() << "PostgreSqlStorage::renameBuffer(): Userid" << user << "BufferId" << "affected" << numRows << "Buffers! Rolling back transaction...";
@@
-1490,6
+1498,7
@@
bool PostgreSqlMigrationWriter::prepareQuery(MigrationObject mo) {
query = queryString("migrate_write_sender");
break;
case Identity:
query = queryString("migrate_write_sender");
break;
case Identity:
+ _validIdentities.clear();
query = queryString("migrate_write_identity");
break;
case IdentityNick:
query = queryString("migrate_write_identity");
break;
case IdentityNick:
@@
-1532,6
+1541,7
@@
bool PostgreSqlMigrationWriter::writeMo(const SenderMO &sender) {
//bool PostgreSqlMigrationWriter::writeIdentity(const IdentityMO &identity) {
bool PostgreSqlMigrationWriter::writeMo(const IdentityMO &identity) {
//bool PostgreSqlMigrationWriter::writeIdentity(const IdentityMO &identity) {
bool PostgreSqlMigrationWriter::writeMo(const IdentityMO &identity) {
+ _validIdentities << identity.id.toInt();
bindValue(0, identity.id.toInt());
bindValue(1, identity.userid.toInt());
bindValue(2, identity.identityname);
bindValue(0, identity.id.toInt());
bindValue(1, identity.userid.toInt());
bindValue(2, identity.identityname);
@@
-1569,7
+1579,10
@@
bool PostgreSqlMigrationWriter::writeMo(const NetworkMO &network) {
bindValue(0, network.networkid.toInt());
bindValue(1, network.userid.toInt());
bindValue(2, network.networkname);
bindValue(0, network.networkid.toInt());
bindValue(1, network.userid.toInt());
bindValue(2, network.networkname);
- bindValue(3, network.identityid.toInt());
+ if(_validIdentities.contains(network.identityid.toInt()))
+ bindValue(3, network.identityid.toInt());
+ else
+ bindValue(3, QVariant());
bindValue(4, network.encodingcodec);
bindValue(5, network.decodingcodec);
bindValue(6, network.servercodec);
bindValue(4, network.encodingcodec);
bindValue(5, network.decodingcodec);
bindValue(6, network.servercodec);
@@
-1649,6
+1662,7
@@
bool PostgreSqlMigrationWriter::postProcess() {
QSqlDatabase db = logDb();
QList<Sequence> sequences;
sequences << Sequence("backlog", "messageid")
QSqlDatabase db = logDb();
QList<Sequence> sequences;
sequences << Sequence("backlog", "messageid")
+ << Sequence("buffer", "bufferid")
<< Sequence("identity", "identityid")
<< Sequence("identity_nick", "nickid")
<< Sequence("ircserver", "serverid")
<< Sequence("identity", "identityid")
<< Sequence("identity_nick", "nickid")
<< Sequence("ircserver", "serverid")