From 3c7253d6cdc23aac36208fa87dc6571c7cb7c5ff Mon Sep 17 00:00:00 2001 From: Dark1-dev Date: Wed, 1 Mar 2023 21:33:55 +0600 Subject: Add files via upload --- Database/Common/existserver.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Database/Common/existserver.cpp (limited to 'Database/Common/existserver.cpp') diff --git a/Database/Common/existserver.cpp b/Database/Common/existserver.cpp new file mode 100644 index 0000000..9609948 --- /dev/null +++ b/Database/Common/existserver.cpp @@ -0,0 +1,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(); +} -- cgit v1.2.3