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

Reply via email to