As promised, here are two other patches, one each for the following:
1. IS DISTINCT FROM to replace '<>' in the WHERE conditions
2. Documentation addition in the html about the recent Selection/Sort
changes.
Still working on the crash regarding thread->IsRunning().
*Robins*
---------- Forwarded message ----------
From: Robins Tharakan <[EMAIL PROTECTED]>
Date: Feb 10, 2008 12:22 AM
Subject: Re: [pgadmin-hackers] Fwd: Filter by Selection on Grid
To: Dave Page <[EMAIL PROTECTED]>
Cc: [email protected]
Hi,
Hmmm... although I did do a complete svn co before submitting my previous
patch, I think I am making it all complicated by bringing in too many things
together.
I think you're right. Probably its better to do one thing at a time :)
Attached is a patch to correct the Sort issue. It does an in-place string
replace if the sort order is changed by the user.
Once this goes ahead, I have a few more patches coming up:
1. IS DISTINCT FROM to replace '<>' in the WHERE conditions
2. Documentation addition in the html about the recent Selection/Sort
changes.
3. Ensure that a thread->IsRunning() in frmEdit.cpp (line: ~414) doesn't
cause a crash.
*Robins Tharakan*
---------- Forwarded message ----------
From: Dave Page <[EMAIL PROTECTED]>
Date: Feb 7, 2008 4:50 PM
Subject: Re: [pgadmin-hackers] Fwd: Filter by Selection on Grid
To: Robins Tharakan <[EMAIL PROTECTED]>
Cc: [email protected]
Hi.
On Feb 6, 2008 5:42 PM, Robins Tharakan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> The attached patch does this:
> 1. Sanitize the if-else bracket style for the earlier patch.
> 2. Use 'IS DISTINCT FROM' instead of <> in an exclusion condition.
>
> Two issues remain that I can't resolve:
> 1. Rightly as you point out thread->IsRunning() needs to be called only if
> it exists. On rigorous testing the application bombs if this thread is
> non-existent (backtrace attached). Any good way to check whether a thread
is
> running ? Any flag etc ?
I think you misunderstood my previous message. I committed your patch
to SVN, and cleaned up the formatting, added the test to ensure thread
is valid, and added the proper quoting.
So at this point you should svn update and start working from svn
trunk again to add the IS DISTINCT FROM and duplicate sort prevention.
> 2. The case of selection and deselection of the same field name can
> (ideally) cause a bit of a complication.
> Consider this:
> a. M=10 AND M <> 10
> b. M = 10 AND (N = 10 OR M <> 10)
> If we are to filter out the old test condition replacing it with a new
test
> condition using a string parser how does it understand the difference
> between case (a) and case (b) ? Unless I am missing the point, I think to
> effectively resolve this would need a inverted tree structure for the
where
> clause which I think is a bit of an overkill for now ?
Well the code you are adding is primarily a shortcut which is likely
not going to be used by someone at the same time as they manually
author filter strings - so I say we just document the potential issue
and leave it at that. I'm more concerned about the sorting side where
it should be trivial to detect the duplicate.
Speaking of which, this feature should have a paragraph or two in the
docs - I forgot to mention that, sorry (we've been waiting to release
8.3 for months so I'm somewhat rusty at this!).
Thanks, Dave.
Index: pgadmin/frm/frmEditGrid.cpp
===================================================================
--- pgadmin/frm/frmEditGrid.cpp (revision 7069)
+++ pgadmin/frm/frmEditGrid.cpp (working copy)
@@ -529,9 +529,9 @@
} else {
if (sqlGrid->GetCellValue(currow, curcol) == wxT("\'\'")) {
- new_filter_string += column_label + wxString::Format(_(" <> '' ")) ;
+ new_filter_string += column_label + wxString::Format(_(" IS DISTINCT FROM '' ")) ;
} else {
- new_filter_string += column_label + wxT(" <> ") + connection->qtDbString(sqlGrid->GetCellValue(currow, curcol)) + wxT(" ");
+ new_filter_string += column_label + wxT(" IS DISTINCT FROM ") + connection->qtDbString(sqlGrid->GetCellValue(currow, curcol)) + wxT(" ");
}
}
} else {
@@ -539,7 +539,7 @@
if (sqlGrid->GetCellValue(currow, curcol).IsNull()) {
new_filter_string += column_label + wxT(" IS NOT NULL ") ;
} else {
- new_filter_string += column_label + wxT(" <> ") + sqlGrid->GetCellValue(currow, curcol);
+ new_filter_string += column_label + wxT(" IS DISTINCT FROM ") + sqlGrid->GetCellValue(currow, curcol);
}
}
Index: docs/en_US/editgrid.html
===================================================================
--- docs/en_US/editgrid.html (revision 7069)
+++ docs/en_US/editgrid.html (working copy)
@@ -46,9 +46,38 @@
<P>
You can select one or more rows, and copy them with Ctrl-C or the Copy
toolbar button to the clipboard.
-</P><P>
+</P>
+<P>
The Sort/Filter toolbar button will open the <A
href=gridopts.html>View Data Options</A> dialog.
</P>
+<P>
+The right-click could also be used to Sort / Filter the data-set. When
+right-clicked on a given cell, the following options allow the user to
+selectively view the data-set:
+<ul>
+<li><i>Filter by Selection</i>: When selected, refreshes the data-set and displays
+only those rows, whose given column value matches the value as in the column
+currently selected.</li>
+<li><i>Exclude by Selection</i>: When selected, refreshes the data-set and
+excludes those rows, whose given column value matches the value as in the column
+currently selected.</li>
+<li><i>Remove Filter</i>: When selected, removes all selection / exclusion
+filter conditions.</li>
+<li><i>Sort Ascending</i>: When selected, refreshes the data-set and displays
+the currently selected rows in the ascending order (of the selected column).
+In case a sorting preference is already present for this data-set, this sorting
+preference is appended to the current sort order.</li>
+<li><i>Sort Descending</i>: When selected, refreshes the data-set and displays
+the currently selected rows in the descending order (of the selected column).
+In case a sorting preference is already present for this data-set, this sorting
+preference is appended to the current sort order.</li>
+<li><i>Remove Filter</i>: When selected, removes all sorting preferences for
+this data-set.</li>
+</ul>
+(In case sorting preference (for a given column) is selected more than once,
+the sorting priority remains, however, the latest sorting preference
+(i.e. ASC or DESC) is considered.)
+</P>
</BODY>
</HTML>
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend