- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
bool addPlayer(const Addr & addr,
Poco::Nullable<const std::string> serverAddr,
Poco::Nullable<bool> isKeyReceived,
Poco::Nullable<std::string> key,
Poco::Nullable<time_t> lastHashCheck,
Poco::Nullable<std::string> digest)
{
bool isPlaying = !serverAddr.isNull();
bool isKeyReceivedReal = isKeyReceived.isNull();
time_t lastHashCheckReal = lastHashCheck.isNull() ? time(0) : lastHashCheck.value();
std::string keyReal(key.isNull() ? "" : key.value());
std::string playerAddr = addr.getHost();
std::string serverAddrReal(serverAddr.isNull() ? "" : serverAddr.value());
std::string digestReal = digest.isNull() ? "" : digest.value();
Statement insert(*playersSession);
insert << "INSERT INTO Players VALUES(?, ?, ?, ?, ?, ?, ?)",
use(playerAddr), // Addr
use(serverAddrReal), // Server
use(isPlaying),
use(isKeyReceivedReal),
use(keyReal), // Key
use(lastHashCheckReal),
use(digestReal);
insert.execute();
return true;
}