Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Murmur: Add workaround for databases that contain channel_info rows f…

…or channels that don't exist
  • Loading branch information...
commit c17ca267d03426dce8993883e0993e81dc31796e 1 parent 88e9e6a
@pcgod pcgod authored
Showing with 14 additions and 8 deletions.
  1. +14 −8 src/murmur/ServerDB.cpp
View
22 src/murmur/ServerDB.cpp
@@ -1169,15 +1169,21 @@ Channel *Server::addChannel(Channel *p, const QString &name, bool temporary, int
query.addBindValue(id);
query.addBindValue(name);
SQLEXEC();
- }
- // Add channel sorting information
- SQLPREP("INSERT INTO `%1channel_info` ( `server_id`, `channel_id`, `key`, `value`) VALUES(?,?,?,?)");
- query.addBindValue(iServerNum);
- query.addBindValue(id);
- query.addBindValue(ServerDB::Channel_Position);
- query.addBindValue(QVariant(position).toString());
- SQLEXEC();
+ // Delete old channel_info rows
+ SQLPREP("DELETE FROM `%1channel_info` WHERE `server_id` = ? AND `channel_id` = ?");
+ query.addBindValue(iServerNum);
+ query.addBindValue(id);
+ SQLEXEC();
+
+ // Add channel sorting information
+ SQLPREP("INSERT INTO `%1channel_info` ( `server_id`, `channel_id`, `key`, `value`) VALUES(?,?,?,?)");
+ query.addBindValue(iServerNum);
+ query.addBindValue(id);
+ query.addBindValue(ServerDB::Channel_Position);
+ query.addBindValue(QVariant(position).toString());
+ SQLEXEC();
+ }
Channel *c = new Channel(id, name, p);
c->bTemporary = temporary;
Please sign in to comment.
Something went wrong with that request. Please try again.