fix(db): MariaDB version parse for 10.x-MariaDB- without 5.5.5- prefix
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -434,18 +434,23 @@ bool DatabaseIncompatibleVersion(std::string const mysqlVersion)
|
||||
std::string ver = mysqlVersion;
|
||||
std::string minVersion = MIN_MYSQL_SERVER_VERSION;
|
||||
|
||||
// MariaDB: mysql_get_server_info() often starts with MySQL-compat "5.5.5-" then real version, e.g.
|
||||
// "5.5.5-10.6.11-MariaDB-1:10.6.11+maria~ubu2004"
|
||||
// MariaDB: version string may be:
|
||||
// - "5.5.5-10.6.11-MariaDB-1:10.6.11+maria~..." (MySQL wire compat prefix)
|
||||
// - "10.6.11-MariaDB-1:10.6.11+maria~..." (no 5.5.5- prefix)
|
||||
// parseTriplet() on the full second form stops at the first '-', yielding 10.6.11.
|
||||
// Never take "firstDash..secondDash" — that becomes "MariaDB" and compares as 0.0.0.
|
||||
if (ver.find("MariaDB") != std::string::npos)
|
||||
{
|
||||
size_t const firstDash = ver.find('-');
|
||||
if (firstDash != std::string::npos)
|
||||
{
|
||||
size_t const secondDash = ver.find('-', firstDash + 1);
|
||||
if (secondDash != std::string::npos)
|
||||
ver = ver.substr(firstDash + 1, secondDash - firstDash - 1);
|
||||
}
|
||||
minVersion = MIN_MARIADB_SERVER_VERSION;
|
||||
if (ver.compare(0, 6, "5.5.5-") == 0)
|
||||
{
|
||||
size_t const afterPrefix = 6;
|
||||
size_t const nextDash = ver.find('-', afterPrefix);
|
||||
if (nextDash != std::string::npos)
|
||||
ver = ver.substr(afterPrefix, nextDash - afterPrefix);
|
||||
else
|
||||
ver = ver.substr(afterPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
return compareVersion(parseTriplet(ver), parseTriplet(minVersion)) < 0;
|
||||
|
||||
Reference in New Issue
Block a user