aboutsummaryrefslogtreecommitdiff
path: root/Database/Common/existserver.cpp
blob: 9609948cc16cbe275f26a54ae78d599fbd7223dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "commonactions.h"

bool existServer(const QString         &serverAddress,
                 const unsigned short  &serverPort)
{
    // find existing entry
    QSqlQuery q;
    QString selectString = "SELECT id FROM serverlist "
                           "WHERE ip = :ip AND queryport = :queryport ";

    // bind values and execute
    q.prepare(selectString);
    q.bindValue(":ip", serverAddress);
    q.bindValue(":queryport", serverPort);

    if ( ! q.exec() )
        return reportQuery(q);

    // was a row/server found?
    return q.next();
}