public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dmitriy Olshevskiy <[email protected]>
To: Andrej Antonov <[email protected]>
To: [email protected]
Subject: Re: patch: fix to use ``pg_get_functiondef()``
Date: Sun, 13 Dec 2015 18:04:52 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi, Andrej!
Here is small fix of your patch - can you check it please?
I think there must be wxwidgets function IsEmpty() instead of double 
negation,
because type of the variable is wxstring. Also I added the Trim() 
function before
check if function definition is empty or not.

On 08.12.2015 11:50, Andrej Antonov wrote:
> patch: fix to use ``pg_get_functiondef()`` [see attachment file]
>
> it is copy of pull-request https://github.com/postgres/pgadmin3/pull/12
>
> thank you!
>
>
>
-- 
Dmitriy Olshevskiy


diff --git a/pgadmin/schema/pgFunction.cpp b/pgadmin/schema/pgFunction.cpp
index ba49f79..c287c12 100644
--- a/pgadmin/schema/pgFunction.cpp
+++ b/pgadmin/schema/pgFunction.cpp
@@ -289,9 +289,10 @@ wxString pgFunction::GetSql(ctlTree *browser)
 		sql = wxT("-- Function: ") + qtSig + wxT("\n\n")
 		      + wxT("-- DROP FUNCTION ") + qtSig + wxT(";\n\n");
 		
-		if (!!GetFunctionDefByPg())
+		wxString functionDefByPgTrim = GetFunctionDefByPg().Trim();
+		if (!functionDefByPgTrim.IsEmpty())
 		{
-			sql += GetFunctionDefByPg().Trim();
+			sql += functionDefByPgTrim;
 		}
 		else if (GetLanguage() == wxT("edbspl") && GetProcType() == 2)
 		{
@@ -959,7 +960,7 @@ pgFunction *pgFunctionFactory::AppendFunctions(pgObject *obj, pgSchema *schema,
 			function->iSetReturnAsSet(functions->GetBool(wxT("proretset")));
 			function->iSetIsStrict(functions->GetBool(wxT("proisstrict")));
 			function->iSetSource(functions->GetVal(wxT("prosrc")));
-			if (!!functionDefByPgSelect)
+			if (!functionDefByPgSelect.IsEmpty())
 			{
 				function->iSetFunctionDefByPg(functions->GetVal(wxT("function_def_by_pg")));
 			}


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/plain] 0001-using-pg_get_functiondef-fixed.patch (1.1K, 3-0001-using-pg_get_functiondef-fixed.patch)
  download | inline diff:
diff --git a/pgadmin/schema/pgFunction.cpp b/pgadmin/schema/pgFunction.cpp
index ba49f79..c287c12 100644
--- a/pgadmin/schema/pgFunction.cpp
+++ b/pgadmin/schema/pgFunction.cpp
@@ -289,9 +289,10 @@ wxString pgFunction::GetSql(ctlTree *browser)
 		sql = wxT("-- Function: ") + qtSig + wxT("\n\n")
 		      + wxT("-- DROP FUNCTION ") + qtSig + wxT(";\n\n");
 		
-		if (!!GetFunctionDefByPg())
+		wxString functionDefByPgTrim = GetFunctionDefByPg().Trim();
+		if (!functionDefByPgTrim.IsEmpty())
 		{
-			sql += GetFunctionDefByPg().Trim();
+			sql += functionDefByPgTrim;
 		}
 		else if (GetLanguage() == wxT("edbspl") && GetProcType() == 2)
 		{
@@ -959,7 +960,7 @@ pgFunction *pgFunctionFactory::AppendFunctions(pgObject *obj, pgSchema *schema,
 			function->iSetReturnAsSet(functions->GetBool(wxT("proretset")));
 			function->iSetIsStrict(functions->GetBool(wxT("proisstrict")));
 			function->iSetSource(functions->GetVal(wxT("prosrc")));
-			if (!!functionDefByPgSelect)
+			if (!functionDefByPgSelect.IsEmpty())
 			{
 				function->iSetFunctionDefByPg(functions->GetVal(wxT("function_def_by_pg")));
 			}


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: patch: fix to use ``pg_get_functiondef()``
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox