Move database filter again from mainform to session manager, so people without privilege to run SHOW DATABASE are not stuck. Fixes issue #1485. Also, allow to see available databases when user does a dropdown. Also, simplify logic for refreshing database list in mainform.

This commit is contained in:
Ansgar Becker
2010-04-22 15:16:27 +00:00
parent 9b786c81e0
commit 97f01a175b
13 changed files with 205 additions and 309 deletions

View File

@ -73,7 +73,7 @@ type
TConnectionParameters = class(TObject)
strict private
FNetType: TNetType;
FHostname, FUsername, FPassword, FStartupScriptFilename,
FHostname, FUsername, FPassword, FAllDatabases, FStartupScriptFilename,
FSSLPrivateKey, FSSLCertificate, FSSLCACertificate,
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
FPort, FSSHPort, FSSHLocalPort: Integer;
@ -86,6 +86,7 @@ type
property Port: Integer read FPort write FPort;
property Username: String read FUsername write FUsername;
property Password: String read FPassword write FPassword;
property AllDatabases: String read FAllDatabases write FAllDatabases;
property StartupScriptFilename: String read FStartupScriptFilename write FStartupScriptFilename;
property Options: TMySQLClientOptions read FOptions write FOptions;
property SSHHost: String read FSSHHost write FSSHHost;
@ -142,6 +143,7 @@ type
function GetLastError: String;
function GetServerVersionStr: String;
function GetServerVersionInt: Integer;
function GetAllDatabases: TStringList;
function GetTableEngines: TStringList;
function GetCollationTable: TMySQLQuery;
function GetCollationList: TStringList;
@ -186,6 +188,7 @@ type
property LastQueryDuration: Cardinal read FLastQueryDuration;
property LastQueryNetworkDuration: Cardinal read FLastQueryNetworkDuration;
property IsUnicode: Boolean read FIsUnicode;
property AllDatabases: TStringList read GetAllDatabases;
property TableEngines: TStringList read GetTableEngines;
property TableEngineDefault: String read FTableEngineDefault;
property CollationTable: TMySQLQuery read GetCollationTable;
@ -673,6 +676,18 @@ begin
end;
function TMySQLConnection.GetAllDatabases: TStringList;
begin
if FParameters.AllDatabases <> '' then begin
Result := TStringList.Create;
Result.Delimiter := ';';
Result.StrictDelimiter := True;
Result.DelimitedText := FParameters.AllDatabases;
end else
Result := GetCol('SHOW DATABASES');
end;
{**
Convert integer version to real version string
}