implemented SetPlayerLastGames db function

This commit is contained in:
Kai Philipp
2019-09-11 04:36:54 +02:00
parent ecf5996135
commit afcec9d39a
7 changed files with 50 additions and 17 deletions
+26
View File
@@ -230,6 +230,32 @@ ServerDBThread::SetGamePlayerPlace(unsigned requestId, DB_id playerId, unsigned
m_semaphore.post();
}
void
ServerDBThread::SetPlayerLastGames(unsigned requestId, DB_id playerId, std::vector lastGames)
{
// The game id param is added later (during init of the async op), because it may be unknown.
string lastGamesFieldValue = "1,2,3";
list<string> params;
ostringstream paramStream;
paramStream << playerId;
params.push_back(paramStream.str());
paramStream.str("");
paramStream << lastGamesFieldValue;
params.push_back(paramStream.str());
// boost::shared_ptr<AsyncDBQuery> asyncQuery(
// new AsyncDBGamePlace(
// requestId,
// QUERY_PLAYER_LASTGAMES_PREPARE,
// params));
// {
// boost::mutex::scoped_lock lock(m_asyncQueueMutex);
// m_asyncQueue.push(asyncQuery);
// }
LOG_ERROR("reached ServerDBThread::SetPlayerLastGames() post query ");
m_semaphore.post();
}
void
ServerDBThread::EndGame(unsigned requestId)
{
+3
View File
@@ -42,6 +42,8 @@
#include <dbofficial/dbidmanager.h>
#include <core/thread.h>
//#include <vector>
struct DBConnectionData;
class AsyncDBQuery;
@@ -66,6 +68,7 @@ public:
virtual void AsyncCreateGame(unsigned requestId, const std::string &gameName);
virtual void SetGamePlayerPlace(unsigned requestId, DB_id playerId, unsigned place);
virtual void SetPlayerLastGames(unsigned requestId, DB_id playerId, std::vector lastGames);
virtual void EndGame(unsigned requestId);
virtual void AsyncReportAvatar(unsigned requestId, unsigned replyId, DB_id reportedPlayerId, const std::string &avatarHash, const std::string &avatarType, DB_id *byPlayerId);