mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Merge pull request #1365 from woogerboy21/add_clientid_tosessions
Add clientid field to sessions table.
This commit is contained in:
commit
8bf58af727
6 changed files with 14 additions and 7 deletions
|
|
@ -536,7 +536,7 @@ bool Servatrice_DatabaseInterface::userSessionExists(const QString &userName)
|
|||
return query->next();
|
||||
}
|
||||
|
||||
qint64 Servatrice_DatabaseInterface::startSession(const QString &userName, const QString &address)
|
||||
qint64 Servatrice_DatabaseInterface::startSession(const QString &userName, const QString &address, const QString &clientId)
|
||||
{
|
||||
if (server->getAuthenticationMethod() == Servatrice::AuthenticationNone)
|
||||
return -1;
|
||||
|
|
@ -544,10 +544,11 @@ qint64 Servatrice_DatabaseInterface::startSession(const QString &userName, const
|
|||
if (!checkSql())
|
||||
return -1;
|
||||
|
||||
QSqlQuery *query = prepareQuery("insert into {prefix}_sessions (user_name, id_server, ip_address, start_time) values(:user_name, :id_server, :ip_address, NOW())");
|
||||
QSqlQuery *query = prepareQuery("insert into {prefix}_sessions (user_name, id_server, ip_address, start_time, clientid) values(:user_name, :id_server, :ip_address, NOW(), :client_id)");
|
||||
query->bindValue(":user_name", userName);
|
||||
query->bindValue(":id_server", server->getServerId());
|
||||
query->bindValue(":ip_address", address);
|
||||
query->bindValue(":client_id", clientId);
|
||||
if (execSqlQuery(query))
|
||||
return query->lastInsertId().toInt();
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue