mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
FServerVersionUntouched is a static variable, not a complex function, so it's very OK to call it several times
This commit is contained in:
@ -408,29 +408,27 @@ end;
|
|||||||
function TMySQLConnection.GetServerVersionInt: Integer;
|
function TMySQLConnection.GetServerVersionInt: Integer;
|
||||||
var
|
var
|
||||||
i, dots: Byte;
|
i, dots: Byte;
|
||||||
fullversion, v1, v2, v3: String;
|
v1, v2, v3: String;
|
||||||
begin
|
begin
|
||||||
Result := -1;
|
Result := -1;
|
||||||
|
|
||||||
dots := 0;
|
dots := 0;
|
||||||
// Avoid calling GetServerVersionUntouched too often
|
|
||||||
fullversion := ServerVersionUntouched;
|
|
||||||
v1 := '';
|
v1 := '';
|
||||||
v2 := '';
|
v2 := '';
|
||||||
v3 := '';
|
v3 := '';
|
||||||
for i:=1 to Length(fullversion) do begin
|
for i:=1 to Length(FServerVersionUntouched) do begin
|
||||||
if fullversion[i] = '.' then begin
|
if FServerVersionUntouched[i] = '.' then begin
|
||||||
inc(dots);
|
inc(dots);
|
||||||
// We expect exactly 2 dots.
|
// We expect exactly 2 dots.
|
||||||
if dots > 2 then
|
if dots > 2 then
|
||||||
break;
|
break;
|
||||||
end else if fullversion[i] in ['0'..'9'] then begin
|
end else if FServerVersionUntouched[i] in ['0'..'9'] then begin
|
||||||
if dots = 0 then
|
if dots = 0 then
|
||||||
v1 := v1 + fullversion[i]
|
v1 := v1 + FServerVersionUntouched[i]
|
||||||
else if dots = 1 then
|
else if dots = 1 then
|
||||||
v2 := v2 + fullversion[i]
|
v2 := v2 + FServerVersionUntouched[i]
|
||||||
else if dots = 2 then
|
else if dots = 2 then
|
||||||
v3 := v3 + fullversion[i];
|
v3 := v3 + FServerVersionUntouched[i];
|
||||||
end else // Don't include potential numbers of trailing string
|
end else // Don't include potential numbers of trailing string
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user