aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-09-29 13:48:18 +0000
committerBibiko <bibiko@eva.mpg.de>2010-09-29 13:48:18 +0000
commit959607aeb1ecec386ad0e3b8799893af2bf61271 (patch)
treee9140d41dcf37e415b5d5a1fed323d4130975a7a /Source
parent0ff441a257f77492b8cabd4270e044e3707b5cb0 (diff)
downloadsequelpro-959607aeb1ecec386ad0e3b8799893af2bf61271.tar.gz
sequelpro-959607aeb1ecec386ad0e3b8799893af2bf61271.tar.bz2
sequelpro-959607aeb1ecec386ad0e3b8799893af2bf61271.zip
• Filter Table
- minor GUI improvements - try to fix issue 1654
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableContent.h2
-rw-r--r--Source/SPTableContent.m11
2 files changed, 9 insertions, 4 deletions
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index 5f3aba47..a23aec65 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -72,7 +72,7 @@
IBOutlet NSButton *filterTableClearButton;
IBOutlet SPTextView *filterTableWhereClause;
IBOutlet id filterTableNegateCheckbox;
- IBOutlet id filterTableDistinctCheckbox;
+ IBOutlet NSMenuItem *filterTableDistinctMenuItem;
IBOutlet id filterTableLiveSearchCheckbox;
IBOutlet NSMenuItem *filterTableGearLookAllFields;
IBOutlet NSPanel *filterTableSetDefaultOperatorSheet;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index bb7754cc..d9bd1edf 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -172,7 +172,7 @@
[contentViewPane addSubview:paginationView];
// Init Filter Table GUI
- [filterTableDistinctCheckbox setState:(filterTableDistinct) ? NSOnState : NSOffState];
+ [filterTableDistinctMenuItem setState:(filterTableDistinct) ? NSOnState : NSOffState];
[filterTableNegateCheckbox setState:(filterTableNegate) ? NSOnState : NSOffState];
[filterTableLiveSearchCheckbox setState:NSOffState];
filterTableDefaultOperator = [[self escapeFilterTableDefaultOperator:[prefs objectForKey:SPFilterTableDefaultOperator]] retain];
@@ -636,7 +636,7 @@
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
// Start construction of the query string
- queryString = [NSMutableString stringWithFormat:@"SELECT %@%@ FROM %@", (activeFilter == 1 && [self tableFilterString] && [filterTableDistinctCheckbox state] == NSOnState) ? @"DISTINCT " : @"", [self fieldListForQuery], [selectedTable backtickQuotedString]];
+ queryString = [NSMutableString stringWithFormat:@"SELECT %@%@ FROM %@", (activeFilter == 1 && [self tableFilterString] && filterTableDistinct) ? @"DISTINCT " : @"", [self fieldListForQuery], [selectedTable backtickQuotedString]];
// Add a filter string if appropriate
filterString = [self tableFilterString];
@@ -2933,6 +2933,8 @@
{
filterTableDistinct = !filterTableDistinct;
+ [filterTableDistinctMenuItem setState:(filterTableDistinct) ? NSOnState : NSOffState];
+
// If live search is set perform filtering
if([filterTableLiveSearchCheckbox state] == NSOnState)
[self filterTable:filterTableFilterButton];
@@ -4205,7 +4207,10 @@
*/
- (NSString*)escapeFilterTableDefaultOperator:(NSString*)anOperator
{
- NSMutableString *newOp = [NSMutableString string];
+
+ if(anOperator == nil) return @"";
+
+ NSMutableString *newOp = [[[NSMutableString alloc] initWithCapacity:[anOperator length]] autorelease];
[newOp setString:anOperator];
[newOp replaceOccurrencesOfRegex:@"%" withString:@"%%"];
[newOp replaceOccurrencesOfRegex:@"(?<!`)@(?!=`)" withString:@"%"];