From dec6f9ee6340565dd678d1ef3ce2d4cfa3afe683 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 27 Apr 2016 18:08:00 +0000 Subject: [PATCH] Set each procedure parameter on its own line, and remove some tabs. See http://www.heidisql.com/forum.php?t=21166 --- source/routine_editor.pas | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/source/routine_editor.pas b/source/routine_editor.pas index f65e4642..cbad0e81 100644 --- a/source/routine_editor.pas +++ b/source/routine_editor.pas @@ -534,8 +534,9 @@ end; function TfrmRoutineEditor.ComposeCreateStatement(NameOfObject: String): String; var - ProcOrFunc: String; + ProcOrFunc, tmp: String; i: Integer; + Params: TStringList; begin case comboType.ItemIndex of 0: ProcOrFunc := 'PROCEDURE'; @@ -545,23 +546,26 @@ begin if comboDefiner.Text <> '' then Result := Result + 'DEFINER='+DBObject.Connection.QuoteIdent(comboDefiner.Text, True, '@')+' '; Result := Result + ProcOrFunc+' '+DBObject.Connection.QuoteIdent(NameOfObject)+'('; + Params := TStringList.Create; for i:=0 to Parameters.Count-1 do begin + tmp := ''; if ProcOrFunc = 'PROCEDURE' then - Result := Result + Parameters[i].Context + ' '; - Result := Result + DBObject.Connection.QuoteIdent(Parameters[i].Name) + ' ' + Parameters[i].Datatype; - if i < Parameters.Count-1 then - Result := Result + ', '; + tmp := tmp + Parameters[i].Context + ' '; + tmp := tmp + DBObject.Connection.QuoteIdent(Parameters[i].Name) + ' ' + Parameters[i].Datatype; + Params.Add(tmp); end; + if Params.Count > 0 then + Result := Result + CRLF + #9 + implodestr(','+CRLF+#9, Params) + CRLF; Result := Result + ')'+CRLF; if comboReturns.Enabled then - Result := Result + #9 + 'RETURNS '+comboReturns.Text+CRLF; - Result := Result + #9 + 'LANGUAGE SQL'+CRLF + #9; + Result := Result + 'RETURNS '+comboReturns.Text+CRLF; + Result := Result + 'LANGUAGE SQL'+CRLF; if not chkDeterministic.Checked then Result := Result + 'NOT '; Result := Result + 'DETERMINISTIC'+CRLF - + #9 + UpperCase(comboDataAccess.Text)+CRLF - + #9 + 'SQL SECURITY ' + UpperCase(comboSecurity.Text)+CRLF - + #9 + 'COMMENT ' + esc(editComment.Text)+CRLF + + UpperCase(comboDataAccess.Text)+CRLF + + 'SQL SECURITY ' + UpperCase(comboSecurity.Text)+CRLF + + 'COMMENT ' + esc(editComment.Text)+CRLF + SynMemoBody.Text; end;