Skip to content

Commit ab75ef4

Browse files
authored
Merge pull request #1222 from Awesomerly/thegame
Fix database verison parsing
2 parents 57e3dce + e597600 commit ab75ef4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

addons/sourcemod/scripting/shavit-rankings.sp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,25 +1304,32 @@ public void SQL_UpdateTop100_Callback(Database db, DBResultSet results, const ch
13041304

13051305
bool DoWeHaveWindowFunctions(const char[] sVersion)
13061306
{
1307-
float fVersion = StringToFloat(sVersion);
1307+
char buf[100][2];
1308+
ExplodeString(sVersion, ".", buf, 2, 100);
1309+
int iMajor = StringToInt(buf[0]);
1310+
int iMinor = StringToInt(buf[1]);
13081311

13091312
if (gI_Driver == Driver_sqlite)
13101313
{
1311-
return fVersion >= 3.25; // 2018~
1314+
// 2018~
1315+
return iMajor > 3 || (iMajor == 3 && iMinor >= 25); // 2018~
13121316
}
13131317
else if (gI_Driver == Driver_pgsql)
13141318
{
1315-
return fVersion >= 8.4; // 2009~
1319+
// 2009~
1320+
return iMajor > 8 || (iMajor == 8 && iMinor >= 4);
13161321
}
13171322
else if (gI_Driver == Driver_mysql)
13181323
{
13191324
if (StrContains(sVersion, "MariaDB") != -1)
13201325
{
1321-
return fVersion >= 10.2; // 2016~
1326+
// 2016~
1327+
return iMajor > 10 || (iMajor == 10 && iMinor >= 2);
13221328
}
13231329
else // mysql then...
13241330
{
1325-
return fVersion >= 8.0; // 2018~
1331+
// 2018~
1332+
return iMajor > 8 || (iMajor == 8 && iMinor >= 0);
13261333
}
13271334
}
13281335

0 commit comments

Comments
 (0)