Skip to content

Commit

Permalink
Merge pull request #1222 from Awesomerly/thegame
Browse files Browse the repository at this point in the history
Fix database verison parsing
  • Loading branch information
rtldg authored Jan 10, 2025
2 parents 57e3dce + e597600 commit ab75ef4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions addons/sourcemod/scripting/shavit-rankings.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,25 +1304,32 @@ public void SQL_UpdateTop100_Callback(Database db, DBResultSet results, const ch

bool DoWeHaveWindowFunctions(const char[] sVersion)
{
float fVersion = StringToFloat(sVersion);
char buf[100][2];
ExplodeString(sVersion, ".", buf, 2, 100);
int iMajor = StringToInt(buf[0]);
int iMinor = StringToInt(buf[1]);

if (gI_Driver == Driver_sqlite)
{
return fVersion >= 3.25; // 2018~
// 2018~
return iMajor > 3 || (iMajor == 3 && iMinor >= 25); // 2018~
}
else if (gI_Driver == Driver_pgsql)
{
return fVersion >= 8.4; // 2009~
// 2009~
return iMajor > 8 || (iMajor == 8 && iMinor >= 4);
}
else if (gI_Driver == Driver_mysql)
{
if (StrContains(sVersion, "MariaDB") != -1)
{
return fVersion >= 10.2; // 2016~
// 2016~
return iMajor > 10 || (iMajor == 10 && iMinor >= 2);
}
else // mysql then...
{
return fVersion >= 8.0; // 2018~
// 2018~
return iMajor > 8 || (iMajor == 8 && iMinor >= 0);
}
}

Expand Down

0 comments on commit ab75ef4

Please sign in to comment.