Exceptions are caught in TMySQLConnection.GetAllDatabases, no need to catch them again in TMainForm.DBtreeInitChildren. Also, log an error message if both SHOW DATABASES and the alternative did not work.

This commit is contained in:
Ansgar Becker
2011-04-20 19:03:13 +00:00
parent eadc009e27
commit b7cec30bd3
2 changed files with 6 additions and 7 deletions

View File

@@ -1700,8 +1700,11 @@ begin
except on E:EDatabaseError do
try
FAllDatabases := GetCol('SELECT '+QuoteIdent('SCHEMA_NAME')+' FROM '+QuoteIdent(DBNAME_INFORMATION_SCHEMA)+'.'+QuoteIdent('SCHEMATA')+' ORDER BY '+QuoteIdent('SCHEMA_NAME'));
except on E:EDatabaseError do
FAllDatabases := TStringList.Create;
except
on E:EDatabaseError do begin
FAllDatabases := TStringList.Create;
Log(lcError, 'Database names not available due to missing privileges for user '+CurrentUserHostCombination+'.');
end;
end;
end;
Result := FAllDatabases;

View File

@@ -6710,12 +6710,8 @@ begin
lntNone: begin
Screen.Cursor := crHourglass;
ShowStatusMsg('Reading Databases...');
if Sender.Tag = VTREE_NOTLOADED_PURGECACHE then try
if Sender.Tag = VTREE_NOTLOADED_PURGECACHE then
DBObj.Connection.RefreshAllDatabases;
except
on E:EDatabaseError do
MessageDlg(E.Message+CRLF+CRLF+'You have no privilege to execute SHOW DATABASES. Please specify one or more databases in your session settings, if you want to see any.', mtError, [mbOK], 0);
end;
ShowStatusMsg;
Sender.Tag := VTREE_LOADED;
InvalidateVT(ListDatabases, VTREE_NOTLOADED, True);