/***************************************************************************
- * Copyright (C) 2005-2016 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
}
+QMap<UserId, QString> SqliteStorage::getAllAuthUserNames()
+{
+ QMap<UserId, QString> authusernames;
+
+ QSqlDatabase db = logDb();
+ db.transaction();
+ {
+ QSqlQuery query(db);
+ query.prepare(queryString("select_all_authusernames"));
+
+ lockForRead();
+ safeExec(query);
+ watchQuery(query);
+ while (query.next()) {
+ authusernames[query.value(0).toInt()] = query.value(1).toString();
+ }
+ }
+ db.commit();
+ unlock();
+ return authusernames;
+}
+
+
+QString SqliteStorage::getAuthUserName(UserId user) {
+ QString authusername;
+ QSqlQuery query(logDb());
+ query.prepare(queryString("select_authusername"));
+ query.bindValue(":userid", user.toInt());
+
+ lockForRead();
+ safeExec(query);
+ watchQuery(query);
+ unlock();
+
+ if (query.first()) {
+ authusername = query.value(0).toString();
+ }
+
+ return authusername;
+}
+
+
QString SqliteStorage::backlogFile()
{
return Quassel::configDirPath() + "quassel-storage.sqlite";
switch (query.lastError().number()) {
case 5: // SQLITE_BUSY 5 /* The database file is locked */
- [[fallthrough]];
+ [[clang::fallthrough]];
case 6: // SQLITE_LOCKED 6 /* A table in the database is locked */
if (retryCount < _maxRetryCount)
return safeExec(query, retryCount + 1);