further sql syntax fixes and reduced rows size

This commit is contained in:
Christian 2021-03-02 01:24:04 +01:00
parent 63fa29c720
commit 795fcaca34

View File

@ -130,7 +130,7 @@ public void MYSQLCheckMapEntry()
char l_cZoneIndexName[g_dIndex][g_dLength];
if (l_iZoneCount == 1)
{
Format(sQuery, sizeof(sQuery), "ALTER TABLE `zetimer_table` ADD COLUMN IF NOT EXISTS `%s` VARCHAR(256) DEFAULT '0.000' NOT NULL", g_cMapname);
Format(sQuery, sizeof(sQuery), "ALTER TABLE `zetimer_table` ADD COLUMN IF NOT EXISTS `%s` VARCHAR(12) DEFAULT '0.000' NOT NULL", g_cMapname);
DataPack hDataPack = new DataPack();
hDataPack.WriteString(sQuery);
g_dDatabase.Query(SQL_FinishedQuery, sQuery, hDataPack, DBPrio_High);
@ -142,7 +142,7 @@ public void MYSQLCheckMapEntry()
if (IsCorrectZone(iterator, l_cZoneIndexName[iterator][g_dLength -1], "ZONE_PREFIX_RACE"))
{
l_iRaceCount++;
Format(sQuery, sizeof(sQuery), "ALTER TABLE `zetimer_table` ADD COLUMN IF NOT EXISTS `%sS%i` VARCHAR(256) DEFAULT '0.000' NOT NULL", g_cMapname, l_iRaceCount);
Format(sQuery, sizeof(sQuery), "ALTER TABLE `zetimer_table` ADD COLUMN IF NOT EXISTS `%sS%i` VARCHAR(12) DEFAULT '0.000' NOT NULL", g_cMapname, l_iRaceCount);
DataPack hDataPack = new DataPack();
hDataPack.WriteString(sQuery);
g_dDatabase.Query(SQL_FinishedQuery, sQuery, hDataPack, DBPrio_High);
@ -536,17 +536,17 @@ public void FinishedStageRaceZone(int client)
int stage = player_stage[client];
char sQuery[g_dLength];
if (l_iZoneCount < 2)
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = %s, name = '%s' WHERE steam_auth = '%s' and LENGTH(`%s`) >= LENGTH(%s) and STRCMP(`%s`, %s) > 0", g_cMapname, sTime, sEscapedName, sSID, g_cMapname, sTime, g_cMapname, sTime);
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = '%s', name = '%s' WHERE steam_auth = '%s' and LENGTH(`%s`) >= LENGTH('%s') and STRCMP(`%s`, '%s') > 0", g_cMapname, sTime, sEscapedName, sSID, g_cMapname, sTime, g_cMapname, sTime);
else
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = %s, name = '%s' WHERE steam_auth = '%s' and LENGTH(`%sS%i`) >= LENGTH(%s) and STRCMP(`%sS%i`, %s) > 0", g_cMapname, stage, sTime, sEscapedName, sSID, g_cMapname, stage, sTime, g_cMapname, stage, sTime);
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s' and LENGTH(`%sS%i`) >= LENGTH('%s') and STRCMP(`%sS%i`, '%s') > 0", g_cMapname, stage, sTime, sEscapedName, sSID, g_cMapname, stage, sTime, g_cMapname, stage, sTime);
if (StrEqual(record_client, "0.000"))
{
CPrintToChat(client, "Your record: None yet\nCommand: !toptime !mytime !stages");
if (l_iZoneCount < 2)
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = %s, name = '%s' WHERE steam_auth = '%s'", g_cMapname, sTime, sEscapedName, sSID);
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, sTime, sEscapedName, sSID);
else
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = %s, name = '%s' WHERE steam_auth = '%s'", g_cMapname, stage, sTime, sEscapedName, sSID);
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, stage, sTime, sEscapedName, sSID);
}
else
CPrintToChat(client, "Your record: %s\nCommand: !toptime !mytime !stages", record_client);