[pgadmin-hackers] Analyze only support

2003-07-02 Thread Adam H. Pendleton
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.xrc2003-05-02 11:34:37.0 -0400
+++ pgadmin3.new/src/ui/common/frmVacuum.xrc2003-07-02 14:46:02.0 -0400
@@ -2,12 +2,12 @@
 resource
   object class=wxDialog name=frmVacuum
 titleVACUUM an object/title
-size300, 190/size
+size300, 210/size
 stylewxSTAY_ON_TOP|wxCAPTION|wxSYSTEM_MENU/style
 object class=wxStaticBox name=stbBox
   labelVACUUM options/label
   pos10,10/pos
-  size280,85/size
+  size280,105/size
 /object
 object class=wxCheckBox name=chkFull
   labelFull/label
@@ -22,22 +22,26 @@
   checked1/checked
   pos35, 70/pos
 /object
+object class=wxCheckBox name=chkAnalyzeOnly
+labelAnalyze only (don't vacuum)/label
+pos75, 90/pos
+/object
 object class=wxStaticBitmap name=stBitmap
   bitmap stock_id=wxART_MISSING_IMAGE/bitmap
-  pos100,100/pos
+  pos100,110/pos
   size64,64/size
 /object
 object class=wxButton name=btnOK
   labelamp;OK/label
   default1/default
-  pos130, 160/pos
+  pos130, 180/pos
   size80, 25/size
 /object
 object class=wxButton name=btnCancel
   labelamp;Cancel/label
   default0/default
-  pos215, 160/pos
+  pos215, 180/pos
   size80, 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.0 -0400
+++ pgadmin3.new/src/ui/frmVacuum.cpp   2003-07-02 15:01:30.0 -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 stBitmapCTRL(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 stBitmapCTRL(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


Re: [pgadmin-hackers] Analyze only support

2003-07-02 Thread Dave Page


 -Original Message-
 From: Adam H. Pendleton [mailto:[EMAIL PROTECTED] 
 Sent: 02 July 2003 20:11
 To: [EMAIL PROTECTED]
 Subject: [pgadmin-hackers] Analyze only support
 
 
 
 If this patch is acceptable to everyone (read Andreas...:-P), then 
 please apply.

Well it looks OK to me so it's committed. Did you intend the new
checkbox to be centered rather than aligned with the rest?

A couple of potential improvements you might consider:

1) Remove the item from the todo list ;-)

2) Disable the other checkboxes when Analyze Only is selected.

Thanks, Dave.

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html