mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 10:02:10 +08:00
Move "Databases" filter from session manager to an editable combobox below the database tree. Keeps session manager free from connection unrelated stuff, provides more comfort, adds a "recently used list" of old filters which is kept over session connects, and supports regular expressions now. Fixes issue #776
This commit is contained in:
@ -4,10 +4,10 @@ object connform: Tconnform
|
|||||||
Top = 129
|
Top = 129
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
Caption = 'Session manager'
|
Caption = 'Session manager'
|
||||||
ClientHeight = 319
|
ClientHeight = 274
|
||||||
ClientWidth = 494
|
ClientWidth = 494
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
Constraints.MinHeight = 355
|
Constraints.MinHeight = 310
|
||||||
Constraints.MinWidth = 510
|
Constraints.MinWidth = 510
|
||||||
Font.Charset = DEFAULT_CHARSET
|
Font.Charset = DEFAULT_CHARSET
|
||||||
Font.Color = clWindowText
|
Font.Color = clWindowText
|
||||||
@ -24,7 +24,7 @@ object connform: Tconnform
|
|||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
494
|
494
|
||||||
319)
|
274)
|
||||||
PixelsPerInch = 96
|
PixelsPerInch = 96
|
||||||
TextHeight = 13
|
TextHeight = 13
|
||||||
object lblSession: TLabel
|
object lblSession: TLabel
|
||||||
@ -48,7 +48,7 @@ object connform: Tconnform
|
|||||||
end
|
end
|
||||||
object btnSave: TButton
|
object btnSave: TButton
|
||||||
Left = 64
|
Left = 64
|
||||||
Top = 286
|
Top = 241
|
||||||
Width = 50
|
Width = 50
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
@ -59,7 +59,7 @@ object connform: Tconnform
|
|||||||
object btnOpen: TButton
|
object btnOpen: TButton
|
||||||
Tag = 15
|
Tag = 15
|
||||||
Left = 320
|
Left = 320
|
||||||
Top = 286
|
Top = 241
|
||||||
Width = 80
|
Width = 80
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
@ -72,7 +72,7 @@ object connform: Tconnform
|
|||||||
object btnCancel: TButton
|
object btnCancel: TButton
|
||||||
Tag = 16
|
Tag = 16
|
||||||
Left = 406
|
Left = 406
|
||||||
Top = 286
|
Top = 241
|
||||||
Width = 80
|
Width = 80
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
@ -85,7 +85,7 @@ object connform: Tconnform
|
|||||||
Left = 9
|
Left = 9
|
||||||
Top = 27
|
Top = 27
|
||||||
Width = 162
|
Width = 162
|
||||||
Height = 251
|
Height = 206
|
||||||
Anchors = [akLeft, akTop, akBottom]
|
Anchors = [akLeft, akTop, akBottom]
|
||||||
EditDelay = 250
|
EditDelay = 250
|
||||||
Header.AutoSizeIndex = 0
|
Header.AutoSizeIndex = 0
|
||||||
@ -120,7 +120,7 @@ object connform: Tconnform
|
|||||||
end
|
end
|
||||||
object btnNew: TButton
|
object btnNew: TButton
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 286
|
Top = 241
|
||||||
Width = 50
|
Width = 50
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
@ -130,7 +130,7 @@ object connform: Tconnform
|
|||||||
end
|
end
|
||||||
object btnDelete: TButton
|
object btnDelete: TButton
|
||||||
Left = 120
|
Left = 120
|
||||||
Top = 286
|
Top = 241
|
||||||
Width = 50
|
Width = 50
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
@ -142,14 +142,14 @@ object connform: Tconnform
|
|||||||
Left = 177
|
Left = 177
|
||||||
Top = 10
|
Top = 10
|
||||||
Width = 309
|
Width = 309
|
||||||
Height = 270
|
Height = 225
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||||
Caption = 'Details'
|
Caption = 'Details'
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
Visible = False
|
Visible = False
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
309
|
309
|
||||||
270)
|
225)
|
||||||
object lblHost: TLabel
|
object lblHost: TLabel
|
||||||
Tag = 6
|
Tag = 6
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -186,45 +186,32 @@ object connform: Tconnform
|
|||||||
Caption = 'Port:'
|
Caption = 'Port:'
|
||||||
FocusControl = editPort
|
FocusControl = editPort
|
||||||
end
|
end
|
||||||
object lblOnlyDBs: TLabel
|
|
||||||
Tag = 13
|
|
||||||
Left = 8
|
|
||||||
Top = 167
|
|
||||||
Width = 63
|
|
||||||
Height = 13
|
|
||||||
Caption = 'Database(s):'
|
|
||||||
WordWrap = True
|
|
||||||
end
|
|
||||||
object lblLastConnectLeft: TLabel
|
object lblLastConnectLeft: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 211
|
Top = 167
|
||||||
Width = 65
|
Width = 65
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
Caption = 'Last connect:'
|
Caption = 'Last connect:'
|
||||||
end
|
end
|
||||||
object lblLastConnectRight: TLabel
|
object lblLastConnectRight: TLabel
|
||||||
Left = 99
|
Left = 99
|
||||||
Top = 211
|
Top = 167
|
||||||
Width = 5
|
Width = 5
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
Caption = '?'
|
Caption = '?'
|
||||||
end
|
end
|
||||||
object lblCreatedLeft: TLabel
|
object lblCreatedLeft: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 247
|
Top = 203
|
||||||
Width = 43
|
Width = 43
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
Caption = 'Created:'
|
Caption = 'Created:'
|
||||||
end
|
end
|
||||||
object lblCreatedRight: TLabel
|
object lblCreatedRight: TLabel
|
||||||
Left = 99
|
Left = 99
|
||||||
Top = 247
|
Top = 203
|
||||||
Width = 5
|
Width = 5
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
Caption = '?'
|
Caption = '?'
|
||||||
end
|
end
|
||||||
object lblNetworkType: TLabel
|
object lblNetworkType: TLabel
|
||||||
@ -236,18 +223,16 @@ object connform: Tconnform
|
|||||||
end
|
end
|
||||||
object lblCounterLeft: TLabel
|
object lblCounterLeft: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 229
|
Top = 185
|
||||||
Width = 43
|
Width = 43
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
Caption = 'Counter:'
|
Caption = 'Counter:'
|
||||||
end
|
end
|
||||||
object lblCounterRight: TLabel
|
object lblCounterRight: TLabel
|
||||||
Left = 99
|
Left = 99
|
||||||
Top = 229
|
Top = 185
|
||||||
Width = 5
|
Width = 5
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
Caption = '?'
|
Caption = '?'
|
||||||
end
|
end
|
||||||
object editHost: TEdit
|
object editHost: TEdit
|
||||||
@ -318,18 +303,6 @@ object connform: Tconnform
|
|||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
OnClick = radioNetTypeClick
|
OnClick = radioNetTypeClick
|
||||||
end
|
end
|
||||||
object memoDatabases: TTntMemo
|
|
||||||
Left = 99
|
|
||||||
Top = 164
|
|
||||||
Width = 205
|
|
||||||
Height = 41
|
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
|
||||||
Lines.Strings = (
|
|
||||||
'memoDatabases')
|
|
||||||
ScrollBars = ssVertical
|
|
||||||
TabOrder = 8
|
|
||||||
OnChange = Modification
|
|
||||||
end
|
|
||||||
object updownPort: TUpDown
|
object updownPort: TUpDown
|
||||||
Left = 159
|
Left = 159
|
||||||
Top = 117
|
Top = 117
|
||||||
@ -344,7 +317,7 @@ object connform: Tconnform
|
|||||||
object popupSessions: TPopupMenu
|
object popupSessions: TPopupMenu
|
||||||
Images = MainForm.PngImageListMain
|
Images = MainForm.PngImageListMain
|
||||||
Left = 176
|
Left = 176
|
||||||
Top = 288
|
Top = 240
|
||||||
object Save1: TMenuItem
|
object Save1: TMenuItem
|
||||||
Caption = 'Save'
|
Caption = 'Save'
|
||||||
ImageIndex = 10
|
ImageIndex = 10
|
||||||
@ -368,6 +341,6 @@ object connform: Tconnform
|
|||||||
Interval = 60000
|
Interval = 60000
|
||||||
OnTimer = TimerStatisticsTimer
|
OnTimer = TimerStatisticsTimer
|
||||||
Left = 208
|
Left = 208
|
||||||
Top = 288
|
Top = 240
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -27,7 +27,6 @@ type
|
|||||||
lblUsername: TLabel;
|
lblUsername: TLabel;
|
||||||
lblPassword: TLabel;
|
lblPassword: TLabel;
|
||||||
lblPort: TLabel;
|
lblPort: TLabel;
|
||||||
lblOnlyDBs: TLabel;
|
|
||||||
editHost: TEdit;
|
editHost: TEdit;
|
||||||
editUsername: TEdit;
|
editUsername: TEdit;
|
||||||
editPassword: TEdit;
|
editPassword: TEdit;
|
||||||
@ -35,7 +34,6 @@ type
|
|||||||
chkCompressed: TCheckBox;
|
chkCompressed: TCheckBox;
|
||||||
radioTypeTCPIP: TRadioButton;
|
radioTypeTCPIP: TRadioButton;
|
||||||
radioTypeNamedPipe: TRadioButton;
|
radioTypeNamedPipe: TRadioButton;
|
||||||
memoDatabases: TTntMemo;
|
|
||||||
updownPort: TUpDown;
|
updownPort: TUpDown;
|
||||||
lblLastConnectLeft: TLabel;
|
lblLastConnectLeft: TLabel;
|
||||||
lblLastConnectRight: TLabel;
|
lblLastConnectRight: TLabel;
|
||||||
@ -87,7 +85,7 @@ type
|
|||||||
FSessionNames: TStringlist;
|
FSessionNames: TStringlist;
|
||||||
FSessionModified, FSessionAdded: Boolean;
|
FSessionModified, FSessionAdded: Boolean;
|
||||||
FOrgNetType: Byte;
|
FOrgNetType: Byte;
|
||||||
FOrgHost, FOrgUser, FOrgPassword, FOrgDatabases: WideString;
|
FOrgHost, FOrgUser, FOrgPassword: WideString;
|
||||||
FOrgCompressed: Boolean;
|
FOrgCompressed: Boolean;
|
||||||
FOrgPort: Integer;
|
FOrgPort: Integer;
|
||||||
function SelectedSession: String;
|
function SelectedSession: String;
|
||||||
@ -200,7 +198,6 @@ begin
|
|||||||
editPort.Text,
|
editPort.Text,
|
||||||
editUsername.Text,
|
editUsername.Text,
|
||||||
editPassword.Text,
|
editPassword.Text,
|
||||||
memoDatabases.Text,
|
|
||||||
IntToStr(Integer(chkCompressed.Checked)),
|
IntToStr(Integer(chkCompressed.Checked)),
|
||||||
SelectedSession) then begin
|
SelectedSession) then begin
|
||||||
ModalResult := mrOK;
|
ModalResult := mrOK;
|
||||||
@ -225,7 +222,6 @@ begin
|
|||||||
else
|
else
|
||||||
MainReg.WriteInteger(REGNAME_NETTYPE, NETTYPE_NAMEDPIPE);
|
MainReg.WriteInteger(REGNAME_NETTYPE, NETTYPE_NAMEDPIPE);
|
||||||
MainReg.WriteBool(REGNAME_COMPRESSED, chkCompressed.Checked);
|
MainReg.WriteBool(REGNAME_COMPRESSED, chkCompressed.Checked);
|
||||||
MainReg.WriteString(REGNAME_ONLYDBS, Utf8Encode(memoDatabases.Text));
|
|
||||||
if IsNew then
|
if IsNew then
|
||||||
MainReg.WriteString(REGNAME_SESSIONCREATED, DateTimeToStr(Now));
|
MainReg.WriteString(REGNAME_SESSIONCREATED, DateTimeToStr(Now));
|
||||||
FSessionModified := False;
|
FSessionModified := False;
|
||||||
@ -384,7 +380,6 @@ begin
|
|||||||
FOrgPassword := decrypt(GetRegValue(REGNAME_PASSWORD, '', SelectedSession));
|
FOrgPassword := decrypt(GetRegValue(REGNAME_PASSWORD, '', SelectedSession));
|
||||||
FOrgPort := StrToIntDef(GetRegValue(REGNAME_PORT, '', SelectedSession), DEFAULT_PORT);
|
FOrgPort := StrToIntDef(GetRegValue(REGNAME_PORT, '', SelectedSession), DEFAULT_PORT);
|
||||||
FOrgCompressed := GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, SelectedSession);
|
FOrgCompressed := GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, SelectedSession);
|
||||||
FOrgDatabases := Utf8Decode(GetRegValue(REGNAME_ONLYDBS, '', SelectedSession));
|
|
||||||
end else begin
|
end else begin
|
||||||
// Editing a new session, not saved yet
|
// Editing a new session, not saved yet
|
||||||
FOrgNetType := NETTYPE_TCPIP;
|
FOrgNetType := NETTYPE_TCPIP;
|
||||||
@ -393,7 +388,6 @@ begin
|
|||||||
FOrgPassword := '';
|
FOrgPassword := '';
|
||||||
FOrgPort := DEFAULT_PORT;
|
FOrgPort := DEFAULT_PORT;
|
||||||
FOrgCompressed := DEFAULT_COMPRESSED;
|
FOrgCompressed := DEFAULT_COMPRESSED;
|
||||||
FOrgDatabases := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FLoaded := False;
|
FLoaded := False;
|
||||||
@ -407,7 +401,6 @@ begin
|
|||||||
editPassword.Text := FOrgPassword;
|
editPassword.Text := FOrgPassword;
|
||||||
editPort.Text := IntToStr(FOrgPort);
|
editPort.Text := IntToStr(FOrgPort);
|
||||||
chkCompressed.Checked := FOrgCompressed;
|
chkCompressed.Checked := FOrgCompressed;
|
||||||
memoDatabases.Text := FOrgDatabases;
|
|
||||||
FLoaded := True;
|
FLoaded := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -536,7 +529,7 @@ begin
|
|||||||
else NetType := NETTYPE_NAMEDPIPE;
|
else NetType := NETTYPE_NAMEDPIPE;
|
||||||
FSessionModified := (FOrgHost <> editHost.Text) or (FOrgUser <> editUsername.Text)
|
FSessionModified := (FOrgHost <> editHost.Text) or (FOrgUser <> editUsername.Text)
|
||||||
or (FOrgPassword <> editPassword.Text) or (FOrgPort <> updownPort.Tag)
|
or (FOrgPassword <> editPassword.Text) or (FOrgPort <> updownPort.Tag)
|
||||||
or (FOrgCompressed <> chkCompressed.Checked) or (FOrgDatabases <> memoDatabases.Text)
|
or (FOrgCompressed <> chkCompressed.Checked)
|
||||||
or (FOrgNetType <> NetType);
|
or (FOrgNetType <> NetType);
|
||||||
ListSessions.Repaint;
|
ListSessions.Repaint;
|
||||||
ValidateControls;
|
ValidateControls;
|
||||||
|
145
source/main.dfm
145
source/main.dfm
@ -338,59 +338,6 @@ object MainForm: TMainForm
|
|||||||
Cursor = crSizeWE
|
Cursor = crSizeWE
|
||||||
ResizeStyle = rsUpdate
|
ResizeStyle = rsUpdate
|
||||||
end
|
end
|
||||||
object DBtree: TVirtualStringTree
|
|
||||||
Left = 0
|
|
||||||
Top = 0
|
|
||||||
Width = 169
|
|
||||||
Height = 357
|
|
||||||
Align = alLeft
|
|
||||||
Constraints.MinWidth = 40
|
|
||||||
DragMode = dmAutomatic
|
|
||||||
DragType = dtVCL
|
|
||||||
Header.AutoSizeIndex = 0
|
|
||||||
Header.DefaultHeight = 17
|
|
||||||
Header.Font.Charset = DEFAULT_CHARSET
|
|
||||||
Header.Font.Color = clWindowText
|
|
||||||
Header.Font.Height = -11
|
|
||||||
Header.Font.Name = 'Tahoma'
|
|
||||||
Header.Font.Style = []
|
|
||||||
Header.Options = [hoAutoResize, hoColumnResize, hoDrag]
|
|
||||||
HintMode = hmTooltip
|
|
||||||
HotCursor = crHandPoint
|
|
||||||
Images = PngImageListMain
|
|
||||||
IncrementalSearch = isInitializedOnly
|
|
||||||
Indent = 16
|
|
||||||
ParentShowHint = False
|
|
||||||
PopupMenu = popupDB
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 0
|
|
||||||
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
|
||||||
TreeOptions.PaintOptions = [toHideFocusRect, toHotTrack, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
|
|
||||||
TreeOptions.SelectionOptions = [toRightClickSelect]
|
|
||||||
OnDblClick = DBtreeDblClick
|
|
||||||
OnExpanded = DBtreeExpanded
|
|
||||||
OnFocusChanged = DBtreeFocusChanged
|
|
||||||
OnGetText = DBtreeGetText
|
|
||||||
OnPaintText = DBtreePaintText
|
|
||||||
OnGetImageIndex = DBtreeGetImageIndex
|
|
||||||
OnGetHint = vstGetHint
|
|
||||||
OnGetNodeDataSize = DBtreeGetNodeDataSize
|
|
||||||
OnInitChildren = DBtreeInitChildren
|
|
||||||
OnInitNode = DBtreeInitNode
|
|
||||||
Columns = <
|
|
||||||
item
|
|
||||||
Position = 0
|
|
||||||
Width = 110
|
|
||||||
WideText = 'Name'
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Alignment = taRightJustify
|
|
||||||
MinWidth = 0
|
|
||||||
Position = 1
|
|
||||||
Width = 55
|
|
||||||
WideText = 'Size'
|
|
||||||
end>
|
|
||||||
end
|
|
||||||
object PageControlMain: TPageControl
|
object PageControlMain: TPageControl
|
||||||
Left = 173
|
Left = 173
|
||||||
Top = 0
|
Top = 0
|
||||||
@ -1338,6 +1285,98 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object pnlLeft: TPanel
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 169
|
||||||
|
Height = 357
|
||||||
|
Align = alLeft
|
||||||
|
BevelOuter = bvNone
|
||||||
|
TabOrder = 0
|
||||||
|
object DBtree: TVirtualStringTree
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 169
|
||||||
|
Height = 336
|
||||||
|
Align = alClient
|
||||||
|
BevelEdges = [beRight]
|
||||||
|
BevelInner = bvNone
|
||||||
|
BevelOuter = bvRaised
|
||||||
|
BevelKind = bkFlat
|
||||||
|
BorderStyle = bsNone
|
||||||
|
Constraints.MinWidth = 40
|
||||||
|
DragMode = dmAutomatic
|
||||||
|
DragType = dtVCL
|
||||||
|
Header.AutoSizeIndex = 0
|
||||||
|
Header.DefaultHeight = 17
|
||||||
|
Header.Font.Charset = DEFAULT_CHARSET
|
||||||
|
Header.Font.Color = clWindowText
|
||||||
|
Header.Font.Height = -11
|
||||||
|
Header.Font.Name = 'Tahoma'
|
||||||
|
Header.Font.Style = []
|
||||||
|
Header.Options = [hoAutoResize, hoColumnResize, hoDrag]
|
||||||
|
HintMode = hmTooltip
|
||||||
|
HotCursor = crHandPoint
|
||||||
|
Images = PngImageListMain
|
||||||
|
IncrementalSearch = isInitializedOnly
|
||||||
|
Indent = 16
|
||||||
|
ParentShowHint = False
|
||||||
|
PopupMenu = popupDB
|
||||||
|
RootNodeCount = 1
|
||||||
|
ShowHint = True
|
||||||
|
TabOrder = 0
|
||||||
|
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
||||||
|
TreeOptions.PaintOptions = [toHideFocusRect, toHotTrack, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
|
||||||
|
TreeOptions.SelectionOptions = [toRightClickSelect]
|
||||||
|
OnDblClick = DBtreeDblClick
|
||||||
|
OnExpanded = DBtreeExpanded
|
||||||
|
OnFocusChanged = DBtreeFocusChanged
|
||||||
|
OnGetText = DBtreeGetText
|
||||||
|
OnPaintText = DBtreePaintText
|
||||||
|
OnGetImageIndex = DBtreeGetImageIndex
|
||||||
|
OnGetHint = vstGetHint
|
||||||
|
OnGetNodeDataSize = DBtreeGetNodeDataSize
|
||||||
|
OnInitChildren = DBtreeInitChildren
|
||||||
|
OnInitNode = DBtreeInitNode
|
||||||
|
Columns = <
|
||||||
|
item
|
||||||
|
Position = 0
|
||||||
|
Width = 113
|
||||||
|
WideText = 'Name'
|
||||||
|
end
|
||||||
|
item
|
||||||
|
Alignment = taRightJustify
|
||||||
|
MinWidth = 0
|
||||||
|
Position = 1
|
||||||
|
Width = 55
|
||||||
|
WideText = 'Size'
|
||||||
|
end>
|
||||||
|
end
|
||||||
|
object comboOnlyDBs: TTntComboBox
|
||||||
|
AlignWithMargins = True
|
||||||
|
Left = 0
|
||||||
|
Top = 336
|
||||||
|
Width = 169
|
||||||
|
Height = 21
|
||||||
|
Hint =
|
||||||
|
'Database filter|A list of databases, separated by semicolon. Can' +
|
||||||
|
' contain regular expressions, e.g. "mydb;test.*;project\d+".'
|
||||||
|
Margins.Left = 0
|
||||||
|
Margins.Top = 0
|
||||||
|
Margins.Right = 0
|
||||||
|
Margins.Bottom = 0
|
||||||
|
Align = alBottom
|
||||||
|
ItemHeight = 13
|
||||||
|
ParentShowHint = False
|
||||||
|
ShowHint = True
|
||||||
|
TabOrder = 1
|
||||||
|
OnChange = comboOnlyDBsChange
|
||||||
|
OnDragDrop = comboOnlyDBsDragDrop
|
||||||
|
OnDragOver = comboOnlyDBsDragOver
|
||||||
|
OnExit = comboOnlyDBsExit
|
||||||
|
OnKeyDown = comboOnlyDBsKeyDown
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ProgressBarStatus: TProgressBar
|
object ProgressBarStatus: TProgressBar
|
||||||
Left = 535
|
Left = 535
|
||||||
|
198
source/main.pas
198
source/main.pas
@ -219,7 +219,9 @@ type
|
|||||||
actCopyAsSQL: TAction;
|
actCopyAsSQL: TAction;
|
||||||
CopyAsSQLdata: TMenuItem;
|
CopyAsSQLdata: TMenuItem;
|
||||||
panelTop: TPanel;
|
panelTop: TPanel;
|
||||||
|
pnlLeft: TPanel;
|
||||||
DBtree: TVirtualStringTree;
|
DBtree: TVirtualStringTree;
|
||||||
|
comboOnlyDBs: TTntComboBox;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
PageControlMain: TPageControl;
|
PageControlMain: TPageControl;
|
||||||
tabData: TTabSheet;
|
tabData: TTabSheet;
|
||||||
@ -720,6 +722,12 @@ type
|
|||||||
function IsQueryTab(PageIndex: Integer; IncludeFixed: Boolean): Boolean;
|
function IsQueryTab(PageIndex: Integer; IncludeFixed: Boolean): Boolean;
|
||||||
procedure popupMainTabsPopup(Sender: TObject);
|
procedure popupMainTabsPopup(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
procedure comboOnlyDBsChange(Sender: TObject);
|
||||||
|
procedure comboOnlyDBsExit(Sender: TObject);
|
||||||
|
procedure comboOnlyDBsDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
|
||||||
|
var Accept: Boolean);
|
||||||
|
procedure comboOnlyDBsDragDrop(Sender, Source: TObject; X, Y: Integer);
|
||||||
|
procedure comboOnlyDBsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
private
|
private
|
||||||
ReachedEOT : Boolean;
|
ReachedEOT : Boolean;
|
||||||
FDelimiter: String;
|
FDelimiter: String;
|
||||||
@ -784,7 +792,7 @@ type
|
|||||||
RoutineEditor: TfrmRoutineEditor;
|
RoutineEditor: TfrmRoutineEditor;
|
||||||
OptionsForm: Toptionsform;
|
OptionsForm: Toptionsform;
|
||||||
SessionManager: TConnForm;
|
SessionManager: TConnForm;
|
||||||
DatabasesWanted,
|
AllDatabases,
|
||||||
Databases : Widestrings.TWideStringList;
|
Databases : Widestrings.TWideStringList;
|
||||||
TemporaryDatabase : WideString;
|
TemporaryDatabase : WideString;
|
||||||
dataselected : Boolean;
|
dataselected : Boolean;
|
||||||
@ -837,7 +845,7 @@ type
|
|||||||
procedure FillPopupQueryLoad;
|
procedure FillPopupQueryLoad;
|
||||||
procedure PopupQueryLoadRemoveAbsentFiles( sender: TObject );
|
procedure PopupQueryLoadRemoveAbsentFiles( sender: TObject );
|
||||||
procedure SessionConnect(Sender: TObject);
|
procedure SessionConnect(Sender: TObject);
|
||||||
function InitConnection(parNetType: Integer; parHost, parPort, parUser, parPass, parDatabase, parCompress, parSession: WideString): Boolean;
|
function InitConnection(parNetType: Integer; parHost, parPort, parUser, parPass, parCompress, parSession: WideString): Boolean;
|
||||||
//procedure HandleQueryNotification(ASender : TMysqlQuery; AEvent : Integer);
|
//procedure HandleQueryNotification(ASender : TMysqlQuery; AEvent : Integer);
|
||||||
|
|
||||||
function ExecUpdateQuery(sql: WideString; HandleErrors: Boolean = false; DisplayErrors: Boolean = false): Int64;
|
function ExecUpdateQuery(sql: WideString; HandleErrors: Boolean = false; DisplayErrors: Boolean = false): Int64;
|
||||||
@ -1176,7 +1184,7 @@ begin
|
|||||||
|
|
||||||
MainReg.WriteInteger( REGNAME_QUERYMEMOHEIGHT, pnlQueryMemo.Height );
|
MainReg.WriteInteger( REGNAME_QUERYMEMOHEIGHT, pnlQueryMemo.Height );
|
||||||
MainReg.WriteInteger( REGNAME_QUERYHELPERSWIDTH, pnlQueryHelpers.Width );
|
MainReg.WriteInteger( REGNAME_QUERYHELPERSWIDTH, pnlQueryHelpers.Width );
|
||||||
MainReg.WriteInteger( REGNAME_DBTREEWIDTH, DBtree.width );
|
MainReg.WriteInteger( REGNAME_DBTREEWIDTH, pnlLeft.width );
|
||||||
MainReg.WriteInteger( REGNAME_SQLOUTHEIGHT, SynMemoSQLLog.Height );
|
MainReg.WriteInteger( REGNAME_SQLOUTHEIGHT, SynMemoSQLLog.Height );
|
||||||
|
|
||||||
// Save width of probably resized columns of all VirtualTrees
|
// Save width of probably resized columns of all VirtualTrees
|
||||||
@ -1342,7 +1350,7 @@ begin
|
|||||||
|
|
||||||
pnlQueryMemo.Height := GetRegValue(REGNAME_QUERYMEMOHEIGHT, pnlQueryMemo.Height);
|
pnlQueryMemo.Height := GetRegValue(REGNAME_QUERYMEMOHEIGHT, pnlQueryMemo.Height);
|
||||||
pnlQueryHelpers.Width := GetRegValue(REGNAME_QUERYHELPERSWIDTH, pnlQueryHelpers.Width);
|
pnlQueryHelpers.Width := GetRegValue(REGNAME_QUERYHELPERSWIDTH, pnlQueryHelpers.Width);
|
||||||
DBtree.Width := GetRegValue(REGNAME_DBTREEWIDTH, DBtree.Width);
|
pnlLeft.Width := GetRegValue(REGNAME_DBTREEWIDTH, pnlLeft.Width);
|
||||||
SynMemoSQLLog.Height := GetRegValue(REGNAME_SQLOUTHEIGHT, SynMemoSQLLog.Height);
|
SynMemoSQLLog.Height := GetRegValue(REGNAME_SQLOUTHEIGHT, SynMemoSQLLog.Height);
|
||||||
// Force status bar position to below log memo
|
// Force status bar position to below log memo
|
||||||
StatusBar.Top := SynMemoSQLLog.Top + SynMemoSQLLog.Height;
|
StatusBar.Top := SynMemoSQLLog.Top + SynMemoSQLLog.Height;
|
||||||
@ -1482,7 +1490,7 @@ procedure TMainForm.Startup;
|
|||||||
var
|
var
|
||||||
curParam, parNetType: Byte;
|
curParam, parNetType: Byte;
|
||||||
sValue,
|
sValue,
|
||||||
parHost, parPort, parUser, parPass, parDatabase,
|
parHost, parPort, parUser, parPass,
|
||||||
parCompress, parSession: String;
|
parCompress, parSession: String;
|
||||||
LastUpdatecheck, LastStatsCall, LastConnect: TDateTime;
|
LastUpdatecheck, LastStatsCall, LastConnect: TDateTime;
|
||||||
UpdatecheckInterval, i: Integer;
|
UpdatecheckInterval, i: Integer;
|
||||||
@ -1582,8 +1590,6 @@ begin
|
|||||||
parUser := sValue
|
parUser := sValue
|
||||||
else if GetParamValue('p', 'password', curParam, sValue) then
|
else if GetParamValue('p', 'password', curParam, sValue) then
|
||||||
parPass := sValue
|
parPass := sValue
|
||||||
else if GetParamValue('D', 'database', curParam, sValue) then
|
|
||||||
parDatabase := sValue
|
|
||||||
else if GetParamValue('d', 'description', curParam, sValue) then
|
else if GetParamValue('d', 'description', curParam, sValue) then
|
||||||
parSession := sValue;
|
parSession := sValue;
|
||||||
Inc(curParam);
|
Inc(curParam);
|
||||||
@ -1597,7 +1603,6 @@ begin
|
|||||||
parPass := decrypt(GetRegValue(REGNAME_PASSWORD, DEFAULT_PASSWORD, parSession));
|
parPass := decrypt(GetRegValue(REGNAME_PASSWORD, DEFAULT_PASSWORD, parSession));
|
||||||
parPort := GetRegValue(REGNAME_PORT, IntToStr(DEFAULT_PORT), parSession);
|
parPort := GetRegValue(REGNAME_PORT, IntToStr(DEFAULT_PORT), parSession);
|
||||||
parCompress := IntToStr(Integer(GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, parSession)));
|
parCompress := IntToStr(Integer(GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, parSession)));
|
||||||
parDatabase := GetRegValue(REGNAME_ONLYDBS, '', parSession);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Minimal parameter for command line mode is hostname
|
// Minimal parameter for command line mode is hostname
|
||||||
@ -1605,7 +1610,7 @@ begin
|
|||||||
if CommandLineMode then begin
|
if CommandLineMode then begin
|
||||||
if parSession = '' then
|
if parSession = '' then
|
||||||
parSession := parHost;
|
parSession := parHost;
|
||||||
Connected := InitConnection(parNetType, parHost, parPort, parUser, parPass, parDatabase, parCompress, parSession);
|
Connected := InitConnection(parNetType, parHost, parPort, parUser, parPass, parCompress, parSession);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Auto connection via preference setting
|
// Auto connection via preference setting
|
||||||
@ -1619,7 +1624,6 @@ begin
|
|||||||
GetRegValue(REGNAME_PORT, '', LastSession),
|
GetRegValue(REGNAME_PORT, '', LastSession),
|
||||||
GetRegValue(REGNAME_USER, '', LastSession),
|
GetRegValue(REGNAME_USER, '', LastSession),
|
||||||
decrypt(GetRegValue(REGNAME_PASSWORD, '', LastSession)),
|
decrypt(GetRegValue(REGNAME_PASSWORD, '', LastSession)),
|
||||||
Utf8Decode(GetRegValue(REGNAME_ONLYDBS, '', LastSession)),
|
|
||||||
IntToStr(Integer(GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, LastSession))),
|
IntToStr(Integer(GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, LastSession))),
|
||||||
LastSession
|
LastSession
|
||||||
);
|
);
|
||||||
@ -1698,15 +1702,16 @@ begin
|
|||||||
Mainreg.WriteInteger(REGNAME_SERVERVERSION, mysql_version);
|
Mainreg.WriteInteger(REGNAME_SERVERVERSION, mysql_version);
|
||||||
Mainreg.WriteString(REGNAME_LASTCONNECT, DateTimeToStr(Now));
|
Mainreg.WriteString(REGNAME_LASTCONNECT, DateTimeToStr(Now));
|
||||||
|
|
||||||
DatabasesWanted := explode(';', FConn.DatabaseList);
|
comboOnlyDBs.Items.Text := Utf8Decode(GetRegValue(REGNAME_ONLYDBS, '', SessionName));
|
||||||
DatabasesWanted.Sort;
|
if comboOnlyDBs.Items.Count > 0 then
|
||||||
|
comboOnlyDBs.ItemIndex := 0
|
||||||
|
else
|
||||||
|
comboOnlyDBs.Text := '';
|
||||||
|
RefreshTree(False);
|
||||||
|
|
||||||
DBTree.Color := GetRegValue(REGNAME_TREEBACKGROUND, clWindow, SessionName);
|
DBTree.Color := GetRegValue(REGNAME_TREEBACKGROUND, clWindow, SessionName);
|
||||||
|
|
||||||
CheckUptime;
|
CheckUptime;
|
||||||
// Invoke population of database tree. It's important to do this here after
|
|
||||||
// having filled DatabasesWanted, not at design time.
|
|
||||||
DBtree.RootNodeCount := 1;
|
|
||||||
|
|
||||||
// Define window properties
|
// Define window properties
|
||||||
SetWindowConnected( true );
|
SetWindowConnected( true );
|
||||||
@ -1795,6 +1800,7 @@ begin
|
|||||||
// relative from already opened folder!
|
// relative from already opened folder!
|
||||||
OpenRegistry(SessionName);
|
OpenRegistry(SessionName);
|
||||||
MainReg.WriteString( REGNAME_LASTUSEDDB, Utf8Encode(ActiveDatabase) );
|
MainReg.WriteString( REGNAME_LASTUSEDDB, Utf8Encode(ActiveDatabase) );
|
||||||
|
MainReg.WriteString( REGNAME_ONLYDBS, Utf8Encode(comboOnlyDBs.Items.Text) );
|
||||||
|
|
||||||
// Post pending UPDATE
|
// Post pending UPDATE
|
||||||
if DataGridHasChanges then
|
if DataGridHasChanges then
|
||||||
@ -1803,10 +1809,8 @@ begin
|
|||||||
// Clear database and table lists
|
// Clear database and table lists
|
||||||
DBtree.ClearSelection;
|
DBtree.ClearSelection;
|
||||||
DBtree.FocusedNode := nil;
|
DBtree.FocusedNode := nil;
|
||||||
DBtree.Clear;
|
|
||||||
ClearAllTableLists;
|
ClearAllTableLists;
|
||||||
FreeAndNil(DatabasesWanted);
|
FreeAndNil(AllDatabases);
|
||||||
FreeAndNil(Databases);
|
|
||||||
FreeAndNil(InformationSchemaTables);
|
FreeAndNil(InformationSchemaTables);
|
||||||
FreeAndNil(dsShowEngines);
|
FreeAndNil(dsShowEngines);
|
||||||
FreeAndNil(dsHaveEngines);
|
FreeAndNil(dsHaveEngines);
|
||||||
@ -1855,13 +1859,12 @@ begin
|
|||||||
if CreateDatabaseForm.ShowModal = mrOK then
|
if CreateDatabaseForm.ShowModal = mrOK then
|
||||||
begin
|
begin
|
||||||
newdb := CreateDatabaseForm.editDBName.Text;
|
newdb := CreateDatabaseForm.editDBName.Text;
|
||||||
// Add DB to OnlyDBs-regkey if this is not empty
|
// Add new DB to database filter if it's not empty
|
||||||
if DatabasesWanted.Count > 0 then
|
if comboOnlyDBs.Text <> '' then begin
|
||||||
begin
|
comboOnlyDBs.Text := comboOnlyDBs.Text + ';' + newdb;
|
||||||
DatabasesWanted.Add( newdb );
|
comboOnlyDBs.Items.Insert(0, comboOnlyDBs.Text);
|
||||||
OpenRegistry(SessionName);
|
|
||||||
MainReg.WriteString( 'OnlyDBs', ImplodeStr( ';', DatabasesWanted ) );
|
|
||||||
end;
|
end;
|
||||||
|
FreeAndNil(AllDatabases);
|
||||||
// reload db nodes and switch to new one
|
// reload db nodes and switch to new one
|
||||||
RefreshTree(False, newdb);
|
RefreshTree(False, newdb);
|
||||||
end;
|
end;
|
||||||
@ -2450,11 +2453,6 @@ begin
|
|||||||
try
|
try
|
||||||
ExecUpdateQuery( 'DROP DATABASE ' + mask(activeDB) );
|
ExecUpdateQuery( 'DROP DATABASE ' + mask(activeDB) );
|
||||||
ClearDbTableList(activeDB);
|
ClearDbTableList(activeDB);
|
||||||
if DatabasesWanted.IndexOf(activeDB) > -1 then begin
|
|
||||||
DatabasesWanted.Delete( DatabasesWanted.IndexOf(activeDB) );
|
|
||||||
OpenRegistry(SessionName);
|
|
||||||
MainReg.WriteString( 'OnlyDBs', ImplodeStr( ';', DatabasesWanted ) );
|
|
||||||
end;
|
|
||||||
DBtree.Selected[DBtree.GetFirst] := true;
|
DBtree.Selected[DBtree.GetFirst] := true;
|
||||||
RefreshTree(False);
|
RefreshTree(False);
|
||||||
finally
|
finally
|
||||||
@ -2565,7 +2563,7 @@ procedure TMainForm.SessionConnect(Sender: TObject);
|
|||||||
var
|
var
|
||||||
Session: String;
|
Session: String;
|
||||||
parNetType: Integer;
|
parNetType: Integer;
|
||||||
parHost, parPort, parUser, parPass, parCompress, parDatabase: WideString;
|
parHost, parPort, parUser, parPass, parCompress: WideString;
|
||||||
begin
|
begin
|
||||||
Session := (Sender as TMenuItem).Caption;
|
Session := (Sender as TMenuItem).Caption;
|
||||||
parNetType := GetRegValue(REGNAME_NETTYPE, DEFAULT_NETTYPE, Session);
|
parNetType := GetRegValue(REGNAME_NETTYPE, DEFAULT_NETTYPE, Session);
|
||||||
@ -2574,8 +2572,7 @@ begin
|
|||||||
parPass := decrypt(GetRegValue(REGNAME_PASSWORD, '', Session));
|
parPass := decrypt(GetRegValue(REGNAME_PASSWORD, '', Session));
|
||||||
parPort := GetRegValue(REGNAME_PORT, '', Session);
|
parPort := GetRegValue(REGNAME_PORT, '', Session);
|
||||||
parCompress := IntToStr(Integer(GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, Session)));
|
parCompress := IntToStr(Integer(GetRegValue(REGNAME_COMPRESSED, DEFAULT_COMPRESSED, Session)));
|
||||||
parDatabase := Utf8Decode(GetRegValue(REGNAME_ONLYDBS, '', Session));
|
if InitConnection(parNetType, parHost, parPort, parUser, parPass, parCompress, Session) then
|
||||||
if InitConnection(parNetType, parHost, parPort, parUser, parPass, parDatabase, parCompress, Session) then
|
|
||||||
DoAfterConnect;
|
DoAfterConnect;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2584,7 +2581,7 @@ end;
|
|||||||
Receive connection parameters and create the mdi-window
|
Receive connection parameters and create the mdi-window
|
||||||
Paremeters are either sent by connection-form or by commandline.
|
Paremeters are either sent by connection-form or by commandline.
|
||||||
}
|
}
|
||||||
function TMainform.InitConnection(parNetType: Integer; parHost, parPort, parUser, parPass, parDatabase, parCompress, parSession: WideString): Boolean;
|
function TMainform.InitConnection(parNetType: Integer; parHost, parPort, parUser, parPass, parCompress, parSession: WideString): Boolean;
|
||||||
var
|
var
|
||||||
MysqlConnection: TMysqlConn;
|
MysqlConnection: TMysqlConn;
|
||||||
Profile: TOpenConnProf;
|
Profile: TOpenConnProf;
|
||||||
@ -2607,7 +2604,6 @@ begin
|
|||||||
Profile.MysqlParams.PrpDbless := 'true';
|
Profile.MysqlParams.PrpDbless := 'true';
|
||||||
Profile.MysqlParams.PrpClientLocalFiles := 'true';
|
Profile.MysqlParams.PrpClientLocalFiles := 'true';
|
||||||
Profile.MysqlParams.PrpClientInteractive := 'true';
|
Profile.MysqlParams.PrpClientInteractive := 'true';
|
||||||
Profile.DatabaseList := parDatabase;
|
|
||||||
|
|
||||||
MysqlConnection := TMysqlConn.Create(@Profile);
|
MysqlConnection := TMysqlConn.Create(@Profile);
|
||||||
|
|
||||||
@ -6855,34 +6851,50 @@ procedure TMainForm.DBtreeInitChildren(Sender: TBaseVirtualTree; Node:
|
|||||||
PVirtualNode; var ChildCount: Cardinal);
|
PVirtualNode; var ChildCount: Cardinal);
|
||||||
var
|
var
|
||||||
ds: TDataset;
|
ds: TDataset;
|
||||||
specialDbs: WideStrings.TWideStringList;
|
i, j: Integer;
|
||||||
dbName: WideString;
|
DatabasesWanted: TWideStringList;
|
||||||
i: Integer;
|
rx: TRegExpr;
|
||||||
begin
|
begin
|
||||||
case Sender.GetNodeLevel(Node) of
|
case Sender.GetNodeLevel(Node) of
|
||||||
// Root node has only one single child (user@host)
|
// Root node has only one single child (user@host)
|
||||||
0: begin
|
0: begin
|
||||||
Screen.Cursor := crHourglass;
|
Screen.Cursor := crHourglass;
|
||||||
Showstatus( 'Reading Databases...' );
|
|
||||||
try
|
try
|
||||||
Databases := WideStrings.TWideStringList.Create;
|
if not Assigned(AllDatabases) then begin
|
||||||
if DatabasesWanted.Count = 0 then begin
|
Showstatus( 'Reading Databases...' );
|
||||||
ds := GetResults( 'SHOW DATABASES' );
|
AllDatabases := GetCol('SHOW DATABASES');
|
||||||
specialDbs := WideStrings.TWideStringList.Create;
|
end;
|
||||||
for i:=1 to ds.RecordCount do begin
|
if not Assigned(Databases) then
|
||||||
dbName := ds.FieldByName('Database').AsWideString;
|
Databases := TWideStringList.Create;
|
||||||
if dbName = DBNAME_INFORMATION_SCHEMA then specialDbs.Insert( 0, dbName )
|
Databases.Clear;
|
||||||
else Databases.Add( dbName );
|
DatabasesWanted := Explode(';', comboOnlyDBs.Text);
|
||||||
ds.Next;
|
if DatabasesWanted.Count > 0 then begin
|
||||||
|
// Add wanted dbs by comparing strings
|
||||||
|
for i:=0 to AllDatabases.Count-1 do begin
|
||||||
|
if DatabasesWanted.IndexOf(AllDatabases[i]) > -1 then
|
||||||
|
Databases.Add(AllDatabases[i]);
|
||||||
end;
|
end;
|
||||||
ds.Close;
|
// Add dbs by regular expression, avoiding duplicates
|
||||||
FreeAndNil(ds);
|
rx := TRegExpr.Create;
|
||||||
Databases.Sort;
|
for i:=0 to DatabasesWanted.Count-1 do begin
|
||||||
// Prioritised position of system-databases
|
rx.Expression := '^'+DatabasesWanted[i]+'$';
|
||||||
for i := specialDbs.Count - 1 downto 0 do
|
for j:=0 to AllDatabases.Count-1 do begin
|
||||||
Databases.Insert( 0, specialDbs[i] );
|
if (Databases.IndexOf(AllDatabases[j]) = -1) and rx.Exec(AllDatabases[j]) then
|
||||||
end else for i:=0 to DatabasesWanted.Count-1 do
|
Databases.Add(AllDatabases[j]);
|
||||||
Databases.Add(DatabasesWanted[i]);
|
end;
|
||||||
|
end;
|
||||||
|
rx.Free;
|
||||||
|
end;
|
||||||
|
FreeAndNil(DatabasesWanted);
|
||||||
|
if Databases.Count = 0 then
|
||||||
|
Databases.Assign(AllDatabases);
|
||||||
|
Databases.Sort;
|
||||||
|
|
||||||
|
// Prioritised position of virtual system database
|
||||||
|
i := Databases.IndexOf(DBNAME_INFORMATION_SCHEMA);
|
||||||
|
if i > -1 then
|
||||||
|
Databases.Move(i, 0);
|
||||||
|
|
||||||
showstatus( IntToStr( Databases.Count ) + ' Databases', 0 );
|
showstatus( IntToStr( Databases.Count ) + ' Databases', 0 );
|
||||||
ChildCount := Databases.Count;
|
ChildCount := Databases.Count;
|
||||||
// Avoids excessive InitializeKeywordLists() calls.
|
// Avoids excessive InitializeKeywordLists() calls.
|
||||||
@ -7053,9 +7065,11 @@ begin
|
|||||||
|
|
||||||
// ReInit tree population
|
// ReInit tree population
|
||||||
DBTree.BeginUpdate;
|
DBTree.BeginUpdate;
|
||||||
DBtree.ReinitChildren(DBTree.GetFirst, False); // .ResetNode(DBtree.GetFirst);
|
if DoResetTableCache then begin
|
||||||
if DoResetTableCache then
|
|
||||||
ClearAllTableLists;
|
ClearAllTableLists;
|
||||||
|
FreeAndNil(AllDatabases);
|
||||||
|
end;
|
||||||
|
DBtree.ReinitChildren(DBTree.GetFirst, False); // .ResetNode(DBtree.GetFirst);
|
||||||
// Reselect active or new database if present. Could have been deleted or renamed.
|
// Reselect active or new database if present. Could have been deleted or renamed.
|
||||||
try
|
try
|
||||||
if SelectDatabase <> '' then ActiveDatabase := SelectDatabase
|
if SelectDatabase <> '' then ActiveDatabase := SelectDatabase
|
||||||
@ -9538,5 +9552,75 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.comboOnlyDBsChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// Immediately apply database filter
|
||||||
|
RefreshTree(False);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.comboOnlyDBsExit(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
FilterText: WideString;
|
||||||
|
begin
|
||||||
|
// Add (move) custom filter text to (in) drop down history, if not empty
|
||||||
|
FilterText := comboOnlyDBs.Text;
|
||||||
|
if FilterText <> '' then begin
|
||||||
|
i := comboOnlyDBs.Items.IndexOf(FilterText);
|
||||||
|
if i > -1 then
|
||||||
|
comboOnlyDBs.Items.Move(i, 0)
|
||||||
|
else
|
||||||
|
comboOnlyDBs.Items.Insert(0, FilterText);
|
||||||
|
comboOnlyDBs.Text := FilterText;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.comboOnlyDBsDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
|
||||||
|
var Accept: Boolean);
|
||||||
|
begin
|
||||||
|
// DBtree dragging node over DB filter dropdown
|
||||||
|
Accept := (Source = DBtree) and (DBtree.GetNodeLevel(DBtree.FocusedNode) = 1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.comboOnlyDBsDragDrop(Sender, Source: TObject; X, Y: Integer);
|
||||||
|
var
|
||||||
|
dbs: TWideStringList;
|
||||||
|
newdb: WideString;
|
||||||
|
begin
|
||||||
|
// DBtree node dropped on DB filter dropdown
|
||||||
|
dbs := Explode(';', comboOnlyDBs.Text);
|
||||||
|
newdb := DBtree.Text[DBtree.FocusedNode, DBtree.FocusedColumn];
|
||||||
|
if dbs.IndexOf(newdb) = -1 then begin
|
||||||
|
if (comboOnlyDBs.Text <> '') and (comboOnlyDBs.Text[Length(comboOnlyDBs.Text)-1] <> ';') then
|
||||||
|
comboOnlyDBs.Text := comboOnlyDBs.Text + ';';
|
||||||
|
comboOnlyDBs.Text := comboOnlyDBs.Text + newdb;
|
||||||
|
comboOnlyDBs.Items.Insert(0, comboOnlyDBs.Text);
|
||||||
|
comboOnlyDBs.OnChange(Sender);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.comboOnlyDBsKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
// Pressing Delete key while filters are dropped down, deletes the filter from the list
|
||||||
|
i := comboOnlyDBs.ItemIndex;
|
||||||
|
if comboOnlyDBs.DroppedDown and (Key=VK_DELETE) and (i > -1) then begin
|
||||||
|
Key := 0;
|
||||||
|
comboOnlyDBs.Items.Delete(i);
|
||||||
|
if comboOnlyDBs.Items.Count > i then
|
||||||
|
comboOnlyDBs.ItemIndex := i
|
||||||
|
else
|
||||||
|
comboOnlyDBs.ItemIndex := i-1;
|
||||||
|
comboOnlyDBs.OnChange(Sender);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ type
|
|||||||
// but to keep the name short; this beats "TConnectionProfileDataAndConnectionObject", which I guess would be the proper name.
|
// but to keep the name short; this beats "TConnectionProfileDataAndConnectionObject", which I guess would be the proper name.
|
||||||
TOpenConnProf = record
|
TOpenConnProf = record
|
||||||
MysqlParams : TMysqlConnParams; // stuff that needs to be shipped over to the mysql driver.
|
MysqlParams : TMysqlConnParams; // stuff that needs to be shipped over to the mysql driver.
|
||||||
DatabaseList : WideString;
|
|
||||||
MysqlConn : TZConnection;
|
MysqlConn : TZConnection;
|
||||||
end;
|
end;
|
||||||
POpenConnProf = ^TOpenConnProf;
|
POpenConnProf = ^TOpenConnProf;
|
||||||
|
Reference in New Issue
Block a user