Log Message:
-----------
fix GrantWizard for sequence and view

Modified Files:
--------------
    pgadmin3/src/ui:
        dlgClasses.cpp (r1.8 -> r1.9)
        frmGrantWizard.cpp (r1.4 -> r1.5)

Index: frmGrantWizard.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmGrantWizard.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lsrc/ui/frmGrantWizard.cpp -Lsrc/ui/frmGrantWizard.cpp -u -w -r1.4 -r1.5
--- src/ui/frmGrantWizard.cpp
+++ src/ui/frmGrantWizard.cpp
@@ -47,6 +47,9 @@
     LoadResource(form, wxT("frmGrantWizard"));
     RestorePosition();
 
+    if (object->IsCollection())
+        SetTitle(wxString::Format(_("Privileges for %s"), 
object->GetTranslatedTypeName().c_str(), ""));
+    else
     SetTitle(wxString::Format(_("Privileges for %s %s"), 
object->GetTranslatedTypeName().c_str(), object->GetFullIdentifier().c_str()));
 
     // Icon
@@ -222,14 +225,24 @@
 
             pgObject *obj=(pgObject*)objectArray.Item(i);
 
-            if (obj->GetType() == PG_FUNCTION || obj->GetType() == PG_TRIGGERFUNCTION)
+            switch (obj->GetType())
+            {
+                case PG_FUNCTION:
+                case PG_TRIGGERFUNCTION:
             {
                 tmp = securityPage->GetGrant(wxT("X"), wxT("FUNCTION ") 
                     + obj->GetQuotedFullIdentifier() + wxT("(")
                     + ((pgFunction*)obj)->GetArgTypes() + wxT(")"));
+                    break;
             }
-            else
+                case PG_VIEW:
+                case PG_SEQUENCE:
+                    tmp = securityPage->GetGrant(wxT("arwdRxt"), wxT("TABLE ") + 
obj->GetQuotedFullIdentifier());
+                    break;
+                default:
                 tmp = securityPage->GetGrant(wxT("arwdRxt"), 
obj->GetTypeName().Upper() + wxT(" ") + obj->GetQuotedFullIdentifier());
+                    break;
+            }
 
             if (!tmp.IsEmpty())
                 sql.Append(tmp);
Index: dlgClasses.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgClasses.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lsrc/ui/dlgClasses.cpp -Lsrc/ui/dlgClasses.cpp -u -w -r1.8 -r1.9
--- src/ui/dlgClasses.cpp
+++ src/ui/dlgClasses.cpp
@@ -235,12 +235,16 @@
 
         if (thread)
         {
+            bool isOk = (thread->ReturnCode() == PGRES_COMMAND_OK || 
thread->ReturnCode() == PGRES_TUPLES_OK);
+
             if (txtMessages)
                 txtMessages->AppendText(thread->GetMessagesAndClear());
 
             if (thread->DataSet() != NULL)
                 wxLogDebug(wxString::Format(_("%d rows."), 
thread->DataSet()->NumRows()));
 
+            if (isOk)
+            {
             if (txtMessages)
                 txtMessages->AppendText(_("Total query runtime: ") 
                     + (wxGetLocalTimeMillis()-startTime).ToString() + wxT(" ms."));
@@ -249,6 +253,13 @@
             btnCancel->Disable();
         }
         else
+            {
+                if (txtMessages)
+                    txtMessages->AppendText(object->GetConnection()->GetLastError());
+                Abort();
+            }
+        }
+        else
             if (txtMessages)
                 txtMessages->AppendText(_("\nCancelled.\n"));
 
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to