Log Message:
-----------
GRANT for functions in reengineered SQL window
1.2B2 Fix Database creation for 7.3/7.4 [Jona]

Modified Files:
--------------
    pgadmin3:
        BUGS.txt (r1.56 -> r1.57)
        CHANGELOG.txt (r1.136 -> r1.137)
    pgadmin3/src/include:
        frmMain.h (r1.54 -> r1.55)
    pgadmin3/src/schema:
        pgFunction.cpp (r1.38 -> r1.39)
        pgLanguage.cpp (r1.24 -> r1.25)
        pgObject.cpp (r1.72 -> r1.73)
        pgSchema.cpp (r1.35 -> r1.36)
        pgSequence.cpp (r1.26 -> r1.27)
        pgView.cpp (r1.32 -> r1.33)
    pgadmin3/src/ui:
        dlgDatabase.cpp (r1.32 -> r1.33)
        dlgProperty.cpp (r1.94 -> r1.95)
        frmMain.cpp (r1.109 -> r1.110)

Index: BUGS.txt
===================================================================
RCS file: /projects/pgadmin3/BUGS.txt,v
retrieving revision 1.56
retrieving revision 1.57
diff -LBUGS.txt -LBUGS.txt -u -w -r1.56 -r1.57
--- BUGS.txt
+++ BUGS.txt
@@ -1,7 +1,6 @@
 <ul>
     <li>Known issues
     <ul>
-        <li>Permissions on functions are not included in generated SQL</li>
     </ul>
     <li>Known wxWindows issues
     <ul>
Index: CHANGELOG.txt
===================================================================
RCS file: /projects/pgadmin3/CHANGELOG.txt,v
retrieving revision 1.136
retrieving revision 1.137
diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.136 -r1.137
--- CHANGELOG.txt
+++ CHANGELOG.txt
@@ -17,6 +17,8 @@
 </ul>
 <br>
 <ul>
+    <li>2004-09-17 AP  1.2B2 GRANT for functions in reengineered SQL window
+    <li>2004-09-17 AP  1.2B2 Fix Database creation for 7.3/7.4 [Jona]
     <li>2004-09-16 AP  1.2B2 resources: use wxID_xxx IDs to enable GTK wxStockButtons
     <li>2004-09-16 AP  1.2B2 resources: use 12d height for comboboxes (GTK 
positioning issue)
     <li>2004-09-16 AP  1.2B2 rewrite of properties actions
Index: frmMain.h
===================================================================
RCS file: /projects/pgadmin3/src/include/frmMain.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -Lsrc/include/frmMain.h -Lsrc/include/frmMain.h -u -w -r1.54 -r1.55
--- src/include/frmMain.h
+++ src/include/frmMain.h
@@ -44,6 +44,7 @@
     void StartMsg(const wxString& msg);
     void EndMsg();
     void SetStatusText(const wxString &msg);
+    void SetCurrentObject(pgObject *data) { currentObject = data; }
 
     void SetButtons(pgObject *obj=0);
 
Index: pgObject.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgObject.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -Lsrc/schema/pgObject.cpp -Lsrc/schema/pgObject.cpp -u -w -r1.72 -r1.73
--- src/schema/pgObject.cpp
+++ src/schema/pgObject.cpp
@@ -533,15 +533,17 @@
 }
 
 
-wxString pgObject::GetGrant(const wxString& allPattern, const wxString& _grantOnType, 
bool noOwner)
+wxString pgObject::GetGrant(const wxString& allPattern, const wxString& _grantFor, 
bool noOwner)
 {
-    wxString grant, str, user, grantOnType;
-    if (_grantOnType.IsNull())
-        grantOnType=GetTypeName();
+    wxString grant, str, user, grantFor;
+    if (_grantFor.IsNull())
+    {
+        grantFor = GetTypeName();
+        grantFor.MakeUpper();
+        grantFor += wxT(" ") + GetQuotedFullIdentifier();
+    }
     else
-        grantOnType = _grantOnType;
-
-    grantOnType.MakeUpper();
+        grantFor = _grantFor;
 
     if (!acl.IsNull())
     {
@@ -564,7 +566,7 @@
                     user = qtIdent(user);
             }
 
-            grant += GetPrivileges(allPattern, str, grantOnType + wxT(" ") + 
GetQuotedFullIdentifier(), user);
+            grant += GetPrivileges(allPattern, str, grantFor, user);
         }
     }
     return grant;
