Support better indexes for Servatrice

- Prevent searching only on msg for logs
This commit is contained in:
ZeldaZach 2024-12-31 20:59:32 -05:00
parent ded6d5b8eb
commit d057d80757
No known key found for this signature in database
4 changed files with 25 additions and 5 deletions

View file

@ -1210,6 +1210,11 @@ QList<ServerInfo_ChatMessage> Servatrice_DatabaseInterface::getMessageLogHistory
if (!checkSql())
return results;
if (user.isEmpty() && ipaddress.isEmpty() && gameid.isEmpty() && gamename.isEmpty()) {
// To ensure quick results and minimal lag, require an indexed field
return results;
}
// BUILD QUERY STRING BASED ON PASSED IN VALUES
QString queryString = "SELECT * FROM {prefix}_log WHERE `sender_ip` IS NOT NULL";
if (!user.isEmpty())

View file

@ -9,7 +9,7 @@
#include <QObject>
#include <QSqlDatabase>
#define DATABASE_SCHEMA_VERSION 30
#define DATABASE_SCHEMA_VERSION 31
class Servatrice;