mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Implement support for displaying exact type instead of the catch-them-all category OTHER. The OTHER category is still used when it comes to computing statistics to ensure your chart's legend does not explode.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -125,7 +125,16 @@ void DB_save_queries(void)
|
||||
sqlite3_bind_int(stmt, 1, query->timestamp);
|
||||
|
||||
// TYPE
|
||||
sqlite3_bind_int(stmt, 2, query->type);
|
||||
if(query->type != TYPE_OTHER)
|
||||
{
|
||||
// Store mapped type if query->type is not OTHER
|
||||
sqlite3_bind_int(stmt, 2, query->type);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Store query type + offset if query-> type is OTHER
|
||||
sqlite3_bind_int(stmt, 2, query->qtype + 100);
|
||||
}
|
||||
|
||||
// STATUS
|
||||
sqlite3_bind_int(stmt, 3, query->status);
|
||||
@@ -344,7 +353,9 @@ void DB_read_queries(void)
|
||||
}
|
||||
|
||||
const int type = sqlite3_column_int(stmt, 2);
|
||||
if(type < TYPE_A || type >= TYPE_MAX)
|
||||
const bool mapped_type = type >= TYPE_A && type < TYPE_MAX;
|
||||
const bool offset_type = type > 100 && type < (100 + UINT16_MAX);
|
||||
if(!mapped_type && !offset_type)
|
||||
{
|
||||
logg("FTL_db warn: TYPE should not be %i", type);
|
||||
continue;
|
||||
@@ -423,7 +434,18 @@ void DB_read_queries(void)
|
||||
queriesData* query = getQuery(queryIndex, false);
|
||||
query->magic = MAGICBYTE;
|
||||
query->timestamp = queryTimeStamp;
|
||||
query->type = type;
|
||||
if(type < 100)
|
||||
{
|
||||
// Mapped query type
|
||||
query->type = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Offset query type
|
||||
query->type = TYPE_OTHER;
|
||||
query->qtype = type - 100;
|
||||
}
|
||||
|
||||
query->status = status;
|
||||
query->domainID = domainID;
|
||||
query->clientID = clientID;
|
||||
|
||||
Reference in New Issue
Block a user