Index: pgFunction.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgFunction.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lsrc/schema/pgFunction.cpp -Lsrc/schema/pgFunction.cpp -u -w -r1.38 -r1.39
--- src/schema/pgFunction.cpp
+++ src/schema/pgFunction.cpp
@@ -50,10 +50,12 @@
 {
     if (sql.IsNull())
     {
-        sql = wxT("-- Function: ") + GetQuotedFullIdentifier() + wxT("(") + 
GetArgTypeNames() + wxT(")\n\n")
-            + wxT("-- DROP FUNCTION ") + GetQuotedFullIdentifier()  + wxT("(") + 
GetQuotedArgTypes() + wxT(");")
-            + wxT("\n\nCREATE OR REPLACE FUNCTION ") + GetQuotedFullIdentifier() + 
wxT("(") + GetQuotedArgTypeNames()
-            + wxT(")\n  RETURNS ");
+        wxString qtName = wxT("FUNCTION ") + GetQuotedFullIdentifier()  + wxT("(") + 
GetQuotedArgTypes() + wxT(")");
+
+        sql = wxT("-- Function: ") + GetFullIdentifier() + wxT("(") + 
GetArgTypeNames() + wxT(")\n\n")
+            + wxT("-- DROP ") + qtName + wxT(";")
+            + wxT("\n\nCREATE OR REPLACE ") + qtName
+            + wxT("\n  RETURNS ");
         if (GetReturnAsSet())
             sql += wxT("SETOF ");
         sql +=GetQuotedReturnType() 
@@ -76,11 +78,12 @@
             sql += wxT(" STRICT");
         if (GetSecureDefiner())
             sql += wxT(" SECURITY DEFINER");
-        sql += wxT(";\n");
+        sql += wxT(";\n")
+            +  GetGrant(wxT("X"), qtName);
 
     if (!GetComment().IsNull())
     {
-        sql += wxT("COMMENT ON FUNCTION ") + GetQuotedFullIdentifier() + wxT("(") + 
GetQuotedArgTypes() + wxT(")")
+            sql += wxT("COMMENT ON ") + qtName
             + wxT(" IS ") + qtString(GetComment()) + wxT(";\n");
     }
 }
Index: pgView.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgView.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lsrc/schema/pgView.cpp -Lsrc/schema/pgView.cpp -u -w -r1.32 -r1.33
--- src/schema/pgView.cpp
+++ src/schema/pgView.cpp
@@ -53,7 +53,7 @@
             + wxT("\n\nCREATE OR REPLACE VIEW ") + GetQuotedFullIdentifier() + wxT(" 
AS \n")
             + GetFormattedDefinition()
             + wxT("\n\n") 
-            + GetGrant(wxT("arwdRxt"), wxT("Table"))
+            + GetGrant(wxT("arwdRxt"), wxT("TABLE ") + GetQuotedFullIdentifier())
             + GetCommentSql();
     }
     return sql;
Index: pgSequence.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgSequence.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lsrc/schema/pgSequence.cpp -Lsrc/schema/pgSequence.cpp -u -w -r1.26 -r1.27
--- src/schema/pgSequence.cpp
+++ src/schema/pgSequence.cpp
@@ -71,7 +71,7 @@
             sql += wxT("\n  CYCLE");
         AppendIfFilled(sql, wxT("\n  TABLESPACE "), qtIdent(tablespace));
         sql += wxT(";\n")
-            + GetGrant(wxT("arwdRxt"), wxT("TABLE"))
+            + GetGrant(wxT("arwdRxt"), wxT("TABLE ") + GetQuotedFullIdentifier())
             + GetCommentSql();
     }
 
