Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Beautify the query shown in the SQL pane for the functions having mul…
Browse files Browse the repository at this point in the history
…tiple

arguments.

Reviewed by Sanket Mehta and small modification done by Ashesh Vashi.
  • Loading branch information
jinfroster authored and asheshv committed Oct 28, 2014
1 parent 50912f5 commit ea803ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Expand Up @@ -37,6 +37,9 @@ Changes

Date Dev Ver Change details
---------- --- ------ --------------
2014-10-28 AV 1.20.0 Beautify the query shown in the SQL pane for the
functions having multiple arguments by adding new lines
with small modification by me [J.F. Oster]
2014-10-13 AV 1.20.0 Check for the columnlist for the UPDATE OF syntax on
trigger also works with PPAS 9.5+ [Sanket Mehta]
2014-09-27 AV 1.20.0 Proper saving of columns width in the server status
Expand Down
2 changes: 1 addition & 1 deletion pgadmin/include/schema/pgFunction.h
Expand Up @@ -50,7 +50,7 @@ class pgFunction : public pgSchemaObject
}

wxString GetFullName();
wxString GetArgListWithNames();
wxString GetArgListWithNames(bool multiline = false);
wxString GetArgSigList(const bool forScript = false);

wxArrayString &GetArgNamesArray()
Expand Down
12 changes: 9 additions & 3 deletions pgadmin/schema/pgFunction.cpp
Expand Up @@ -283,7 +283,7 @@ wxString pgFunction::GetSql(ctlTree *browser)
{
if (sql.IsNull())
{
wxString qtName = GetQuotedFullIdentifier() + wxT("(") + GetArgListWithNames() + wxT(")");
wxString qtName = GetQuotedFullIdentifier() + wxT("(") + GetArgListWithNames(true) + wxT(")");
wxString qtSig = GetQuotedFullIdentifier() + wxT("(") + GetArgSigList() + wxT(")");

sql = wxT("-- Function: ") + qtSig + wxT("\n\n")
Expand Down Expand Up @@ -498,7 +498,7 @@ bool pgProcedure::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
return GetDatabase()->ExecuteVoid(sql);
}

wxString pgFunction::GetArgListWithNames()
wxString pgFunction::GetArgListWithNames(bool multiline)
{
wxString args;

Expand All @@ -512,7 +512,13 @@ wxString pgFunction::GetArgListWithNames()
break;

if (args.Length() > 0)
args += wxT(", ");
{
args += (multiline) ? wxT(",\n ") : wxT(", ");
}
else if (multiline)
{
args = wxT("\n ");
}

wxString arg;

Expand Down

0 comments on commit ea803ad

Please sign in to comment.