added bandaid fix for when select queries select 0 instead of S1
This commit is contained in:
parent
01eca3456e
commit
470a5199c4
@ -754,17 +754,46 @@ public void FinishedStageRaceZone(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void mysql_get_player_time(int client, int stage)
|
||||
{
|
||||
char query[g_dLength];
|
||||
char steam_auth[g_dIndex];
|
||||
GetClientAuthId(client, AuthId_Steam2, steam_auth, sizeof(steam_auth));
|
||||
if (!stage)
|
||||
Format(query, sizeof(query), "SELECT `%s` FROM `zetimer_table_new` where steam_auth = '%s'", g_cMapname, steam_auth);
|
||||
else
|
||||
Format(query, sizeof(query), "SELECT `%sS%i` FROM `zetimer_table_new` where steam_auth = '%s'", g_cMapname, stage, steam_auth);
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteCell(GetClientSerial(client));
|
||||
char query[g_dLength];
|
||||
char steam_auth[g_dIndex];
|
||||
GetClientAuthId(client, AuthId_Steam2, steam_auth, sizeof(steam_auth));
|
||||
if (!stage)
|
||||
{
|
||||
Format(query, sizeof(query), "SELECT `%s` FROM `zetimer_table_new` where steam_auth = '%s'", g_cMapname, steam_auth);
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteCell(GetClientSerial(client));
|
||||
g_dDatabase.Query(SQL_OnQueryCompleted_retry, query, hDataPack);
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(query, sizeof(query), "SELECT `%sS%i` FROM `zetimer_table_new` where steam_auth = '%s'", g_cMapname, stage, steam_auth);
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteCell(GetClientSerial(client));
|
||||
hDataPack.WriteString(query);
|
||||
g_dDatabase.Query(SQL_OnQueryCompleted, query, hDataPack);
|
||||
g_dDatabase.Query(SQL_OnQueryCompleted, query, hDataPack);
|
||||
}
|
||||
}
|
||||
|
||||
//we only enter here when stage is 0. that might however be incorrect as it instead might need to be S1. Simply a band aid instead of fixing actual problem.
|
||||
public void SQL_OnQueryCompleted_retry(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
{
|
||||
ResetPack(data);
|
||||
int client_serial = data.ReadCell();
|
||||
delete data;
|
||||
if (!db)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||
return;
|
||||
if (strlen(error))
|
||||
{
|
||||
mysql_get_player_time(client, 1);
|
||||
return;
|
||||
}
|
||||
if (results.RowCount && results.FetchRow())
|
||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
||||
}
|
||||
|
||||
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
|
Loading…
Reference in New Issue
Block a user