mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Fix division by zero crash when SQL server reports an empty string from SELECT SERVERPROPERTY('ProductVersion'). See http://www.heidisql.com/forum.php?t=16369
This commit is contained in:
@ -1666,7 +1666,7 @@ end;
|
||||
|
||||
procedure TAdoDBConnection.SetActive(Value: Boolean);
|
||||
var
|
||||
tmpdb, Error, NetLib, DataSource, QuotedPassword: String;
|
||||
tmpdb, Error, NetLib, DataSource, QuotedPassword, ServerVersion: String;
|
||||
rx: TRegExpr;
|
||||
i: Integer;
|
||||
begin
|
||||
@ -1745,7 +1745,9 @@ begin
|
||||
FServerVersionUntouched := rx.Match[1];
|
||||
try
|
||||
// Try to get more exact server version to avoid displaying "20.14" in some cases
|
||||
FServerVersionUntouched := GetVar('SELECT SERVERPROPERTY('+EscapeString('ProductVersion')+')');
|
||||
ServerVersion := GetVar('SELECT SERVERPROPERTY('+EscapeString('ProductVersion')+')');
|
||||
if ExecRegExpr('(\d+)\.(\d+)\.(\d+)\.(\d+)', ServerVersion) then
|
||||
FServerVersionUntouched := ServerVersion;
|
||||
except
|
||||
// Above query only works on SQL Server 2008 and newer
|
||||
// Keep value from SELECT @@VERSION on older servers
|
||||
|
Reference in New Issue
Block a user