From 795fcaca3424aba5da76281a21262c00b6873b02 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 2 Mar 2021 01:24:04 +0100 Subject: [PATCH] further sql syntax fixes and reduced rows size --- RaceTimer/scripting/unloze_racetimer_redux.sp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/RaceTimer/scripting/unloze_racetimer_redux.sp b/RaceTimer/scripting/unloze_racetimer_redux.sp index 1925c592..26df7675 100644 --- a/RaceTimer/scripting/unloze_racetimer_redux.sp +++ b/RaceTimer/scripting/unloze_racetimer_redux.sp @@ -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);