Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Issue #12: disable unsupported Host>Variables and Host>Processes tabs…
… on SQLite
  • Loading branch information
ansgarbecker committed Mar 12, 2020
1 parent 7c15ede commit 3086484
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions source/main.pas
Expand Up @@ -10138,6 +10138,8 @@ procedure TMainForm.HostListBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
ProcessColumns: TTableColumnList;
Columns, FocusedCaption, CleanTabCaption: String;
Col: TVirtualTreeColumn;
LeaveEnabled: Boolean;
ActiveNetType: String;
begin
// Display server variables
vt := Sender as TVirtualStringTree;
Expand All @@ -10146,12 +10148,25 @@ procedure TMainForm.HostListBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
Tab := vt.Parent as TTabSheet;
Conn := ActiveConnection;

// Status + command statistics only available in MySQL
if ((vt=ListStatus) or (vt=ListCommandStats))
and (Conn <> nil)
and (not Conn.Parameters.IsAnyMySQL) then begin
// Status + command statistics only available in MySQL, most others also not available in SQLite
LeaveEnabled := False;
ActiveNetType := _('unknown');
if Conn <> nil then begin
if vt = ListDatabases then
LeaveEnabled := True
else if vt = ListVariables then
LeaveEnabled := Conn.Parameters.NetTypeGroup in [ngMySQL, ngMSSQL, ngPgSQL]
else if vt = ListStatus then
LeaveEnabled := Conn.Parameters.NetTypeGroup in [ngMySQL]
else if vt = ListProcesses then
LeaveEnabled := Conn.Parameters.NetTypeGroup in [ngMySQL, ngMSSQL, ngPgSQL]
else if vt = ListCommandStats then
LeaveEnabled := Conn.Parameters.NetTypeGroup in [ngMySQL];
ActiveNetType := Conn.Parameters.NetTypeName(False);
end;
if not LeaveEnabled then begin
vt.Clear;
vt.EmptyListMessage := f_('Not available on %s', [Conn.Parameters.NetTypeName(False)]);
vt.EmptyListMessage := f_('Not available on %s', [ActiveNetType]);
vt.Tag := VTREE_LOADED;
Exit;
end;
Expand Down

0 comments on commit 3086484

Please sign in to comment.