Skip to content
Permalink
Browse files

Remove incomplete detection of foreign key support in table engine. C…

…loses #375
  • Loading branch information...
ansgarbecker committed May 28, 2019
1 parent 8f9abb2 commit 59ea094c25e03c86e5b30c87e51fed6dab5ba2a2
Showing with 57 additions and 85 deletions.
  1. +56 −68 source/table_editor.dfm
  2. +1 −17 source/table_editor.pas
@@ -412,79 +412,67 @@ object frmTableEditor: TfrmTableEditor
OnClick = btnClearForeignKeysClick
end
end
object pnlNoForeignKeys: TPanel
object listForeignKeys: TVirtualStringTree
Left = 66
Top = 0
Width = 527
Width = 620
Height = 121
Margins.Top = 0
Margins.Bottom = 0
Align = alClient
BevelOuter = bvNone
Caption = 'pnlNoForeignKeys'
EditDelay = 0
Header.AutoSizeIndex = 0
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
Images = MainForm.VirtualImageListMain
TabOrder = 1
VerticalAlignment = taAlignBottom
object listForeignKeys: TVirtualStringTree
AlignWithMargins = True
Left = 3
Top = 0
Width = 521
Height = 121
Margins.Top = 0
Margins.Bottom = 0
Align = alClient
EditDelay = 0
Header.AutoSizeIndex = 0
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
Images = MainForm.VirtualImageListMain
TabOrder = 0
TreeOptions.MiscOptions = [toAcceptOLEDrop, toEditable, toFullRepaintOnResize, toGridExtensions, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowHorzGridLines, toShowTreeLines, toShowVertGridLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
TreeOptions.SelectionOptions = [toExtendedFocus]
OnBeforePaint = listForeignKeysBeforePaint
OnClick = treeIndexesClick
OnCreateEditor = listForeignKeysCreateEditor
OnEditing = listForeignKeysEditing
OnFocusChanged = listForeignKeysFocusChanged
OnGetText = listForeignKeysGetText
OnGetImageIndex = listForeignKeysGetImageIndex
OnNewText = listForeignKeysNewText
Columns = <
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 0
Text = 'Key name'
Width = 101
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 1
Text = 'Columns'
Width = 80
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 2
Text = 'Reference table'
Width = 100
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 3
Text = 'Foreign columns'
Width = 80
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 4
Text = 'On UPDATE'
Width = 80
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 5
Text = 'On DELETE'
Width = 80
end>
end
TreeOptions.MiscOptions = [toAcceptOLEDrop, toEditable, toFullRepaintOnResize, toGridExtensions, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowHorzGridLines, toShowTreeLines, toShowVertGridLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
TreeOptions.SelectionOptions = [toExtendedFocus]
OnBeforePaint = listForeignKeysBeforePaint
OnClick = treeIndexesClick
OnCreateEditor = listForeignKeysCreateEditor
OnEditing = listForeignKeysEditing
OnFocusChanged = listForeignKeysFocusChanged
OnGetText = listForeignKeysGetText
OnGetImageIndex = listForeignKeysGetImageIndex
OnNewText = listForeignKeysNewText
Columns = <
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 0
Text = 'Key name'
Width = 196
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 1
Text = 'Columns'
Width = 80
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 2
Text = 'Reference table'
Width = 100
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 3
Text = 'Foreign columns'
Width = 80
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 4
Text = 'On UPDATE'
Width = 80
end
item
Options = [coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus]
Position = 5
Text = 'On DELETE'
Width = 80
end>
end
end
object tabPartitions: TTabSheet
@@ -81,7 +81,6 @@ TfrmTableEditor = class(TFrame)
btnClearForeignKeys: TToolButton;
menuCopyColumnCell: TMenuItem;
N2: TMenuItem;
pnlNoForeignKeys: TPanel;
listForeignKeys: TVirtualStringTree;
menuCopyColumns: TMenuItem;
menuPasteColumns: TMenuItem;
@@ -1903,26 +1902,11 @@ procedure TfrmTableEditor.MoveFocusedIndexPart(NewIdx: Cardinal);


procedure TfrmTableEditor.PageControlMainChange(Sender: TObject);
var
SupportsForeignKeys: Boolean;
begin
treeIndexes.EndEditNode;
listForeignKeys.EndEditNode;
if PageControlMain.ActivePage = tabForeignKeys then begin
// Foreign keys supported by InnoDB engine and NDB cluster. See http://www.heidisql.com/forum.php?t=16059
SupportsForeignKeys := (LowerCase(comboEngine.Text) = 'innodb')
or (DBObject.Connection.NdbClusterVersionInt >= 70300);
ListForeignKeys.Enabled := SupportsForeignKeys;
tlbForeignKeys.Enabled := SupportsForeignKeys;
pnlNoForeignKeys.Caption := f_('The selected table engine (%s) does not support foreign keys.', [comboEngine.Text]);
if SupportsForeignKeys then
ListForeignKeys.Margins.Bottom := 0
else
ListForeignKeys.Margins.Bottom := GetTextHeight(pnlNoForeignKeys.Font)+4;
ListForeignKeys.Repaint;
end
// Ensure SynMemo's have focus, otherwise Select-All and Copy actions may fail
else if PageControlMain.ActivePage = tabCREATEcode then begin
if PageControlMain.ActivePage = tabCREATEcode then begin
if SynMemoCreateCode.CanFocus then
SynMemoCreateCode.SetFocus;
end

0 comments on commit 59ea094

Please sign in to comment.
You can’t perform that action at this time.