Log Message:
-----------
fix writing dlg_hba.conf

Modified Files:
--------------
    pgadmin3:
        CHANGELOG.txt (r1.171 -> r1.172)
    pgadmin3/src/ui:
        dlgHbaConfig.cpp (r1.3 -> r1.4)
        frmHbaConfig.cpp (r1.2 -> r1.3)
    pgadmin3/src/utils:
        pgconfig.cpp (r1.2 -> r1.3)
    pgadmin3/src/include:
        pgconfig.h (r1.2 -> r1.3)
    pgadmin3/src/schema:
        pgTablespace.cpp (r1.9 -> r1.10)

Index: CHANGELOG.txt
===================================================================
RCS file: /projects/pgadmin3/CHANGELOG.txt,v
retrieving revision 1.171
retrieving revision 1.172
diff -LCHANGELOG.txt -LCHANGELOG.txt -u -w -r1.171 -r1.172
--- CHANGELOG.txt
+++ CHANGELOG.txt
@@ -17,11 +17,14 @@
 </ul>
 <br>
 <ul>
-    <li>2004-11-19 AP 1.2RC3 catch possible false error msg
-    <li>2004-11-19 AP 1.2RC3 fix tables statistics
-    <li>2004-11-18 AP 1.2RC3 fix change column dialog (r: Walter Haslbeck)
-    <li>2004-11-18 AP 1.2RC3 fix missing schema in EditGrid (r: Martin Susil)
-    <li>2004-11-16 AP 1.2RC3 fix pg_dump option
+    <li>2004-12-15 AP        Fix changing pg_hba.conf
+    <li>2004-12-10 AP ***    Fix missing drop confirmation (r: Cheetah)
+    <li>2004-12-06 AP ***    Fix tablespace reference in namespace
+    <li>2004-11-19 AP 1.2.0  catch possible false error msg
+    <li>2004-11-19 AP 1.2.0  fix tables statistics
+    <li>2004-11-18 AP 1.2.0  fix change column dialog (r: Walter Haslbeck)
+    <li>2004-11-18 AP 1.2.0  fix missing schema in EditGrid (r: Martin Susil)
+    <li>2004-11-16 AP 1.2.0  fix pg_dump option
     <li>2004-11-10 AP 1.2RC2 Remove tablespace from schema (pgsql post-beta4 
change)
     <li>2004-11-10 AP 1.2RC2 Fix properties for multiply inherited tables (r: 
Riccardo G. Facchini)
     <li>2004-11-10 AP 1.2RC2 Fix OSX issue (r: Patrick Hatcher)
