mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
Fix query crashing
Just select all columns since we need most of them anyways
This commit is contained in:
parent
96fc6e81d8
commit
5bff441c01
@ -84,7 +84,7 @@ void Leaderboard::QueryToLdf(std::unique_ptr<sql::ResultSet>& rows) {
|
|||||||
entry.reserve(MAX_NUM_DATA_PER_ROW);
|
entry.reserve(MAX_NUM_DATA_PER_ROW);
|
||||||
entry.push_back(new LDFData<uint64_t>(u"CharacterID", rows->getInt("character_id")));
|
entry.push_back(new LDFData<uint64_t>(u"CharacterID", rows->getInt("character_id")));
|
||||||
entry.push_back(new LDFData<uint64_t>(u"LastPlayed", rows->getUInt64("lastPlayed")));
|
entry.push_back(new LDFData<uint64_t>(u"LastPlayed", rows->getUInt64("lastPlayed")));
|
||||||
entry.push_back(new LDFData<int32_t>(u"NumPlayed", 1));
|
entry.push_back(new LDFData<int32_t>(u"NumPlayed", rows->getInt("timesPlayed")));
|
||||||
entry.push_back(new LDFData<std::u16string>(u"name", GeneralUtils::ASCIIToUTF16(rows->getString("name").c_str())));
|
entry.push_back(new LDFData<std::u16string>(u"name", GeneralUtils::ASCIIToUTF16(rows->getString("name").c_str())));
|
||||||
entry.push_back(new LDFData<uint64_t>(u"RowNumber", rows->getInt("ranking")));
|
entry.push_back(new LDFData<uint64_t>(u"RowNumber", rows->getInt("ranking")));
|
||||||
switch (leaderboardType) {
|
switch (leaderboardType) {
|
||||||
@ -168,10 +168,11 @@ const std::string_view Leaderboard::GetOrdering(Leaderboard::Type leaderboardTyp
|
|||||||
void Leaderboard::SetupLeaderboard(uint32_t resultStart, uint32_t resultEnd) {
|
void Leaderboard::SetupLeaderboard(uint32_t resultStart, uint32_t resultEnd) {
|
||||||
resultStart++;
|
resultStart++;
|
||||||
resultEnd++;
|
resultEnd++;
|
||||||
|
// We need everything except 1 column so i'm selecting * from leaderboard
|
||||||
const std::string queryBase =
|
const std::string queryBase =
|
||||||
R"QUERY(
|
R"QUERY(
|
||||||
WITH leaderboardsRanked AS (
|
WITH leaderboardsRanked AS (
|
||||||
SELECT leaderboard.primaryScore, leaderboard.secondaryScore, leaderboard.tertiaryScore, charinfo.name,
|
SELECT leaderboard.*, charinfo.name,
|
||||||
RANK() OVER
|
RANK() OVER
|
||||||
(
|
(
|
||||||
ORDER BY %s, UNIX_TIMESTAMP(last_played) ASC, id DESC
|
ORDER BY %s, UNIX_TIMESTAMP(last_played) ASC, id DESC
|
||||||
|
@ -30,10 +30,10 @@ protected:
|
|||||||
Leaderboard leaderboard(gameID, infoType, false, 14231, type);
|
Leaderboard leaderboard(gameID, infoType, false, 14231, type);
|
||||||
leaderboard.SetupLeaderboard();
|
leaderboard.SetupLeaderboard();
|
||||||
leaderboard.Serialize(&bitStream);
|
leaderboard.Serialize(&bitStream);
|
||||||
// TestLeaderboard(leaderboard, 1);
|
TestLeaderboard(leaderboard, 1);
|
||||||
// TestLeaderboard(leaderboard, 10);
|
TestLeaderboard(leaderboard, 10);
|
||||||
// TestLeaderboard(leaderboard, 100);
|
TestLeaderboard(leaderboard, 100);
|
||||||
// TestLeaderboard(leaderboard, 1000);
|
TestLeaderboard(leaderboard, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
|
Loading…
Reference in New Issue
Block a user