Separate Create > "Stored routine" menu item into two, one for procedures and one for functions. Closes #987

This commit is contained in:
Ansgar Becker
2021-01-17 14:37:34 +01:00
parent 1a7cc67e37
commit c6d9af9a3a
4 changed files with 42 additions and 23 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2021-01-16 16:20+0100\n"
"PO-Revision-Date: 2021-01-17 14:36+0100\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@ -2212,15 +2212,17 @@ msgstr "Select all"
msgid "Select all|Select all items or text"
msgstr "Select all|Select all items or text"
#. MainForm..ActionList1..actCreateRoutine..Caption
#: main.dfm:2401
msgid "Stored routine"
msgstr "Stored routine"
msgid "Stored procedure"
msgstr "Stored procedure"
#. MainForm..ActionList1..actCreateRoutine..Hint
#: main.dfm:2402
msgid "Create stored routine|Create stored procedure or function"
msgstr "Create stored routine|Create stored procedure or function"
msgid "Create stored procedure"
msgstr "Create stored procedure"
msgid "Stored function"
msgstr "Stored function"
msgid "Create stored function"
msgstr "Create stored function"
#. MainForm..ActionList1..actNewQueryTab..Caption
#: main.dfm:2408

View File

@ -2965,10 +2965,10 @@ object MainForm: TMainForm
OnExecute = actSelectAllExecute
OnUpdate = ValidateControls
end
object actCreateRoutine: TAction
object actCreateProcedure: TAction
Category = 'Database'
Caption = 'Stored routine'
Hint = 'Create stored routine|Create stored procedure or function'
Caption = 'Stored procedure'
Hint = 'Create stored procedure'
ImageIndex = 119
ImageName = 'icons8-source-code-other'
OnExecute = actCreateDBObjectExecute
@ -3021,6 +3021,13 @@ object MainForm: TMainForm
ImageName = 'icons8-sheets-100'
OnExecute = actTableToolsExecute
end
object actCreateFunction: TAction
Category = 'Database'
Caption = 'Stored function'
Hint = 'Create stored function'
ImageIndex = 35
OnExecute = actCreateDBObjectExecute
end
object actCreateTrigger: TAction
Category = 'Database'
Caption = 'Trigger'
@ -3566,7 +3573,10 @@ object MainForm: TMainForm
Action = actCreateView
end
object menuCreateRoutine: TMenuItem
Action = actCreateRoutine
Action = actCreateProcedure
end
object Storedfunction1: TMenuItem
Action = actCreateFunction
end
object menuCreateTrigger: TMenuItem
Action = actCreateTrigger

View File

@ -456,7 +456,7 @@ type
N26: TMenuItem;
actSessionManager: TAction;
Sessionmanager1: TMenuItem;
actCreateRoutine: TAction;
actCreateProcedure: TAction;
btnExit: TToolButton;
lblSorryNoData: TLabel;
menuPrint: TMenuItem;
@ -749,6 +749,8 @@ type
actNewQueryTabNofocus: TAction;
DataGUIDlowercase: TMenuItem;
DataGUIDlowercaseWobraces: TMenuItem;
actCreateFunction: TAction;
Storedfunction1: TMenuItem;
procedure actCreateDBObjectExecute(Sender: TObject);
procedure menuConnectionsPopup(Sender: TObject);
procedure actExitApplicationExecute(Sender: TObject);
@ -4361,9 +4363,11 @@ begin
Obj.Database := ActiveDatabase;
if a = actCreateTable then Obj.NodeType := lntTable
else if a = actCreateView then Obj.NodeType := lntView
else if a = actCreateRoutine then Obj.NodeType := lntProcedure
else if a = actCreateProcedure then Obj.NodeType := lntProcedure
else if a = actCreateTrigger then Obj.NodeType := lntTrigger
else if a = actCreateEvent then Obj.NodeType := lntEvent;
else if a = actCreateEvent then Obj.NodeType := lntEvent
else if a = actCreateFunction then Obj.NodeType := lntFunction;
PlaceObjectEditor(Obj);
end;
@ -7291,7 +7295,8 @@ begin
actAttachDatabase.Enabled := actAttachDatabase.Visible and (Obj.NodeType = lntNone);
actCreateTable.Enabled := IsDb or IsObject or (Obj.GroupType = lntTable);
actCreateView.Enabled := IsDb or IsObject or (Obj.GroupType = lntView);
actCreateRoutine.Enabled := IsDb or IsObject or (Obj.GroupType in [lntFunction, lntProcedure]);
actCreateProcedure.Enabled := IsDb or IsObject or (Obj.GroupType in [lntFunction, lntProcedure]);
actCreateFunction.Enabled := actCreateProcedure.Enabled;
actCreateTrigger.Enabled := IsDb or IsObject or (Obj.GroupType = lntTrigger);
actCreateEvent.Enabled := IsDb or IsObject or (Obj.GroupType = lntEvent);
actDropObjects.Enabled := IsObject or
@ -7314,7 +7319,8 @@ begin
actAttachDatabase.Visible := False;
actCreateTable.Enabled := True;
actCreateView.Enabled := True;
actCreateRoutine.Enabled := True;
actCreateProcedure.Enabled := True;
actCreateFunction.Enabled := True;
actCreateTrigger.Enabled := True;
actCreateEvent.Enabled := True;
actDropObjects.Enabled := ListTables.SelectedCount > 0;
@ -7335,7 +7341,8 @@ begin
if (ActiveConnection <> nil) and (ActiveConnection.Parameters.IsAnyMySQL) then begin
Version := ActiveConnection.ServerVersionInt;
actCreateView.Enabled := actCreateView.Enabled and (Version >= 50001);
actCreateRoutine.Enabled := actCreateRoutine.Enabled and (Version >= 50003);
actCreateProcedure.Enabled := actCreateProcedure.Enabled and (Version >= 50003);
actCreateFunction.Enabled := actCreateFunction.Enabled and (Version >= 50003);
actCreateTrigger.Enabled := actCreateTrigger.Enabled and (Version >= 50002);
actCreateEvent.Enabled := actCreateEvent.Enabled and (Version >= 50100);
end;

View File

@ -147,16 +147,16 @@ begin
comboDataAccess.ItemIndex := 0;
comboSecurity.ItemIndex := 0;
editComment.Clear;
case Obj.NodeType of
lntProcedure: comboType.ItemIndex := 0;
lntFunction: comboType.ItemIndex := 1;
end;
comboDefiner.Text := '';
comboDefiner.TextHint := f_('Current user (%s)', [Obj.Connection.CurrentUserHostCombination]);
comboDefiner.Hint := f_('Leave empty for current user (%s)', [Obj.Connection.CurrentUserHostCombination]);
SynMemoBody.Text := 'BEGIN'+CRLF+CRLF+'END';
if DBObject.Name <> '' then begin
// Editing existing routine
case Obj.NodeType of
lntProcedure: comboType.ItemIndex := 0;
lntFunction: comboType.ItemIndex := 1;
end;
DBObject.Connection.ParseRoutineStructure(Obj, Parameters);
comboReturns.Text := Obj.Returns;
chkDeterministic.Checked := Obj.Deterministic;