Index: pgLanguage.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgLanguage.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -Lsrc/schema/pgLanguage.cpp -Lsrc/schema/pgLanguage.cpp -u -w -r1.24 -r1.25
--- src/schema/pgLanguage.cpp
+++ src/schema/pgLanguage.cpp
@@ -47,7 +47,7 @@
             sql += wxT("TRUSTED ");
         sql += wxT("PROCEDURAL LANGUAGE '") + GetName() 
             +  wxT("'\n  HANDLER ") + GetHandlerProc() + wxT(";\n")
-            +  GetGrant(wxT("X"), GetTypeName(), true);
+            +  GetGrant(wxT("X"), wxT("LANGUAGE ") + GetQuotedFullIdentifier(), true);
 
     }
     return sql;
Index: pgSchema.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgSchema.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -Lsrc/schema/pgSchema.cpp -Lsrc/schema/pgSchema.cpp -u -w -r1.35 -r1.36
--- src/schema/pgSchema.cpp
+++ src/schema/pgSchema.cpp
@@ -73,7 +73,7 @@
         AppendIfFilled(sql, wxT(" TABLESPACE "), qtIdent(tablespace));
 
         sql += wxT(";\n")
-            + GetGrant(wxT("UC"), GetTypeName(), true)
+            + GetGrant(wxT("UC"), wxT("SCHEMA ") + GetQuotedFullIdentifier(), true)
             + GetCommentSql();
     }
     return sql;
Index: dlgDatabase.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgDatabase.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lsrc/ui/dlgDatabase.cpp -Lsrc/ui/dlgDatabase.cpp -u -w -r1.32 -r1.33
--- src/ui/dlgDatabase.cpp
+++ src/ui/dlgDatabase.cpp
@@ -81,8 +81,6 @@
     AddGroups();
     AddUsers(cbOwner);
 
-    if (!connection->BackendMinimumVersion(7, 4))
-        txtName->Disable();
 
     if (connection->BackendMinimumVersion(7, 5))
     {
@@ -91,7 +89,6 @@
     }
     else
     {
-        cbOwner->Disable();
         cbTablespace->Hide();
     }
 
@@ -99,6 +96,12 @@
     {
         // edit mode
 
+        if (!connection->BackendMinimumVersion(7, 4))
+            txtName->Disable();
+
+        if (!connection->BackendMinimumVersion(7, 5))
+            cbOwner->Disable();
+
         readOnly = !database->GetServer()->GetCreatePrivilege();
 
         size_t i;
Index: dlgProperty.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgProperty.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -Lsrc/ui/dlgProperty.cpp -Lsrc/ui/dlgProperty.cpp -u -w -r1.94 -r1.95
--- src/ui/dlgProperty.cpp
+++ src/ui/dlgProperty.cpp
@@ -480,6 +480,7 @@
         pgObject *newData=data->Refresh(mainForm->GetBrowser(), item);
         if (newData && newData != data)
         {
+            mainForm->SetCurrentObject(newData);
             mainForm->GetBrowser()->SetItemData(item, newData);
             mainForm->GetBrowser()->SetItemImage(item, newData->GetIcon(), 
wxTreeItemIcon_Normal);
             mainForm->GetBrowser()->SetItemImage(item, newData->GetIcon(), 
wxTreeItemIcon_Selected);
Index: frmMain.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmMain.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -Lsrc/ui/frmMain.cpp -Lsrc/ui/frmMain.cpp -u -w -r1.109 -r1.110
--- src/ui/frmMain.cpp
+++ src/ui/frmMain.cpp
@@ -410,6 +410,9 @@
         wxLogInfo(wxT("Deleting ") + data->GetTypeName() + wxT(" ") 
             + data->GetQuotedFullIdentifier() + wxT(" for Refresh"));
 
+        if (data == currentObject)
+            currentObject = newData;
+
         if (newData)
         {
             wxLogInfo(wxT("Replacing with new Node ") + newData->GetTypeName() + 
wxT(" ") 
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to