blob: 354c6a5a333d20e09156e9f9162aae0aebf8fabe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "syncclient.h"
bool SyncClient::updateSyncedServer(const QString &serverAddress,
const unsigned short &serverPort)
{
// update existing entry, but do not insert.
QSqlQuery q;
QString updateString;
// update with available values
updateString = "UPDATE serverlist SET "
"dt_sync = :timestamp "
"WHERE ip = :ip "
"AND queryport = :queryport";
// bind values and execute
q.prepare(updateString);
q.bindValue(":ip", serverAddress);
q.bindValue(":queryport", serverPort);
q.bindValue(":timestamp", QDateTime::currentSecsSinceEpoch() );
if ( ! q.exec() )
return reportQuery(q);
// was a row updated?
return (q.numRowsAffected() > 0);
}
|