Author: dpage
Date: 2006-01-17 12:44:12 +0000 (Tue, 17 Jan 2006)
New Revision: 4904

Modified:
   trunk/pgadmin3/CHANGELOG.txt
   trunk/pgadmin3/src/dlg/dlgFunction.cpp
Log:
Allow set returning functions to be created.

Modified: trunk/pgadmin3/CHANGELOG.txt
===================================================================
--- trunk/pgadmin3/CHANGELOG.txt        2006-01-17 12:43:10 UTC (rev 4903)
+++ trunk/pgadmin3/CHANGELOG.txt        2006-01-17 12:44:12 UTC (rev 4904)
@@ -18,7 +18,8 @@
 </ul>
 <br>
 <ul>
-    <LI>2006-01-17 DP  1.4.2  Display the defintion of set returning 
procedures correctly.
+    <li>2006-01-17 DP         Allow set returning functions to be created.
+    <li>2006-01-17 DP  1.4.2  Display the defintion of set returning 
procedures correctly.
     <li>2006-01-17 DP  1.4.2  Fix drop procedure by including IN/OUT parameter 
flags in the name.
     <li>2006-01-13 DP  1.4.2  Fix role SQL - correctly define 
CREATEROLE/NOCREATEROLE per Andrus.
     <li>2006-01-11 DP         Allow result copy quoting configuration to be 
set explicitly rather than using the result export settings [Magnus Hagander]

Modified: trunk/pgadmin3/src/dlg/dlgFunction.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgFunction.cpp      2006-01-17 12:43:10 UTC (rev 
4903)
+++ trunk/pgadmin3/src/dlg/dlgFunction.cpp      2006-01-17 12:44:12 UTC (rev 
4904)
@@ -166,7 +166,6 @@
         }
         stReturntype->Hide();
         cbReturntype->Hide();
-        chkSetof->Hide();
     }
     else
     {
@@ -622,21 +621,38 @@
         {
             if (!connection->EdbMinimumVersion(8, 0))
             {
-                bool hasOut=false;
+                int outParams=0;
+                wxString setType;
 
                 int i;
                 for (i=0 ; i < lstArguments->GetItemCount() ; i++)
                 {
                     if (GetDirection(lstArguments->GetText(i)) > 0)
                     {
-                        hasOut=true;
-                        break;
+                        setType = lstArguments->GetText(i, typeColNo);
+                        outParams++;
                     }
                 }
 
-                if (!hasOut)
+                if (outParams == 0)
                     sql += wxT(" RETURNS void");
+                else 
+                {
+                    if (chkSetof->GetValue())
+                    {
+                        if (outParams == 1)
+                        {
+                            sql += wxT(" RETURNS SETOF ") + setType;
+                        }
+                        else
+                        {
+                            sql += wxT(" RETURNS SETOF record");
+                        }
+                    }
+                }
+                    
             }
+
         }
         else
         {


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to