Skip to content

Commit

Permalink
FORMAT(time,9) doesn't work on sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
rtldg committed Oct 6, 2022
1 parent 09c0d22 commit 236829c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addons/sourcemod/scripting/shavit-wr.sp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Handle gH_OnFinishMessage = null;
Handle gH_OnWorldRecordsCached = null;

// database handle
int gI_Driver = Driver_unknown;
Database gH_SQL = null;
bool gB_Connected = false;

Expand Down Expand Up @@ -507,7 +508,7 @@ void UpdateClientCache(int client)
}

char sQuery[512];
FormatEx(sQuery, sizeof(sQuery), "SELECT time, style, track, completions FROM %splayertimes WHERE map = '%s' AND auth = %d;", gS_MySQLPrefix, gS_Map, iSteamID);
FormatEx(sQuery, sizeof(sQuery), "SELECT %s, style, track, completions FROM %splayertimes WHERE map = '%s' AND auth = %d;", gI_Driver == Driver_mysql ? "FORMAT(time, 9)" : "time", gS_MySQLPrefix, gS_Map, iSteamID);
QueryLog(gH_SQL, SQL_UpdateCache_Callback, sQuery, GetClientSerial(client), DBPrio_High);
}

Expand Down Expand Up @@ -2836,7 +2837,7 @@ public void Trans_ReplaceStageTimes_Error(Database db, any data, int numQueries,
void UpdateLeaderboards()
{
char sQuery[512];
FormatEx(sQuery, sizeof(sQuery), "SELECT p.style, p.track, FORMAT(p.time, 9), 0, p.id, p.auth, u.name FROM %splayertimes p LEFT JOIN %susers u ON p.auth = u.auth WHERE p.map = '%s' ORDER BY p.time ASC, p.date ASC;", gS_MySQLPrefix, gS_MySQLPrefix, gS_Map);
FormatEx(sQuery, sizeof(sQuery), "SELECT p.style, p.track, %s, 0, p.id, p.auth, u.name FROM %splayertimes p LEFT JOIN %susers u ON p.auth = u.auth WHERE p.map = '%s' ORDER BY p.time ASC, p.date ASC;", gI_Driver == Driver_mysql ? "FORMAT(p.time, 9)" : "p.time", gS_MySQLPrefix, gS_MySQLPrefix, gS_Map);
QueryLog(gH_SQL, SQL_UpdateLeaderboards_Callback, sQuery);
}

Expand Down

0 comments on commit 236829c

Please sign in to comment.