Here is a patch that enable "analyze only" support. For the time being (unless there are objections), this feature is manifested as another check box on the Vacuum dialog, which says "Analyze only (don't vacuum). This will perform a "ANALYZE ..." instead of a "VACUUM ANALYZE ...". There is also a small "bug" fix in this patch, in that since analzye doesn't return any data, there is no thread->DataSet() created, so a call to thread->DataSet()->NumRows() when thread->DataSet() == NULL will cause a segfault.

If this patch is acceptable to everyone (read Andreas...:-P), then please apply.

ahp
diff -ur pgadmin3/src/ui/common/frmVacuum.xrc pgadmin3.new/src/ui/common/frmVacuum.xrc
--- pgadmin3/src/ui/common/frmVacuum.xrc        2003-05-02 11:34:37.000000000 -0400
+++ pgadmin3.new/src/ui/common/frmVacuum.xrc    2003-07-02 14:46:02.000000000 -0400
@@ -2,12 +2,12 @@
 <resource>
   <object class="wxDialog" name="frmVacuum">
     <title>VACUUM an object</title>
-    <size>300, 190</size>
+    <size>300, 210</size>
     <style>wxSTAY_ON_TOP|wxCAPTION|wxSYSTEM_MENU</style>
     <object class="wxStaticBox" name="stbBox">
       <label>VACUUM options</label>
       <pos>10,10</pos>
-      <size>280,85</size>
+      <size>280,105</size>
     </object>
     <object class="wxCheckBox" name="chkFull">
       <label>Full</label>
@@ -22,22 +22,26 @@
       <checked>1</checked>
       <pos>35, 70</pos>
     </object>
+    <object class="wxCheckBox" name="chkAnalyzeOnly">
+        <label>Analyze only (don't vacuum)</label>
+        <pos>75, 90</pos>
+    </object>
     <object class="wxStaticBitmap" name="stBitmap">
       <bitmap stock_id="wxART_MISSING_IMAGE"></bitmap>
-      <pos>100,100</pos>
+      <pos>100,110</pos>
       <size>64,64</size>
     </object>
     <object class="wxButton" name="btnOK">
       <label>&amp;OK</label>
       <default>1</default>
-      <pos>130, 160</pos>
+      <pos>130, 180</pos>
       <size>80, 25</size>
     </object>
     <object class="wxButton" name="btnCancel">
       <label>&amp;Cancel</label>
       <default>0</default>
-      <pos>215, 160</pos>
+      <pos>215, 180</pos>
       <size>80, 25</size>
     </object>
   </object>
-</resource>
\ No newline at end of file
+</resource>
diff -ur pgadmin3/src/ui/frmVacuum.cpp pgadmin3.new/src/ui/frmVacuum.cpp
--- pgadmin3/src/ui/frmVacuum.cpp       2003-06-17 10:00:20.000000000 -0400
+++ pgadmin3.new/src/ui/frmVacuum.cpp   2003-07-02 15:01:30.000000000 -0400
@@ -29,12 +29,13 @@
     EVT_CLOSE(                          frmVacuum::OnClose)
 END_EVENT_TABLE()
 
-#define chkFull     CTRL("chkFull", wxCheckBox)
-#define chkFreeze   CTRL("chkFreeze", wxCheckBox)
-#define chkAnalyze  CTRL("chkAnalyze", wxCheckBox)
-#define stBitmap    CTRL("stBitmap", wxStaticBitmap)
-#define btnOK       CTRL("btnOK", wxButton)
-#define btnCancel   CTRL("btnCancel", wxButton)
+#define chkFull         CTRL("chkFull", wxCheckBox)
+#define chkFreeze       CTRL("chkFreeze", wxCheckBox)
+#define chkAnalyze      CTRL("chkAnalyze", wxCheckBox)
+#define chkAnalyzeOnly  CTRL("chkAnalyzeOnly", wxCheckBox)
+#define stBitmap        CTRL("stBitmap", wxStaticBitmap)
+#define btnOK           CTRL("btnOK", wxButton)
+#define btnCancel       CTRL("btnCancel", wxButton)
 
 
 
@@ -86,14 +87,20 @@
     {
         btnOK->Disable();
 
-        wxString sql=wxT("VACUUM ");
+        wxString sql;
+        if (chkAnalyzeOnly->GetValue())
+            sql = wxT("ANALYZE ");
+        else
+        {
+            sql=wxT("VACUUM ");
 
-        if (chkFull->GetValue())
-            sql += wxT("FULL ");
-        if (chkFreeze->GetValue())
-            sql += wxT("FREEZE ");
-        if (chkAnalyze->GetValue())
-            sql += wxT("ANALYZE ");
+            if (chkFull->GetValue())
+                sql += wxT("FULL ");
+            if (chkFreeze->GetValue())
+                sql += wxT("FREEZE ");
+            if (chkAnalyze->GetValue())
+                sql += wxT("ANALYZE ");
+        }
 
         if (object->GetType() != PG_DATABASE)
             sql += object->GetTypeName() + wxT(" ")
@@ -115,6 +122,8 @@
             // here could be the animation
         }
 
+        if (thread->DataSet() != NULL)
+            wxLogDebug(wxString::Format(_("%d rows."), thread->DataSet()->NumRows()));
         if (thread)
         {
             btnOK->SetLabel(_("Done"));
---------------------------(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