Index: frmHbaConfig.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/frmHbaConfig.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lsrc/ui/frmHbaConfig.cpp -Lsrc/ui/frmHbaConfig.cpp -u -w -r1.2 -r1.3
--- src/ui/frmHbaConfig.cpp
+++ src/ui/frmHbaConfig.cpp
@@ -257,13 +257,14 @@
         if (lines.Item(i).item == pos)
         {
             pgHbaConfigLine &line = lines.Item(i);
+            bool isLastLine = (i == lines.GetCount()-1 && line.isComment && 
!line.GetConnectType());
 
             dlgHbaConfig dlg(this, &line, conn);
             if (dlg.Go() == wxID_OK)
             {
                 UpdateDisplay(line);
 
-                if (line.isComment && !line.GetConnectType())
+                if (isLastLine)
                 {
                     long pos=listEdit->AppendItem(0, wxEmptyString);
                     pgHbaConfigLine *line=new pgHbaConfigLine();
Index: dlgHbaConfig.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgHbaConfig.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lsrc/ui/dlgHbaConfig.cpp -Lsrc/ui/dlgHbaConfig.cpp -u -w -r1.3 -r1.4
--- src/ui/dlgHbaConfig.cpp
+++ src/ui/dlgHbaConfig.cpp
@@ -29,6 +29,7 @@
     EVT_BUTTON (wxID_OK,                dlgHbaConfig::OnOK)
     EVT_BUTTON (wxID_CANCEL,            dlgHbaConfig::OnCancel)
     EVT_BUTTON(wxID_REFRESH,           dlgHbaConfig::OnAddValue)
+    EVT_CHECKBOX(XRCID("chkEnabled"),   dlgHbaConfig::OnChange)
     EVT_COMBOBOX(XRCID("cbType"),       dlgHbaConfig::OnChange)
     EVT_TEXT(XRCID("cbDatabase"),       dlgHbaConfig::OnChange)
     EVT_TEXT(XRCID("cbUser"),           dlgHbaConfig::OnChange)
@@ -309,6 +310,7 @@
     line->ipaddress = txtIPaddress->GetValue();
     line->method = (pgHbaConfigLine::pgHbaMethod)cbMethod->GetSelection();
     line->option = txtOption->GetValue();
+    line->changed = true;
 
     EndModal(wxID_OK);
 }
Index: pgconfig.cpp
===================================================================
RCS file: /projects/pgadmin3/src/utils/pgconfig.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lsrc/utils/pgconfig.cpp -Lsrc/utils/pgconfig.cpp -u -w -r1.2 -r1.3
--- src/utils/pgconfig.cpp
+++ src/utils/pgconfig.cpp
@@ -359,16 +359,22 @@
 };
 
 
+bool IsSpaceChar(wxChar c, const wxChar *spaceChars=wxT("\t "))
+{
+    return wxStrchr(spaceChars, c) != NULL;
+}
+
+
 void SkipSpace(const wxChar* &ptr, const wxChar *spaceChars=wxT("\t "))
 {
-    while (*ptr && wxStrchr(wxT("\t "), *ptr))
+    while (*ptr && IsSpaceChar(*ptr))
         ptr++;
 }
 
 
 void SkipNonspace(const wxChar* &ptr, const wxChar *spaceChars=wxT("\t "))
 {
-    while (*ptr && !wxStrchr(wxT("\t "), *ptr))
+    while (*ptr && !IsSpaceChar(*ptr))
         ptr++;
 }
 
@@ -385,6 +391,7 @@
 void pgHbaConfigLine::Init(const wxString &line)
 {
     connectType = PGC_INVALIDCONF;
+    changed = false;
 
     if (line.IsEmpty())
         return;
@@ -426,7 +433,7 @@
 
     while (*p2)
     {
-        if (wxStrchr(wxT("\n "), *p2) && !quoted)
+        if (!quoted && IsSpaceChar(*p2))
             break;
         if (*p2 == '"')
             quoted ^= quoted;
@@ -442,7 +449,7 @@
     quoted=false;
     while (*p3)
     {
-        if (wxStrchr(wxT("\n "), *p3) && !quoted)
+        if (!quoted && IsSpaceChar(*p3))
             break;
         if (*p3 == '"')
             quoted ^= quoted;
@@ -462,7 +469,7 @@
     else
     {
         bool hasCidr=false;
-        while (*p4 && !wxStrchr(wxT("\n "), *p4))
+        while (*p4 && !IsSpaceChar(*p4))
         {
             if (*p4 == '/')
                 hasCidr=true;
@@ -516,17 +523,26 @@
 
 wxString pgHbaConfigLine::GetText()
 {
-    if (!DidChange())
+    if (!changed)
         return text;
 
     wxString str;
-    return str;
-}
+    wxString tabspace=wxT("\t ");
+    if (isComment)
+        str = wxT("# ");
 
+    str += GetConnectType() 
+        +  tabspace + database
+        +  tabspace + user;
 
-bool pgHbaConfigLine::DidChange()
-{
-    if (isComment)
-        return false;
-    return false;
+    if (connectType != PGC_LOCAL)
+        str += tabspace + ipaddress;
+
+    str += tabspace + GetMethod();
+
+    if (connectType >= PGC_IDENT && !option.IsEmpty())
+        str += tabspace + option;
+
+    return str;
 }
+
Index: pgconfig.h
===================================================================
RCS file: /projects/pgadmin3/src/include/pgconfig.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lsrc/include/pgconfig.h -Lsrc/include/pgconfig.h -u -w -r1.2 -r1.3
--- src/include/pgconfig.h
+++ src/include/pgconfig.h
@@ -55,7 +55,6 @@
     wxString GetText();
     const wxChar *GetConnectType();
     const wxChar *GetMethod();
-    bool DidChange();
     void Init(const wxString &line);
 
     enum pgHbaConnectType
@@ -88,6 +87,7 @@
     long item;
 
     bool isComment;
+    bool changed;
 };
 
 class pgSettingItem
Index: pgTablespace.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgTablespace.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lsrc/schema/pgTablespace.cpp -Lsrc/schema/pgTablespace.cpp -u -w -r1.9 
-r1.10
--- src/schema/pgTablespace.cpp
+++ src/schema/pgTablespace.cpp
@@ -78,12 +78,6 @@
         wxT(" WHERE datname = current_database()\n")
         wxT("   AND (cl.reltablespace = ") + GetOidStr() + wxT("\n")
         wxT("        OR (cl.reltablespace=0 AND dattablespace = ") + 
GetOidStr() + wxT("))\n")
-        wxT("UNION ALL\n")
-        wxT("SELECT 'n', null, nspname, null\n")
-        wxT("  FROM pg_namespace, pg_database\n")
-        wxT(" WHERE datname = current_database()\n")
-        wxT("   AND (nsptablespace = ") + GetOidStr() + wxT("\n")
-        wxT("        OR (nsptablespace=0 AND dattablespace = ") + GetOidStr() 
+ wxT("))\n")
         wxT(" ORDER BY 1,2,3"));
 
     form->EndMsg();
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to