mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Creating an ADO handle throws exception if MDAC is missing, especially on Wine. Create that handle in TAdoDBConnection.SetActive, not in TAdoDBConnection.Create, and turn the exception into an EDatabaseError, so the caller gets a handled error. Additionally, display a possible solution in that error popup, which I found on http://forum.winehq.org/viewtopic.php?p=30653 . Fixes issue #2660.
This commit is contained in:
@ -747,7 +747,6 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
inherited;
|
||||
FAdoHandle := TAdoConnection.Create(AOwner);
|
||||
FQuoteChar := '"';
|
||||
SetLength(FDatatypes, Length(MSSQLDatatypes));
|
||||
for i:=0 to High(MSSQLDatatypes) do
|
||||
@ -997,6 +996,19 @@ var
|
||||
begin
|
||||
if Value then begin
|
||||
DoBeforeConnect;
|
||||
try
|
||||
// Creating the ADO object throws exceptions if MDAC is missing, especially on Wine
|
||||
FAdoHandle := TAdoConnection.Create(Owner);
|
||||
except
|
||||
on E:Exception do begin
|
||||
if Pos('Data Access Components', E.Message) > 0 then
|
||||
raise EDatabaseError.Create(E.Message+CRLF+CRLF+
|
||||
'On Wine, you can try to install these:'+CRLF+
|
||||
'sh winetricks mdac28')
|
||||
else
|
||||
raise;
|
||||
end;
|
||||
end;
|
||||
NetLib := '';
|
||||
case Parameters.NetType of
|
||||
ntMSSQL_NamedPipe: NetLib := 'DBNMPNTW';
|
||||
|
Reference in New Issue
Block a user