delete dbresults in more cases, some printing, using getclientserial
This commit is contained in:
@@ -184,12 +184,16 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
|
||||
{
|
||||
if(!db || strlen(error))
|
||||
{
|
||||
delete results;
|
||||
LogError("Database error: %s", error);
|
||||
return;
|
||||
}
|
||||
static Handle hHostName;
|
||||
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
char line[g_dLength];
|
||||
GetConVarString(hHostName, line, sizeof(line));
|
||||
if (StrContains(line, "EVENT", false) > -1)
|
||||
@@ -204,6 +208,7 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
|
||||
if (IsValidClient(i))
|
||||
OnClientPostAdminCheck(i);
|
||||
AddBinarySearchIndex();
|
||||
delete results;
|
||||
}
|
||||
|
||||
public void MYSQLCheckMapEntry()
|
||||
@@ -238,15 +243,16 @@ public void MYSQLCheckMapEntry()
|
||||
|
||||
public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
{
|
||||
if (!db || strlen(error))
|
||||
{
|
||||
char sQuery[g_dLength];
|
||||
ResetPack(data);
|
||||
data.ReadString(sQuery, sizeof(sQuery));
|
||||
LogError("Query error 3: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
}
|
||||
delete data;
|
||||
delete results;
|
||||
if (!db || strlen(error))
|
||||
{
|
||||
char sQuery[g_dLength];
|
||||
ResetPack(data);
|
||||
data.ReadString(sQuery, sizeof(sQuery));
|
||||
LogError("Query error 3: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
}
|
||||
delete data;
|
||||
}
|
||||
|
||||
//a mysql table can max have 64 keys attached to it without recompiling. Therefore dropping and attaching binary tree index on the given map start, map end,
|
||||
@@ -416,17 +422,28 @@ public void client_ignoring_racetimer(int client)
|
||||
char steam_auth[g_dIndex];
|
||||
GetClientAuthId(client, AuthId_Steam2, steam_auth, sizeof(steam_auth));
|
||||
Format(query, sizeof(query), "SELECT is_ignoring FROM `zetimer_table_new_ignoring` where steam_auth = '%s'", steam_auth);
|
||||
g_dDatabase.Query(SQL_OnQueryCompleted_ignoring, query, client);
|
||||
|
||||
g_dDatabase.Query(SQL_OnQueryCompleted_ignoring, query, GetClientSerial(client));
|
||||
}
|
||||
|
||||
public void SQL_OnQueryCompleted_ignoring(Database db, DBResultSet results, const char[] error, int client)
|
||||
public void SQL_OnQueryCompleted_ignoring(Database db, DBResultSet results, const char[] error, int Serial)
|
||||
{
|
||||
if (!db)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
if (!IsValidClient(client))
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
int val = 0;
|
||||
if (results.RowCount && results.FetchRow())
|
||||
val = results.FetchInt(0);
|
||||
@@ -435,6 +452,7 @@ public void SQL_OnQueryCompleted_ignoring(Database db, DBResultSet results, cons
|
||||
{
|
||||
g_bClientsIgnoring[client] = true;
|
||||
}
|
||||
delete results;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@@ -689,6 +707,7 @@ public void unloze_zoneLeave(int client, char[] zone)
|
||||
}
|
||||
if (!g_bClient_allowed_to_leave_again[client])
|
||||
{
|
||||
PrintToChat(client, "Did not start timer due to teleport cooldown.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -767,16 +786,16 @@ public void FinishedStageRaceZone(int client)
|
||||
}
|
||||
if (l_iZoneCount > 1)
|
||||
CPrintToChat(client, "{green}[UNLOZE] Stage: %i", player_stage[client]);
|
||||
CPrintToChat(client, "{green}[UNLOZE] Client: %N Time: %06.3f", client, client_time);
|
||||
CPrintToChat(client, "{green}[UNLOZE] Time: %06.3f", client_time);
|
||||
int stage = player_stage[client];
|
||||
char sQuery[g_dLength];
|
||||
if (StrEqual(g_csTime_record[client], "0.000"))
|
||||
{
|
||||
CPrintToChat(client, "Your record: None yet\nCommand: !toptime !mytime !stages");
|
||||
CPrintToChat(client, "{green}[UNLOZE] Your record: None yet\nCommand: !toptime !mytime !stages");
|
||||
}
|
||||
else
|
||||
{
|
||||
CPrintToChat(client, "Your record: %s\nCommand: !toptime !mytime !stages", g_csTime_record[client]);
|
||||
CPrintToChat(client, "{green}[UNLOZE] Your record: %s\nCommand: !toptime !mytime !stages", g_csTime_record[client]);
|
||||
}
|
||||
if (l_iZoneCount < 2)
|
||||
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table_new` SET `%s` = '%06.3f', name = '%s' WHERE steam_auth = '%s'", g_cMapname, client_time, sEscapedName, sSID);
|
||||
@@ -835,18 +854,24 @@ public void SQL_OnQueryCompleted_retry(Database db, DBResultSet results, const c
|
||||
delete data;
|
||||
if (!db)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
if (strlen(error))
|
||||
{
|
||||
delete results;
|
||||
mysql_get_player_time(client, 1);
|
||||
return;
|
||||
}
|
||||
if (results.RowCount && results.FetchRow())
|
||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
||||
delete results;
|
||||
}
|
||||
|
||||
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||
@@ -860,14 +885,19 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
||||
LogError("Query error 1: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
delete data;
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
delete data;
|
||||
int client;
|
||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
if (results.RowCount && results.FetchRow())
|
||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
||||
delete results;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -1027,7 +1057,10 @@ public void SQL_Select_Top_Callback(Database db, DBResultSet results, const char
|
||||
delete data;
|
||||
int iclient;
|
||||
if ((iclient = GetClientFromSerial(client_serial)) == 0)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
//Player Name
|
||||
char[] g_cPlayerName = new char[MAX_NAME_LENGTH];
|
||||
char g_cContent[g_dLength];
|
||||
@@ -1060,6 +1093,7 @@ public void SQL_Select_Top_Callback(Database db, DBResultSet results, const char
|
||||
menu.ExitButton = true;
|
||||
menu.Display(iclient, 0);
|
||||
}
|
||||
delete results;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@@ -1196,15 +1230,15 @@ public Action cmd_timerCheckSelf(int client, int args)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void deleteClientTime(char[] steam2, int stage)
|
||||
{
|
||||
char l_cQuery[g_dLength];
|
||||
int l_iZoneCount = unloze_zoneCount();
|
||||
if (l_iZoneCount > 1)
|
||||
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%sS%i` = 0.000 WHERE steam_auth = '%s'", g_cMapname, stage, steam2);
|
||||
else
|
||||
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%s` = 0.000 WHERE steam_auth = '%s'", g_cMapname, steam2);
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteString(l_cQuery);
|
||||
g_dDatabase.Query(SQL_FinishedQuery, l_cQuery, hDataPack, DBPrio_Normal);
|
||||
char l_cQuery[g_dLength];
|
||||
int l_iZoneCount = unloze_zoneCount();
|
||||
if (l_iZoneCount > 1)
|
||||
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%sS%i` = 0.000 WHERE steam_auth = '%s'", g_cMapname, stage, steam2);
|
||||
else
|
||||
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%s` = 0.000 WHERE steam_auth = '%s'", g_cMapname, steam2);
|
||||
DataPack hDataPack = new DataPack();
|
||||
hDataPack.WriteString(l_cQuery);
|
||||
g_dDatabase.Query(SQL_FinishedQuery, l_cQuery, hDataPack, DBPrio_Normal);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@@ -1260,6 +1294,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
||||
LogError("Query error 4: %s", error);
|
||||
LogError("actual query: %s", sQuery);
|
||||
delete data;
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
delete data;
|
||||
@@ -1267,7 +1302,10 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
||||
char[] l_cPlayerName = new char[MAX_NAME_LENGTH];
|
||||
int iclient;
|
||||
if ((iclient = GetClientFromSerial(client_serial)) == 0)
|
||||
{
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
if (results.RowCount && results.FetchRow())
|
||||
{
|
||||
results.FetchString(0, l_cPlayerName, MAX_NAME_LENGTH);
|
||||
@@ -1275,6 +1313,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
||||
if (fTime == 0.0)
|
||||
{
|
||||
CPrintToChat(iclient, "You have no time yet!");
|
||||
delete results;
|
||||
return;
|
||||
}
|
||||
fTime += 0.001;
|
||||
@@ -1283,6 +1322,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
||||
}
|
||||
else
|
||||
CPrintToChat(iclient, "You have no time yet!");
|
||||
delete results;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user