aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContent.m
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/SPTableContent.m
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/SPTableContent.m')
-rw-r--r--Source/SPTableContent.m11
1 files changed, 8 insertions, 3 deletions
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:@"%"];